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

Bug 261914

Summary: JEEDeployableFactory causing NPE because of invalid cache
Product: [WebTools] Web Tools Reporter: Jason Sholl <jsholl>
Component: J2EE Standard ToolsAssignee: Jason Sholl <jsholl>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: major    
Priority: P3 CC: arvera, ccc
Version: 3.0.3Flags: cbridgha: review+
Target Milestone: 3.0.4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on:    
Bug Blocks: 342469    
Attachments:
Description Flags
patch for 3.0.4
none
patch for 3.0.4 none

Description Jason Sholl CLA 2009-01-21 16:16:00 EST
An adopter product is running into NPEs in org.eclipse.wst.server.core.internal.Module.getDelegate(Unknown Source) which are actually caused by the cache in JEEDeployableFactory being inappropriately cleared by the server.core Module API.

java.lang.NullPointerException
        at org.eclipse.wst.server.core.internal.Module.getDelegate(Unknown Source)
        at org.eclipse.wst.server.core.internal.Module.loadAdapter(Unknown Source)

Currently, a fix for the server.core Module API is not available (tracking with another bug by the server team), but there is a simple fix is possible with changes only to the JEEDeployableFactory.  First is to only clear the appropriate portion of the cache by moving off the clearCache() method and onto the clearCache(IProject) method.  Second is to update the getModule() method to now lazily load the module if it is not found in the cache.  

While this problem has only been reproduced in cases with the JEEDeployableFactory, the J2EEDeployableFactory should also be fixed because a problem may arise there as well.
Comment 1 Jason Sholl CLA 2009-01-21 17:19:13 EST
Created attachment 123302 [details]
patch for 3.0.4
Comment 2 Jason Sholl CLA 2009-01-21 17:22:11 EST
Created attachment 123303 [details]
patch for 3.0.4
Comment 3 Chuck Bridgham CLA 2009-01-21 17:30:35 EST
approved
Comment 4 Carl Anderson CLA 2009-01-21 23:12:24 EST
Committed to R3_0_maintenance for 3.0.4