diff -r 64da2a80df88 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java --- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Tue Jan 25 10:19:20 2011 -0500 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Tue Jan 25 14:42:07 2011 -0500 @@ -39,6 +39,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Random; import java.util.TreeSet; import java.util.Vector; @@ -1086,27 +1087,42 @@ * Finds the resource in this, the parent, or the extension * class loaders. */ - public URL getResource(String name) { - URL result = super.getResource(name); - - for (int i = 1; i < loaders.length; i++) - if (result == null) - result = loaders[i].getResource(name); - - return result; + @Override + public URL findResource(String name) { + try { + return findResources(name).nextElement(); + } catch (NoSuchElementException e) { + return null; + } catch (IOException e) { + return null; + } } /** - * Finds the resource in this, the parent, or the extension + * Finds the resources in this, the parent, or the extension * class loaders. */ @Override public Enumeration<URL> findResources(String name) throws IOException { + + List<URL> resources = findResourcesBySearching(name); + + // if not found, load all lazy resources; repeat search + while (resources.size() == 0 && addNextResource() != null) { + resources = findResourcesBySearching(name); + } + + return Collections.enumeration(resources); + } + + private List<URL> findResourcesBySearching(String name) throws IOException { Vector<URL> resources = new Vector<URL>(); for (int i = 0; i < loaders.length; i++) { Enumeration<URL> e; - + // TODO check if this will blow up or not + // if loaders[1].getResource() is called, wont it call getResource() on + // the original caller? infinite recursion? if (loaders[i] == this) e = super.findResources(name); else @@ -1116,7 +1132,7 @@ resources.add(e.nextElement()); } - return resources.elements(); + return resources; } /**