You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Simon Chemouil (JIRA)" <ji...@apache.org> on 2012/07/30 15:09:34 UTC

[jira] [Created] (FELIX-3618) Provide-Capability with osgi.wiring.package not spec compliant

Simon Chemouil created FELIX-3618:
-------------------------------------

             Summary: Provide-Capability with osgi.wiring.package not spec compliant
                 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
            Priority: Minor


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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (FELIX-3618) [Framework] Should not allow bundles to use generic cap/req headers for osgi.wiring.* namespaces

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3618?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall updated FELIX-3618:
-----------------------------------

    Fix Version/s: framework-4.2.0
          Summary: [Framework] Should not allow bundles to use generic cap/req headers for osgi.wiring.* namespaces  (was: Provide-Capability with osgi.wiring.package not spec compliant)
    
> [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
>            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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (FELIX-3618) Provide-Capability with osgi.wiring.package not spec compliant

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-3618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13424858#comment-13424858 ] 

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

Actually, the real bug here is that the framework shouldn't allow you to specify any osgi.wiring.* namespace in the generic cap/req model in the bundle manifest, since the spec doesn't allow that.

We need to put a check that will either ignore such cases or throw an installation exception...I'll have to check which is the correct response. Thanks.
                
> Provide-Capability with osgi.wiring.package not spec compliant
> --------------------------------------------------------------
>
>                 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
>            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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira