[ 
https://issues.apache.org/jira/browse/FELIX-676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard S. Hall resolved FELIX-676.
-----------------------------------

    Resolution: Fixed
      Assignee: Richard S. Hall

I applied a patch to resolve this issue. The short explanation is that we were 
just ignoring matching attributes altogether when it came to dynamic import 
resolution. The supplied example now works as expected. I even got around to 
fixing our diagnostic message for dynamic imports, which has been broken since 
we added support for require-bundle.

Sahoo, please see if trunk resolves your issues. If so, please close this bug. 
Thanks.

> Mandatory attribute matching not working for  DynamicImport-Package
> -------------------------------------------------------------------
>
>                 Key: FELIX-676
>                 URL: https://issues.apache.org/jira/browse/FELIX-676
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.0.4
>         Environment: NA
>            Reporter: Sahoo
>            Assignee: Richard S. Hall
>             Fix For: felix-1.2.0
>
>         Attachments: dynamic-import-mandatory-attr.zip
>
>
> Section #3.8.2 of R4 spec says the following:
> /All mandatory arbitrary attributes (as specified by the exporter, see 
> Mandatory Attributes on page 45) must be specified in the dynamic import 
> definition and match./
> I suspect it is *not* working in Felix yet. I am using Felix v1.0.4. 
> Mandatory attributes are considered while resolving static imports, but not 
> for dynamic imports. I have two bundles that have identical contents, except 
> that bundle #10 uses regular import, where as bundle #11 uses dynamic import. 
> They both are trying to load a class foo.A. Package foo is exported by bundle 
> #12 and it has a mandatory attribute defined like this:
> /
> Export-Package = foo;password=foo;mandatory:=password/
> As shown below, when I start bundle #10, I get resolution error, where as 
> bundle #11 happily wires to bundle #12.
> -> start 10
> org.osgi.framework.BundleException: Unresolved package in bundle 10: package; 
> (package=foo)
> -> start 11
> DEBUG: WIRE: 11.0 -> org.osgi.framework -> 0
> DEBUG: WIRE: 12.0 -> foo -> 12.0
> DEBUG: WIRE: 11.0 -> foo -> 12.0
> class foo.A is loaded by 12.0
> The diff between manifest files of bundle #10 and #11 is supplied below:
> diff dynamic-importer/target/classes/META-INF/MANIFEST.MF 
> static-importer/target/classes/META-INF/MANIFEST.MF
> 5,6c5,6
> < Import-Package: org.osgi.framework;version="1.3"
> < Bnd-LastModified: 1218274803828
> ---
> > Import-Package: foo,org.osgi.framework;version="1.3"
> > Bnd-LastModified: 1218274805799
> 8c8
> < Bundle-Name: dynamic-importer
> ---
> > Bundle-Name: static-importer
> 12,13c12,13
> < Bundle-SymbolicName: sahoo.dynamic-import-mandatory-attr.dynamic-impor
> <  ter
> ---
> > Bundle-SymbolicName: sahoo.dynamic-import-mandatory-attr.static-import
> >  er
> 15d14
> < DynamicImport-Package: *
> I am attaching a simple test case demonstrating the same.
> I suspect it has to do with the way filters are used to match requirements 
> with capabilities. The filter is not aware of mandatory attributes, so it 
> matches even when they are not specified.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to