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

Bug 342469

Summary: NPE during build (J2EEDeployableFactory.clearCache())
Product: [WebTools] WTP Java EE Tools Reporter: Patric Rufflar <patric>
Component: jst.j2eeAssignee: Roberto Sanchez Herrera <shr31223>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: ccc, thatnitind
Version: 3.2.3Flags: cbridgha: review+
Target Milestone: 3.2.4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 261914    
Bug Blocks:    
Attachments:
Description Flags
Check for null ccc: iplog+

Description Patric Rufflar CLA 2011-04-11 12:49:30 EDT
Build Identifier: 3.2.3

java.lang.NullPointerException
at org.eclipse.jst.j2ee.internal.deployables.J2EEDeployableFactory.clearCache(J2EEDeployableFactory.java:238)
at org.eclipse.wst.server.core.util.ProjectModuleFactoryDelegate.handleGlobalProjectChange(ProjectModuleFactoryDelegate.java:146)
at org.eclipse.wst.server.core.internal.ResourceManager.publishHandleProjectChange(ResourceManager.java:974)
at org.eclipse.wst.server.core.internal.ResourceManager$ServerResourceChangeListener$1.visit(ResourceManager.java:123)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:68)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:48)
at org.eclipse.wst.server.core.internal.ResourceManager$ServerResourceChangeListener.resourceChanged(ResourceManager.java:117)
at org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:291)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285)
at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149)
at org.eclipse.core.internal.resources.Workspace.broadcastBuildEvent(Workspace.java:311)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:147)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:242)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Reproducible: Didn't try
Comment 1 Carl Anderson CLA 2011-04-11 21:57:46 EDT
The code to clear the cache was added as part of bug 261914
Comment 2 Carl Anderson CLA 2011-04-11 22:00:13 EDT
Line 238 is:

if (module.getProject().equals(project)) {

My assumption would be that module.getProject() returns null.
This code should check for null, since the IModule interface specifically states that null will be returned if the project is outside of the workspace.
Comment 3 Roberto Sanchez Herrera CLA 2011-04-12 10:24:28 EDT
Created attachment 193049 [details]
Check for null
Comment 4 Chuck Bridgham CLA 2011-04-14 09:51:56 EDT
approve
Comment 5 Carl Anderson CLA 2011-04-14 10:12:40 EDT
Committed to R3_2_maintenance and HEAD for WTP 3.2.4 and WTP 3.3 M7