[jboss-jira] [JBoss JIRA] (DROOLS-1062) ProjectClassLoader.getResources(String) does not work correctly

Petr Široký (JIRA) issues at jboss.org
Fri Feb 12 18:29:00 EST 2016


     [ https://issues.jboss.org/browse/DROOLS-1062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Petr Široký reassigned DROOLS-1062:
-----------------------------------

    Assignee: Petr Široký


> 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
>            Assignee: Petr Široký
>         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}



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the jboss-jira mailing list