Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312704 - NPE during Servlet creation operation
Summary: NPE during Servlet creation operation
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.2 RC1   Edit
Assignee: Chuck Bridgham CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-12 16:00 EDT by Chuck Bridgham CLA
Modified: 2010-05-13 23:13 EDT (History)
3 users (show)

See Also:
david_williams: pmc_approved+
jsholl: pmc_approved? (raghunathan.srinivasan)
jsholl: pmc_approved? (naci.dai)
jsholl: pmc_approved? (deboer)
jsholl: pmc_approved? (neil.hauge)
jsholl: pmc_approved? (kaloyan)
ccc: review+


Attachments
patch (840 bytes, patch)
2010-05-12 16:54 EDT, Chuck Bridgham CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chuck Bridgham CLA 2010-05-12 16:00:50 EDT
This exception caused by a race condition can occur during Servlet creation



!ENTRY org.eclipse.wst.common.frameworks 4 0 2010-05-03 16:07:30.859
!MESSAGE Extended Operation failure: org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit.modify(WebArtifactEdit.java:693)
	at com.ibm.etools.javaee.model.internal.Web25ModelProvider.modify(Web25ModelProvider.java:293)
	at org.eclipse.jst.j2ee.internal.common.operations.AddJavaEEArtifactOperation.execute(AddJavaEEArtifactOperation.java:53)
	at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl$1.run(DataModelPausibleOperationImpl.java:385)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
	at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:410)
	at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:360)
	at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.doExecute(DataModelPausibleOperationImpl.java:247)

Although related fixes have made this condition unlikely, a null check is needed
Comment 1 Chuck Bridgham CLA 2010-05-12 16:54:16 EDT
Created attachment 168265 [details]
patch
Comment 2 Carl Anderson CLA 2010-05-12 16:57:31 EDT
I approve of this change.
Comment 3 Jason Sholl CLA 2010-05-12 18:46:01 EDT
    * Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 

A rare race condition can lead to NPEs and blow up the stack.

    * Is there a work-around? If so, why do you believe the work-around is insufficient? 

No

    * How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 

Testing with UI


    * Give a brief technical overview. Who has reviewed this fix? 

The race condition can be avoided with a simple null check.  Carl and Jason have reviewed this fix.

    * What is the risk associated with this fix? 

None.
Comment 4 David Williams CLA 2010-05-12 22:40:17 EDT
I'm not sure its correct to say "The race condition can be avoided ..." by a null check, but I agree, null checks should always be done in finally blocks before dispose.
Comment 5 Carl Anderson CLA 2010-05-13 00:06:42 EDT
Committed to HEAD for WTP 3.2 RC1