[ https://issues.apache.org/jira/browse/FELIX-1838?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard S. Hall resolved FELIX-1838. ------------------------------------ Resolution: Fixed Fix Version/s: (was: felix-2.0.2) felix-2.2.0 Assignee: Richard S. Hall Missed this fix when refactoring ICapability. Should be working now. Please close this issue if you are satisfied. Thanks. > PackageAdmin.getExportedPackages() duplicates output for packaged with > different version > ---------------------------------------------------------------------------------------- > > Key: FELIX-1838 > URL: https://issues.apache.org/jira/browse/FELIX-1838 > Project: Felix > Issue Type: Bug > Reporter: Walter Treur > Assignee: Richard S. Hall > Fix For: felix-2.2.0 > > > I noticed that when you have a bundle that exports the same package twice, > but with different versions, the PackageAdmin returns the package twice for > each version. > Assume the following code in BundleActivator.start(): > ServiceTracker tracker = new ServiceTracker(context, > PackageAdmin.class.getName(), null); > tracker.open(); > PackageAdmin admin = (PackageAdmin) tracker.waitForService(5000); > tracker.close(); > ExportedPackage[] exportedPackages = > admin.getExportedPackages(context.getBundle()); > for (ExportedPackage exportedPackage : exportedPackages) { > > System.out.println(exportedPackage.getName()+":"+exportedPackage.getVersion()); > } > And the corresponding manifest file of the same bundle > Manifest-Version: 1.0 > Bundle-ManifestVersion: 2 > Bundle-Name: Packge Admin test > Bundle-Version: 1.0.0 > Bundle-SymbolicName: package-admin-test > Bundle-Activator: pkg.admin.test.Activator > Import-Package: org.osgi.framework,org.osgi.util.tracker,org.osgi.serv > ice.packageadmin > Export-Package: pkg.admin.test.foo;version=1.0.0,pkg.admin.test.foo;ve > rsion=2.0.0 > When I start the bundle in Felix 2.0.2 I get the following output: > Welcome to Felix > ================ > -> ps > START LEVEL 1 > ID State Level Name > [ 0] [Active ] [ 0] System Bundle (2.0.2) > [ 1] [Active ] [ 1] Apache Felix Bundle Repository (1.4.2) > [ 2] [Active ] [ 1] Apache Felix Shell Service (1.4.1) > [ 3] [Active ] [ 1] Apache Felix Shell TUI (1.4.1) > -> install file:/home/wtreur/Desktop/package-admin-test.jar > Bundle ID: 4 > -> start 4 > pkg.admin.test.foo:1.0.0 > pkg.admin.test.foo:1.0.0 > pkg.admin.test.foo:2.0.0 > pkg.admin.test.foo:2.0.0 > Note that this problem didn't exist in felix 2.0.1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.