|
|
@@ -889,15 +889,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo |
|
|
|
if (url != null) { |
|
|
|
log("Resource " + name + " loaded from parent loader", Project.MSG_DEBUG); |
|
|
|
} else { |
|
|
|
// try and load from this loader if the parent either didn't find |
|
|
|
// it or wasn't consulted. |
|
|
|
for (final File pathComponent : pathComponents) { |
|
|
|
url = getResourceURL(pathComponent, name); |
|
|
|
if (url != null) { |
|
|
|
log("Resource " + name + " loaded from ant loader", Project.MSG_DEBUG); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
url = getUrl(name); |
|
|
|
} |
|
|
|
if (url == null && !isParentFirst(name)) { |
|
|
|
// this loader was first but it didn't find it - try the parent |
|
|
@@ -916,6 +908,29 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo |
|
|
|
return url; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Finds a matching file by iterating through path components. |
|
|
|
* |
|
|
|
* @param name File to find |
|
|
|
* @return A <code>URL</code> object for reading the resource, or <code>null</code> if the |
|
|
|
* resource could not be found |
|
|
|
*/ |
|
|
|
private URL getUrl(String name) { |
|
|
|
URL url = null; |
|
|
|
|
|
|
|
// try and load from this loader if the parent either didn't find |
|
|
|
// it or wasn't consulted. |
|
|
|
for (final File pathComponent : pathComponents) { |
|
|
|
url = getResourceURL(pathComponent, name); |
|
|
|
if (url != null) { |
|
|
|
log("Resource " + name + " loaded from ant loader", Project.MSG_DEBUG); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return url; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Finds all the resources with the given name. A resource is some |
|
|
|
* data (images, audio, text, etc) that can be accessed by class |
|
|
@@ -935,6 +950,18 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo |
|
|
|
return findResources(name, false); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Finds the resource with the given name. |
|
|
|
* |
|
|
|
* @param name The resource name |
|
|
|
* @return A <code>URL</code> object for reading the resource, or <code>null</code> if the |
|
|
|
* resource could not be found |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
protected URL findResource(final String name) { |
|
|
|
return getUrl(name); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Returns an enumeration of URLs representing all the resources with the |
|
|
|
* given name by searching the class loader's classpath. |
|
|
|