Bug 39766

Summary: compilation unit cannot be saved
Product: [Eclipse Project] JDT Reporter: Kai-Uwe Maetzel <kai-uwe_maetzel>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: 3.0   
Target Milestone: 3.0 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Kai-Uwe Maetzel CLA 2003-07-08 14:36:52 EDT
HEAD 20030708

ICompilationUnit unit= new ...;
unit.becomeWorkingCopy();
<modify working copy>
unit.commitWorkingCopy();

-> no exception and underlying resource still unchanged.

Offending code in CompilationUnit:

public void save(IProgressMonitor pm, boolean force) throws JavaModelException 
{
	if (!isWorkingCopy()) {
		super.save(pm, force);
		return;
	}
        ...
}

isWorkingCopy() always returns true in this scenario.
Comment 1 Philipe Mulet CLA 2003-07-08 15:55:25 EDT
Need immediate attention.
Comment 2 Jerome Lanneluc CLA 2003-07-09 06:28:08 EDT
Fixed CompilationUnit.save(...) to allow saving of a primary working copy.
Added regression test WorkingCopyOwnerTests.testCommitPrimaryWorkingCopy().
Posted patch on JDT/Core web page.
Comment 3 David Audel CLA 2003-07-17 06:19:20 EDT
Verified.