[ https://issues.apache.org/jira/browse/FELIX-3618?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon Chemouil closed FELIX-3618. --------------------------------- Fixed > [Framework] Should not allow bundles to use generic cap/req headers for > osgi.wiring.* namespaces > ------------------------------------------------------------------------------------------------ > > Key: FELIX-3618 > URL: https://issues.apache.org/jira/browse/FELIX-3618 > Project: Felix > Issue Type: Bug > Components: Framework > Affects Versions: framework-4.0.3 > Reporter: Simon Chemouil > Assignee: Richard S. Hall > Priority: Minor > Fix For: framework-4.2.0 > > > I think I found a bug while I playing with 4.3's Bundle Capabilities. > I tried to convert a simple Export-Package to Provide-Capability. > Core specification 5.0, §3.3.3 defines the grammar for Provide-Compatibility > headers:Provide-Capability ::= capability ( ',' capability )* > capability ::= name-space > ( ’;’ directive | typed-attr )* > name-space ::= symbolic-name > typed-attr ::= extended ( ’:’ type ) ’=’ argument > type ::= scalar | list > scalar ::= ’String’ | ’Version’ | ’Long’ > | ’Double’ > list ::= ’List<’ scalar ’>’ > With my interpretation of the spec: > Export-Package: com.test.api; version="1.0.0" > becomes: > Provide-Capability: osgi.wiring.package; osgi.wiring.package=com.test.api; > version:Version=1.0.0 > where osgi.wiring.package is both the namespace and the attribute name for > the package name. Please note that the namespace is mandatory. > This is consistent with the Require-Capability statement: > osgi.wiring.package; > (&(osgi.wiring.package=com.test.api)(version>=1.0.0)(!(version>=2.0.0))) > resolved by: > osgi.wiring.package; com.test.api 1.0.0 from com.test.api [41] > If I use this header and install my bundle, using Felix 4.0.3 I get: > g! inspect c * 41 > com.test.api [41] provides: > ------------------------------- > osgi.wiring.bundle; com.test.api 1.0.0 [UNUSED] > osgi.wiring.host; com.test.api 1.0.0 [UNUSED] > osgi.wiring.package; com.test.api 1.0.0 required by: > com.test.consumer [36] > osgi.wiring.package; com.test.api 1.0.0 [UNUSED] > g! > Note that the same package is advised as exported *twice* by the bundle with > only the first one wired. > Now, if I use Export-Package, it is exported just once as expected, > The only way with Provide-Capability to get it exported just once is to omit > the namespace, as in: > Provide-Capability: osgi.wiring.package=com.test.api; version:Version=1.0.0 > However, this is not compliant with the spec, since the namespace is > mandatory. > Finally, a last test where the namespace osgi.wiring.package has no > attributes or directives fail with a NullPointerException, it should probably > be handled gracefully. > Provide-Capability: osgi.wiring.package > Stacktrace: > g! start 62 > ERROR: Unable to resolve 62.0 (java.lang.NullPointerException) > java.lang.NullPointerException > at > org.apache.felix.framework.BundleWiringImpl.<init>(BundleWiringImpl.java:270) > at > org.apache.felix.framework.StatefulResolver.markResolvedRevisions(StatefulResolver.java:650) > at > org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:189) > at > org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3819) > at org.apache.felix.framework.Felix.startBundle(Felix.java:1868) > at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944) > at org.apache.felix.gogo.command.Basic.start(Basic.java:729) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira