Bug 339866 - Renaming a Java file causes "Resource is out of sync with the file system"
Summary: Renaming a Java file causes "Resource is out of sync with the file system"
Status: VERIFIED NOT_ECLIPSE
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-14 07:04 EDT by Kostya Vasilyev CLA
Modified: 2014-05-14 09:48 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kostya Vasilyev CLA 2011-03-14 07:04:14 EDT
Build Identifier: M20110210-1200

Renaming a Java file causes "Resource is out of sync with the file system".

I rename a file with F2 in the Package Explorer view. The file does get renamed, and references to the new class (it seems) get updated. The class name inside the file is not changed, I get the error instead.



Reproducible: Always

Steps to Reproduce:
1. Select a Java file in the Package Explorer
2. Press F2 to rename
3. The file is renamed, but before the class name inside the file is updated, renaming aborts with "Resource is out of sync with the file system".

Oh, and just to be sure, I tried pressing F5 and/or selecting Refresh in the Package Explorer just before renaming.
Comment 1 Kostya Vasilyev CLA 2011-03-14 07:05:24 EDT
Stack trace:


org.eclipse.core.internal.resources.ResourceException: Resource is out of sync with the file system: '/AndroMail/src/org/kman/AndroMail/mail/MessageHeaderCollector.java'.
at org.eclipse.core.internal.localstore.FileSystemResourceManager.write(FileSystemResourceManager.java:976)
at org.eclipse.core.internal.resources.File.internalSetContents(File.java:325)
at org.eclipse.core.internal.resources.File.setContents(File.java:364)
at org.eclipse.jdt.internal.core.Buffer.save(Buffer.java:383)
at org.eclipse.jdt.internal.core.Openable.save(Openable.java:481)
at org.eclipse.jdt.internal.core.CompilationUnit.save(CompilationUnit.java:1290)
at org.eclipse.jdt.internal.core.CopyResourceElementsOperation.saveContent(CopyResourceElementsOperation.java:602)
at org.eclipse.jdt.internal.core.CopyResourceElementsOperation.processCompilationUnitResource(CopyResourceElementsOperation.java:350)
at org.eclipse.jdt.internal.core.CopyResourceElementsOperation.processElement(CopyResourceElementsOperation.java:399)
at org.eclipse.jdt.internal.core.MultiOperation.processElements(MultiOperation.java:163)
at org.eclipse.jdt.internal.core.CopyResourceElementsOperation.processElements(CopyResourceElementsOperation.java:417)
at org.eclipse.jdt.internal.core.MultiOperation.executeOperation(MultiOperation.java:90)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:793)
at org.eclipse.jdt.internal.core.JavaModel.rename(JavaModel.java:285)
at org.eclipse.jdt.internal.core.CompilationUnit.rename(CompilationUnit.java:1264)
at org.eclipse.jdt.internal.corext.refactoring.changes.RenameCompilationUnitChange.doRename(RenameCompilationUnitChange.java:59)
at org.eclipse.jdt.internal.corext.refactoring.AbstractJavaElementRenameChange.perform(AbstractJavaElementRenameChange.java:86)
at org.eclipse.ltk.core.refactoring.CompositeChange.perform(CompositeChange.java:278)
at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChange.access$0(DynamicValidationStateChange.java:1)
at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChange$1.run(DynamicValidationStateChange.java:98)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChange.perform(DynamicValidationStateChange.java:101)
at org.eclipse.ltk.core.refactoring.CompositeChange.perform(CompositeChange.java:278)
at org.eclipse.ltk.core.refactoring.PerformChangeOperation$1.run(PerformChangeOperation.java:258)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.ltk.core.refactoring.PerformChangeOperation.executeChange(PerformChangeOperation.java:306)
at org.eclipse.ltk.internal.ui.refactoring.UIPerformChangeOperation.executeChange(UIPerformChangeOperation.java:92)
at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:218)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

Session data:

eclipse.buildId=M20110210-1200
java.version=1.6.0_24
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=ru_RU
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.java.product
Comment 2 Ayushman Jain CLA 2011-03-15 01:53:18 EDT
I could not reproduce this using a standalone testcase, with or without references to the class in question (build I20110301-1537).
Can you please attach a reproducible testcase? thanks!
Comment 3 Kostya Vasilyev CLA 2011-03-15 05:50:08 EDT
(In reply to comment #2)
> I could not reproduce this using a standalone testcase, with or without
> references to the class in question (build I20110301-1537).
> Can you please attach a reproducible testcase? thanks!


Caused by Mercurial TortoiseHG 2.02 in combination with MercurialEclipse 1.7.1.

Sorry about this, will refer the bug to MercurialEclipse.
Comment 4 Ayushman Jain CLA 2011-03-15 06:23:13 EDT
Then closing as WORKSFORME
Comment 5 Olivier Thomann CLA 2011-03-15 08:53:46 EDT
Reopen to close as NOT_ECLIPSE.
Comment 6 Olivier Thomann CLA 2011-03-15 08:54:05 EDT
Closed.
Comment 7 Srikanth Sankaran CLA 2011-04-25 02:12:13 EDT
Verified for 3.7M7
Comment 8 Jan W CLA 2014-05-14 09:48:57 EDT
Is there a workaround known for this bug? Is this issue identical or not related to this bug? http://stackoverflow.com/q/23655990/1184842