Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 335688

Summary: NullPtrException from uninstall of CompositeBundle
Product: [Eclipse Project] Equinox Reporter: Chris <wilkobets>
Component: FrameworkAssignee: equinox.framework-inbox <equinox.framework-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: alasdair, sptaszkiewicz, tjwatson
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
stacktrace of exception none

Description Chris CLA 2011-01-28 09:34:50 EST
Build Identifier: org.eclipse.osgi_3.6.1.R36x_v20100806.jar

We use composite bundles in our code. Due to some inconsistent state in our code we received a NullPointerException from equinox.

The uninstall may be invalid in the current state but the equinox libraries should not throw a null pointer exception and instead should report the problem in an appropriate way.

I will attach the stack trace.

Reproducible: Didn't try
Comment 1 Chris CLA 2011-01-28 09:37:36 EST
Created attachment 187841 [details]
stacktrace of exception

Stack trace of the NPE
Comment 2 Thomas Watson CLA 2011-02-21 15:56:29 EST
Can you give some hints as to the inconsistent state in your code?  Is the bundle already uninstalled or something like that?
Comment 3 Alasdair Nottingham CLA 2011-02-24 08:05:24 EST
Hi,

I've been having this problem with code in the apache aries project. When the code was opting to uninstall a composite bundle it was doing the following:

compositeBundle.stop();
compositeBundle.uninstall();

The stop call resulted in all bundles in the companianFramework being removed, even the system bundle. When uninstall is called it tries to get the surrogate bundle (bundle 1) and to do that it inits the framework. This results in the system bundle being "installed" but not the surrogate bundle. So the attempt to get bundle 1 results in null being returned. The code then calls getDelegate on bundle 1 which is null so you get the NPE.

Removing the call to stop appears to have solve the problem, although I am concerned that it could cause other problems down the line.
Comment 4 Thomas Watson CLA 2011-02-24 11:35:19 EST
(In reply to comment #3)
> Hi,
> 
> I've been having this problem with code in the apache aries project. When the
> code was opting to uninstall a composite bundle it was doing the following:
> 
> compositeBundle.stop();
> compositeBundle.uninstall();
> 
> The stop call resulted in all bundles in the companianFramework being removed,
> even the system bundle. When uninstall is called it tries to get the surrogate
> bundle (bundle 1) and to do that it inits the framework. This results in the
> system bundle being "installed" but not the surrogate bundle. So the attempt to
> get bundle 1 results in null being returned. The code then calls getDelegate on
> bundle 1 which is null so you get the NPE.
> 
> Removing the call to stop appears to have solve the problem, although I am
> concerned that it could cause other problems down the line.

Are you certain that you are not uninstalling constituent bundles from the composite in some BundleListener that is listening to STOPPING events when you stop the composite.  Stopping the composite should not cause all the constituent bundles to become uninstalled.  I am unable to reproduce this at this point.
Comment 5 Szymon Ptaszkiewicz CLA 2015-04-23 11:25:08 EDT
As mentioned in comment 4, this problem is not reproducible. Please reopen if you still see the problem in a more recent version of Equinox.
Comment 6 Thomas Watson CLA 2015-04-23 13:03:38 EDT
(In reply to Szymon Ptaszkiewicz from comment #5)
> As mentioned in comment 4, this problem is not reproducible. Please reopen
> if you still see the problem in a more recent version of Equinox.

More importantly the composite bundle (which was provisional API) was removed in the Luna release so there will be no way of reproducing on the most recent release.