]
Geoffrey De Smet updated DROOLS-1062:
-------------------------------------
Attachment: screenshot-1.png
ProjectClassLoader.getResources(String) does not work correctly
---------------------------------------------------------------
Key: DROOLS-1062
URL:
https://issues.jboss.org/browse/DROOLS-1062
Project: Drools
Issue Type: Bug
Components: core engine
Reporter: Geoffrey De Smet
Attachments: screenshot-1.png
ProjectClassLoader.getResource*s*("org/foo") returns an enumeration with 0
elements. That should be 1 element (most of the time anyway, as we don't have split
packages).
See screenshot to learn how a getResources(String) should behave
{code}
public class ClassLoaderGetResourcesExperiment {
public static void main(String[] args) throws IOException {
ClassLoader classLoader =
ClassLoaderGetResourcesExperiment.class.getClassLoader();
printEnumeration(classLoader, "org/optaplanner/core/experiment");
printEnumeration(classLoader, "org/optaplanner/core/experiment/sub1");
printEnumeration(classLoader, "org/optaplanner/core/experiment/sub2");
printEnumeration(classLoader, "org/optaplanner/core/experiment/sub3");
}
public static void printEnumeration(ClassLoader classLoader, String s) throws
IOException {
Enumeration<URL> enumeration = classLoader.getResources(s);
System.out.println(s);
System.out.println("================================");
while (enumeration.hasMoreElements()) {
Object nextElement = enumeration.nextElement();
System.out.println(" " + nextElement);
}
}
}
{code}