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

Bug 293586

Summary: org.eclipse.wst.common.component file incorrectly marked as need to be written
Product: [WebTools] WTP Java EE Tools Reporter: Edwin Chan <edwinc>
Component: jst.j2eeAssignee: Jason Peterson <jasonpet>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: major    
Priority: P3 CC: ccc, david_williams, hungtran, joefh, jsholl, thatnitind
Version: unspecifiedFlags: cbridgha: review+
Target Milestone: 3.0.5 P   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Project Interchange File
none
patch none

Description Edwin Chan CLA 2009-10-28 11:51:54 EDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Build Identifier: IES 342 20091019_0953

In our adopting product, when a module is extracted from a source control system (i.e. ClearCase),  the .settings/org.eclipse.wst.common.component file in the module is flagged as needing to be written, though it's not marked as dirty.  Note that the .component file's content is never changed.

As a result, when extracting the module from ClearCase, the ClearCase dialog prompts this file ".settings/org.eclipse.wst.common.component" needs to be checked out.  It shouldn't prompt user to check out this file.

 is called for the .component file in question

This happens in this piece of code:
    Workspace.validateEdit(IFile[], Object) line: 1997    
    ResourceStateValidatorImpl.validateState(ResourceStateValidatorPresenter) line: 330    
    ModuleStructuralModel(EditModel).validateState(ResourceStateValidatorPresenter) line: 643    
    ValidateEditUIContext.validateState() line: 47    
    ValidateEditUIContext(ValidateEditHeadlessContext).validateState(EditModel) line: 95    
    StructureEdit.validateEdit() line: 970    
    StructureEdit.saveIfNecessary(IProgressMonitor) line: 382    
    AddComponentToEnterpriseApplicationOp.updateEARDD(IProgressMonitor) line: 149    
    AddComponentToEnterpriseApplicationOp.execute(IProgressMonitor, IAdaptable) line: 74    
    DataModelPausibleOperationImpl$1.run(IProgressMonitor) line: 376    
    Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 1800

The structureEdit is for the module mentioned. AddComponentToEnterpriseApplicationOp calls save on each structureEdit of each of its components.

Reproducible: Always

Steps to Reproduce:
1. Import HelloWorld 1 sample
2. Check all modules into ClearCase using Dynamic view
3. Start another workspace and import all modules from Clearcase view to workspace
4. Find a check-out popup for the following file:
org.eclipse.wst.common.component    

Contact Joef Huang (joefh@ca.ibm.com) for ClearCase access
Comment 1 Edwin Chan CLA 2009-10-28 11:53:17 EDT
Created attachment 150742 [details]
Project Interchange File
Comment 2 Jason Peterson CLA 2009-11-06 15:10:44 EST
The problem here is that validateEdit is called for all components (the added modules and the EAR) regardless of whether the structure edit model has changed for the component.  This is why component files that are not updated are still prompting for checkout.  In most cases the only component file that would have changed in this scenario is the EAR's component file. 

The fix is to check whether the structure edit is dirty before calling validateEdit.
Comment 3 Jason Peterson CLA 2009-11-06 15:11:47 EST
Created attachment 151600 [details]
patch
Comment 4 Jason Peterson CLA 2009-11-06 15:16:05 EST
I did some regression testing on the patched code by running the JUnit test bucket.
Comment 5 David Williams CLA 2009-11-08 20:49:10 EST
applied and fixed in patch builds >= P20091108210127

(But, please review, still, and apply to future streams as needed)
Comment 6 Chuck Bridgham CLA 2009-11-09 09:43:02 EST
Patch looks good
Comment 7 Jason Sholl CLA 2009-11-10 16:50:09 EST
checked into 31M and 32