From 54be7a626d4bc7f577c57455b634a6b61da8f352 Mon Sep 17 00:00:00 2001
From: Matthew Jason Benson
Date: Fri, 2 Dec 2005 14:50:00 +0000
Subject: [PATCH] remove java resource support from URL resource in favor of
JavaResource.
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@351741 13f79535-47bb-0310-9956-ffa450edef68
---
docs/manual/CoreTypes/resources.html | 14 -----
src/etc/testcases/types/resources/build.xml | 18 +-----
.../ant/types/resources/URLResource.java | 56 +------------------
.../ant/types/ResourceCollectionsTest.java | 4 --
4 files changed, 3 insertions(+), 89 deletions(-)
diff --git a/docs/manual/CoreTypes/resources.html b/docs/manual/CoreTypes/resources.html
index 809fa1bd7..fb3f23e84 100644
--- a/docs/manual/CoreTypes/resources.html
+++ b/docs/manual/CoreTypes/resources.html
@@ -229,21 +229,7 @@ element.
file |
The file to expose as a file: url |
-
- javaresource |
- The Java resource to expose as a jar: url |
-
-
- classpath |
- The classpath to use when establishing the URL
- for a Java resource |
- No |
-
-The classpath along which to search for a Java resource
- can also be specified by means of one or more nested
- classpath
elements.
-
diff --git a/src/etc/testcases/types/resources/build.xml b/src/etc/testcases/types/resources/build.xml
index ee0b16175..96c84b9df 100755
--- a/src/etc/testcases/types/resources/build.xml
+++ b/src/etc/testcases/types/resources/build.xml
@@ -346,24 +346,8 @@ depends="testfileset,testdirset,testfilelist,testpath,testzipfileset,testpropert
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+depends="testfileurl,testfileurlref,testhttpurl1,testhttpurl2,testjarurl" />
This is a test.
diff --git a/src/main/org/apache/tools/ant/types/resources/URLResource.java b/src/main/org/apache/tools/ant/types/resources/URLResource.java
index b5c320979..93aff1ba9 100755
--- a/src/main/org/apache/tools/ant/types/resources/URLResource.java
+++ b/src/main/org/apache/tools/ant/types/resources/URLResource.java
@@ -43,9 +43,7 @@ public class URLResource extends Resource {
= Resource.getMagicNumber("null URL".getBytes());
private URL url;
- private String javaResource;
private URLConnection conn;
- private Path classpath;
/**
* Default constructor.
@@ -99,37 +97,6 @@ public class URLResource extends Resource {
}
}
- /**
- * Set the resource name with which to expose a Java resource.
- * @param s the Java resource name.
- * @see java.lang.ClassLoader#getResource(String)
- */
- public synchronized void setJavaResource(String s) {
- checkAttributesAllowed();
- javaResource = s;
- }
-
- /**
- * Set the classpath for this URLResource.
- * @param p the Path against which to resolve Java resources.
- */
- public synchronized void setClasspath(Path p) {
- checkAttributesAllowed();
- addConfiguredClasspath(p);
- }
-
- /**
- * Create a nested classpath element.
- * @return a Path object.
- */
- public synchronized void addConfiguredClasspath(Path p) {
- checkChildrenAllowed();
- if (classpath == null) {
- classpath = new Path(getProject());
- }
- classpath.add(p);
- }
-
/**
* Get the URL used by this URLResource.
* @return a URL object.
@@ -138,25 +105,6 @@ public class URLResource extends Resource {
if (isReference()) {
return ((URLResource) getCheckedRef()).getURL();
}
- if (url == null && javaResource != null) {
- ClassLoader cl = null;
- AntClassLoader acl = null;
- if (classpath != null) {
- acl = getProject().createClassLoader(classpath);
- cl = acl;
- } else {
- cl = getClass().getClassLoader();
- if (cl == null) {
- cl = ClassLoader.getSystemClassLoader();
- }
- }
- if (cl != null) {
- setURL(cl.getResource(javaResource));
- if (acl != null) {
- acl.cleanup();
- }
- }
- }
return url;
}
@@ -166,7 +114,7 @@ public class URLResource extends Resource {
*/
public synchronized void setRefid(Reference r) {
//not using the accessor in this case to avoid side effects
- if (url != null || javaResource != null) {
+ if (url != null) {
throw tooManyAttributes();
}
super.setRefid(r);
@@ -370,4 +318,4 @@ public class URLResource extends Resource {
}
}
-}
\ No newline at end of file
+}
diff --git a/src/testcases/org/apache/tools/ant/types/ResourceCollectionsTest.java b/src/testcases/org/apache/tools/ant/types/ResourceCollectionsTest.java
index 6727a2383..8cd02c667 100755
--- a/src/testcases/org/apache/tools/ant/types/ResourceCollectionsTest.java
+++ b/src/testcases/org/apache/tools/ant/types/ResourceCollectionsTest.java
@@ -117,10 +117,6 @@ public class ResourceCollectionsTest extends BuildFileTest {
executeTarget("testresourcesref");
}
- public void testresourceurl() {
- executeTarget("testresourceurl");
- }
-
public void teststring1() {
executeTarget("teststring1");
}