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

Bug 317728

Summary: NPE in J2EEComponentClasspathContainer.getBaseEARLibRefs
Product: [WebTools] WTP Java EE Tools Reporter: Jason Sholl <jsholl>
Component: jst.j2eeAssignee: Jason Sholl <jsholl>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: ccc
Version: 3.2Flags: cbridgha: review+
Target Milestone: 3.2.1   
Hardware: PC   
OS: Windows Server 2003   
Whiteboard:
Attachments:
Description Flags
patch for 3.2.1 none

Description Jason Sholl CLA 2010-06-23 12:32:49 EDT
The following NPE can be observed in 321 code because of a stale portion of the the dependencygraph.  This can reproduced when removing modules from an EAR that contains a deployment descriptor.

!ENTRY org.eclipse.jst.j2ee 4 2 2010-06-23 12:26:20.156
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jst.j2ee".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer.getBaseEARLibRefs(J2EEComponentClasspathContainer.java:364)
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer.requiresUpdate(J2EEComponentClasspathContainer.java:131)
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer.refresh(J2EEComponentClasspathContainer.java:427)
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater$ModuleUpdateJob.processModules(J2EEComponentClasspathUpdater.java:302)
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater$ModuleUpdateJob.access$4(J2EEComponentClasspathUpdater.java:286)
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater$ModuleUpdateJob$1.run(J2EEComponentClasspathUpdater.java:327)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater$ModuleUpdateJob.run(J2EEComponentClasspathUpdater.java:312)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Jason Sholl CLA 2010-06-23 12:39:11 EDT
Created attachment 172531 [details]
patch for 3.2.1

The specific problem, is that during any event that triggers a project add (this can be triggered by things other than actually a project coming into the workspace, e.g. a change to the .project file).  When an ADD event comes through, the entire graph needs to be updated; this implies that everything needs to be removed and then added again; the bug is the remove was not happening.  How this escaped notice for so long, I can't understand, but the fix is simple, and I also updated the event that is passed around so it properly resolves a remove and add of the same dependency as no change.
Comment 2 Chuck Bridgham CLA 2010-06-23 12:43:15 EDT
approved
Comment 3 Jason Sholl CLA 2010-06-23 13:40:55 EDT
code checked into head for wtp 3.2.1