Teach SystemClassLoader#getResources to not stop at the first match

The getResources method can be used to find all matches in the class
path for a given path, e.g. to seek out all the META-INF/MANIFEST.MF
files contained in all of the .jar files in the class path.

We just taught the findResources() method to return all matches (rather
than only the first), so let's use that method to get all the matches
from the current class loader's class path elements.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin 2013-10-28 08:53:22 -05:00
parent 0602d4a447
commit 167688eabd

View File

@ -107,9 +107,9 @@ public class SystemClassLoader extends ClassLoader {
}
}
URL url = findResource(name);
if (url != null) {
urls.add(url);
Enumeration<URL> urls2 = findResources(name);
while (urls2.hasMoreElements()) {
urls.add(urls2.nextElement());
}
return Collections.enumeration(urls);