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:
@@ -270,13 +270,32 @@ public class PathableClassLoader extends URLClassLoader {
|
|||||||
}
|
}
|
||||||
Enumeration parentUrls = parent.getResources(name);
|
Enumeration parentUrls = parent.getResources(name);
|
||||||
|
|
||||||
ArrayList localItems = Collections.list(localUrls);
|
ArrayList localItems = toList(localUrls);
|
||||||
ArrayList parentItems = Collections.list(parentUrls);
|
ArrayList parentItems = toList(parentUrls);
|
||||||
localItems.addAll(parentItems);
|
localItems.addAll(parentItems);
|
||||||
return Collections.enumeration(localItems);
|
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
|
* Same as parent class method except that when parentFirst is false
|
||||||
* the resource is looked for in the local classpath before the parent
|
* the resource is looked for in the local classpath before the parent
|
||||||
|
|||||||
Reference in New Issue
Block a user