8000 BundleContext.getBundle(String) not consistent with BundleContext.getBundles() · Issue #83 · eclipse-archived/concierge · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.
This repository was archived by the owner on Nov 15, 2022. It is now read-only.
BundleContext.getBundle(String) not consistent with BundleContext.getBundles() #83
Open
@pdolezal

Description

@pdolezal

When I tried Concierge with own launcher I found out that BundleContext.getBundle(String) does not work correctly when the framework uses an existing storage.

Basically the scenario follows this pseudocode:

Framework framework = factory.newFramework(properties); // Here the path to the storage is set
framework.init();
BundleContext systemBundle = framework.getBundleContext();
Bundle bundle = systemBundle.getBundle(location);
if (bundle == null) {
    try (InputStream is = open(location)) {
        bundle = systemBundle.installBundle(location, is);
    }
}

The bundle variable is always null, while it should return the installed bundle when the code is run second time with the same storage. I tried replacing getBundle with something like:

Bundle bundle = Stream.of(systemBundle.getBundles())
    .filter(b -> location.equals(b.getLocation())
    .findAny()
    .orElse(null);

And this always works. So the framework apparently knows which bundles were installed, it just does not update its structures for getBundle to work properly.

The described behavior of getBundle in this use case results in duplicated installation of the bundle – and what is even more interesting: the newly installed bundle has the same location as the existing bundle. I believe this is wrong as well and the location should be unique. Maybe the framework implementation fails to check the location duplicity for the same reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0