Bug 39766 - compilation unit cannot be saved
Summary: compilation unit cannot be saved
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.0 M2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-08 14:36 EDT by Kai-Uwe Maetzel CLA
Modified: 2003-07-17 06:19 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.