@@ -889,15 +889,7 @@ public URL getResource(final String name) {
889889 if (url != null ) {
890890 log ("Resource " + name + " loaded from parent loader" , Project .MSG_DEBUG );
891891 } else {
892- // try and load from this loader if the parent either didn't find
893- // it or wasn't consulted.
894- for (final File pathComponent : pathComponents ) {
895- url = getResourceURL (pathComponent , name );
896- if (url != null ) {
897- log ("Resource " + name + " loaded from ant loader" , Project .MSG_DEBUG );
898- break ;
899- }
900- }
892+ url = getUrl (name );
901893 }
902894 if (url == null && !isParentFirst (name )) {
903895 // this loader was first but it didn't find it - try the parent
@@ -916,6 +908,29 @@ public URL getResource(final String name) {
916908 return url ;
917909 }
918910
911+ /**
912+ * Finds a matching file by iterating through path components.
913+ *
914+ * @param name File to find
915+ * @return A <code>URL</code> object for reading the resource, or <code>null</code> if the
916+ * resource could not be found
917+ */
918+ private URL getUrl (String name ) {
919+ URL url = null ;
920+
921+ // try and load from this loader if the parent either didn't find
922+ // it or wasn't consulted.
923+ for (final File pathComponent : pathComponents ) {
924+ url = getResourceURL (pathComponent , name );
925+ if (url != null ) {
926+ log ("Resource " + name + " loaded from ant loader" , Project .MSG_DEBUG );
927+ break ;
928+ }
929+ }
930+
931+ return url ;
932+ }
933+
919934 /**
920935 * Finds all the resources with the given name. A resource is some
921936 * data (images, audio, text, etc) that can be accessed by class
@@ -935,6 +950,18 @@ public Enumeration<URL> getNamedResources(final String name)
935950 return findResources (name , false );
936951 }
937952
953+ /**
954+ * Finds the resource with the given name.
955+ *
956+ * @param name The resource name
957+ * @return A <code>URL</code> object for reading the resource, or <code>null</code> if the
958+ * resource could not be found
959+ */
960+ @ Override
961+ protected URL findResource (final String name ) {
962+ return getUrl (name );
963+ }
964+
938965 /**
939966 * Returns an enumeration of URLs representing all the resources with the
940967 * given name by searching the class loader's classpath.
0 commit comments