1
0

Replaced method introduced in JDK1.4 with clean implementation.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@396112 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Burrell Donkin
2006-04-22 11:38:25 +00:00
parent 18e3a6fdad
commit cd2e8b9657

View File

@@ -270,13 +270,32 @@ public class PathableClassLoader extends URLClassLoader {
}
Enumeration parentUrls = parent.getResources(name);
ArrayList localItems = Collections.list(localUrls);
ArrayList parentItems = Collections.list(parentUrls);
ArrayList localItems = toList(localUrls);
ArrayList parentItems = toList(parentUrls);
localItems.addAll(parentItems);
return Collections.enumeration(localItems);
}
}
/**
*
* Clean implementation of list function of
* {@link java.utils.Collection} added in JDK 1.4
* @param en <code>Enumeration</code>, possibly null
* @return <code>ArrayList</code> containing the enumerated
* elements in the enumerated order, not null
*/
private ArrayList toList(Enumeration en) {
ArrayList results = new ArrayList();
if (en != null) {
while (en.hasMoreElements()){
Object element = en.nextElement();
results.add(element);
}
}
return results;
}
/**
* Same as parent class method except that when parentFirst is false
* the resource is looked for in the local classpath before the parent