Hi Ladislav,
now I understand where the problem comes.
Ladislav is trying to call aBundle.getEntry() in a Bundle Listener.
The method installNewBundle() is implemented as:
...
// notify the listeners
notifyBundleListeners(BundleEvent.INSTALLED, bundle, context.getBundle());
bundle.install();
...
The bundle will be added to the internal list bundleID_bundles in install() method, which is called AFTER firing the Bundle.INSTALLED event.
synchronized (framework) {
framework.bundles.add(this);
framework.bundleID_bundles.put(new Long(getBundleId()), this);
framework.symbolicName_bundles.insert(
currentRevision.getSymbolicName(), this);
framework.location_bundles.put(location, this);
}
But: The openConnection method indirectly used by getEntry() and loading content from URL makes a lookup on internal list
final BundleImpl bundle = (BundleImpl) ConciergeURLStreamHandlerFactory.this.frameworkInstance.bundleID_bundles.get(bundleId);
if (bundle == null) {
throw new IllegalStateException("Bundle for URL " + u + " can not be found");
}
This exception will be raised and the bundle:/1.0/icon.png can NOT be resolved to a bundle, as list does not yet contain the if of installed bundle.
It is valid to make calls on a bundle in a BundleEventListener? My assumption would be yes.
In this case parts of bundle.install() code has to be moved into Constructor (there is already a comment in code on that).
Bye, Jochen