You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Richard S. Hall (JIRA)" <ji...@apache.org> on 2017/06/27 15:09:00 UTC

[jira] [Commented] (FELIX-5659) Possible bug with Framework#listResources

    [ https://issues.apache.org/jira/browse/FELIX-5659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16064973#comment-16064973 ] 

Richard S. Hall commented on FELIX-5659:
----------------------------------------

From javadoc

{quote}Returns the names of resources visible to this bundle wiring's class loader. The returned names can be used to access the resources via this bundle wiring's class loader.

Only the resource names for resources in bundle wirings will be returned. The names of resources visible to a bundle wiring's parent class loader, such as the bootstrap class loader, must not be included in the result.

Only established wires will be examined for resources. This method must not cause new wires for dynamic imports to be established.{quote}

At a minimum, it would appear that the two cannot always return the same result since the OSGi API doesn't search all the way up the class loader hierarchy.

> Possible bug with Framework#listResources
> -----------------------------------------
>
>                 Key: FELIX-5659
>                 URL: https://issues.apache.org/jira/browse/FELIX-5659
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>
> I'm not completely sure what the behavior should be, but it seems to me not very understandable that the following may not return the same thing when used for the system bundle:
> {code}
>    systemBundle.adapt(BundleWiring.class).listResources("META-INF/services", "javax.script.ScriptEngineFactory", 2)
> {code}
> and
> {code}
>   systemBundle.adapt(BundleWiring.class).getClassLoader().loadResources("META-INF/services/javax.script.ScriptEngineFactory")
> {code}
> On JDK 8, the second call correctly returns the nashorn javascript engine factory, but it can't be found using the first call.
> Anyone knows if this is an expected behavior ?
> Equinox seems to behave the same way fwiw.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)