Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 387088 - org.eclipse.equinox.p2.director NullPointerException during ProvisioningListener.notify
Summary: org.eclipse.equinox.p2.director NullPointerException during ProvisioningListe...
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.8.0 Juno   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: Luna SR2   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 380244 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-08-12 22:02 EDT by Eric Van Dewoestine CLA
Modified: 2015-02-05 13:50 EST (History)
6 users (show)

See Also:


Attachments
added null check in the notify method (141 bytes, patch)
2014-12-10 01:54 EST, sudhan p CLA
umasudhan.p: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Van Dewoestine CLA 2012-08-12 22:02:30 EDT
I'm not sure how to reproduce the issue, but I got a report of a user receiving a NullPointerException when running the p2 directory application:

!SESSION 2012-08-11 01:15:24.047 -----------------------------------------------
eclipse.buildId=I20120608-1400
java.version=1.6.0_32
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -application org.eclipse.equinox.p2.director -repository file:///tmp/formic_1775706431/update -uninstallIU org.eclim.installer.feature.group
Command-line arguments:  -clean -application org.eclipse.equinox.p2.director -repository file:///tmp/formic_1775706431/update -uninstallIU org.eclim.installer.feature.group

!ENTRY org.eclipse.equinox.p2.core 4 0 2012-08-11 01:15:53.443
!MESSAGE Exception during event notification
!STACK 0
java.lang.NullPointerException
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.notify(DirectorApplication.java:653)
	at org.eclipse.equinox.internal.p2.core.ProvisioningEventBus.dispatchEvent(ProvisioningEventBus.java:108)
	at org.eclipse.equinox.internal.p2.core.ProvisioningEventBus.dispatchEvent(ProvisioningEventBus.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

Looking at the code it appears that the director's notify method is invoked prior to the initialization of the artifactReposForRemoval variable. The notify method was added to resolve https://bugs.eclipse.org/bugs/show_bug.cgi?id=340971

Another reference to the same NPE was found on the debian mailing list:
http://lists.debian.org/debian-java/2012/05/msg00129.html
Comment 1 Martin Oberhuber CLA 2014-06-24 04:45:20 EDT
CQ:WIND00-WB4-2402

We also see this backtrace sometimes, typically on command-line when uninstalling a feature with the p2 director.
Comment 2 sudhan p CLA 2014-12-10 01:54:56 EST
Created attachment 249305 [details]
added null check in the notify method

A null check is missing in the notify method- this same check is there in other places where artifactReposForRemoval is used.
Comment 3 Pascal Rapicault CLA 2015-01-18 12:33:30 EST
thanks fix pushed to master.
Comment 4 Martin Oberhuber CLA 2015-01-19 03:50:41 EST
Thanks for the Fix !

Could we get this backported to Luna SR2 ? - Since the message is really confusing for some of our command-line install scenarios.
Comment 5 Uwe Stieber CLA 2015-01-19 04:41:17 EST
I believe that the fix is inclomplete. To really fix the NPE, also the "metadataReposForRemoval" needs to be checked as well. Both variables are null, without checking "metadataReposForRemoval" also, the NPE will still occur, just at a different line.
Comment 6 Markus Keller CLA 2015-01-20 04:59:56 EST
*** Bug 380244 has been marked as a duplicate of this bug. ***
Comment 7 Pascal Rapicault CLA 2015-01-22 23:11:25 EST
Please provide a complete gerrit patch for Luna and for any previous version and I will release.
Comment 8 Uwe Stieber CLA 2015-01-23 03:57:12 EST
(In reply to Pascal Rapicault from comment #7)
> Please provide a complete gerrit patch for Luna and for any previous version
> and I will release.

Prepared 2 changes on gerrit,

- one for master (Mars): https://git.eclipse.org/r/40194
- one for R4_4_maintenance (Luna): https://git.eclipse.org/r/40197
Comment 9 Pascal Rapicault CLA 2015-01-23 09:57:57 EST
Thanks for the patches. They have been committed to the appropriate branches.