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

Bug 360142

Summary: NPE thrown when a Static Web Project is renamed
Product: [WebTools] WTP Java EE Tools Reporter: Salvador Zalapa <zalapa>
Component: jst.j2eeAssignee: Salvador Zalapa <zalapa>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: ccc, raghunathan.srinivasan, shr31223
Version: unspecifiedFlags: zalapa: pmc_approved? (david_williams)
raghunathan.srinivasan: pmc_approved+
zalapa: pmc_approved? (naci.dai)
zalapa: pmc_approved? (deboer)
zalapa: pmc_approved? (neil.hauge)
zalapa: pmc_approved? (kaloyan)
zalapa: pmc_approved? (cbridgha)
cbridgha: review+
Target Milestone: 3.2.5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch ccc: iplog+

Description Salvador Zalapa CLA 2011-10-06 13:40:59 EDT
Build Identifier: 

java.lang.NullPointerException: No IModelProvider exists for project P/staticC of version: Static Web Module
at org.eclipse.jst.j2ee.model.ModelProviderManager.getModelProvider(ModelProviderManager.java:101)
at org.eclipse.jst.j2ee.model.ModelProviderManager.getModelProvider(ModelProviderManager.java:281)
at org.eclipse.jst.j2ee.refactor.operations.ProjectRenameOperation.updateProject(ProjectRenameOperation.java:114)
at org.eclipse.jst.j2ee.refactor.operations.ProjectRefactorOperation.execute(ProjectRefactorOperation.java:56)
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)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.executeImpl(DataModelPausibleOperationImpl.java:219)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.cacheThreadAndContinue(DataModelPausibleOperationImpl.java:89)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.execute(DataModelPausibleOperationImpl.java:207)
at org.eclipse.jst.j2ee.refactor.listeners.ProjectRefactoringListener$1.runInWorkspace(ProjectRefactoringListener.java:226)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Reproducible: Always

Steps to Reproduce:
Steps to reproduce:
1) Create a static web project called ProjectA
2) Right click ProjectA and select rename.  Change the name to FooA
Comment 1 Salvador Zalapa CLA 2011-10-06 13:44:30 EDT
Created attachment 204700 [details]
Patch
Comment 2 Salvador Zalapa CLA 2011-10-06 13:46:31 EDT
The thing is that ProjectRenameOperation.updateProject()is considering that the Static Web project has a Model Provider when it does not. The patch add an extra validation.
Comment 3 Chuck Bridgham CLA 2011-10-06 13:50:37 EDT
Can you make this a little more robust?

How did the ProjectRenameOperation get registered for this project type in the first place? - I hate to keep adding project types to the exclusion list.. maybe this can be done better?
Comment 4 Chuck Bridgham CLA 2011-10-12 12:02:56 EDT
approved, and after conversation - agreed making a more robust change in current release - bugzilla to be opened
Comment 5 Salvador Zalapa CLA 2011-10-12 12:58:16 EDT
https://bugs.eclipse.org/bugs/show_bug.cgi?id=360698 has been created to handle a more robust solution.
Comment 6 Salvador Zalapa CLA 2011-10-12 15:10:22 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 NPE is thrown when a Static Web Project is renamed

    *Is there a work-around? If so, why do you believe the work-around is insufficient? 
     - There is not a workaround, the exception is logged always.

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

    *Give a brief technical overview. Who has reviewed this fix? 
     - ProjectRenameOperation.updateProject() considers that the
Static Web project has a Model Provider when it does not. The patch adds an
extra validation.

    *What is the risk associated with this fix? 
     -None
Comment 7 Carl Anderson CLA 2011-10-13 12:22:02 EDT
This was committed to R3_2_maintenance for WTP 3.2.5 on 10/12.  Leaving it open to get this fix into next week's WTP 3.3.2 driver.
Comment 8 Carl Anderson CLA 2011-10-20 00:54:22 EDT
Committed to R3_3_maintenance for WTP 3.3.2