Community
Participate
Working Groups
Build ID: Eclipse 3.7 (Indigo) When the new "Refresh on Access" Preference from bug 14867 is on, data loss can occur in the following scenario: 1. Create a General Project 2. Create file "sample.txt", save but keep editor open. 3. Outside Eclipse, delete or rename sample.txt 4. Switch back to Eclipse --> See following dialog: "The file proj/sample.txt has been deleted or is not accessible. Do you want to save your changes or close the editor without saving?" 5. Press "Save" --> Nothing happens, except NPE printed to errorlog (see below). That is, the file which I've just been editing, is lost and gone. The problem seems to be that due to the "Refresh on Access", the EditorInput is deleted before Eclipse has a chance to save the file. The issue does not occur when the editor is dirty, or when the "Refresh on Access" preference is off. This issue is particularly concerning in a ClearCase dynamic view, when I'm editing a file while a different user performs renames or deletes that file. Recovering my data may be possible (since the editor was not dirty), but the behavior is unexpected and recovery likely nontrivial. The NPE: Caused by: java.lang.NullPointerException at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.performSaveAs(AbstractDecoratedTextEditor.java:1552) at org.eclipse.ui.texteditor.AbstractTextEditor.handleEditorInputChanged(AbstractTextEditor.java:4737) at org.eclipse.ui.texteditor.StatusTextEditor.handleEditorInputChanged(StatusTextEditor.java:267) at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.handleEditorInputChanged(AbstractDecoratedTextEditor.java:1474) at org.eclipse.ui.texteditor.AbstractTextEditor.sanityCheckState(AbstractTextEditor.java:4887) at org.eclipse.ui.texteditor.StatusTextEditor.sanityCheckState(StatusTextEditor.java:257) at org.eclipse.ui.texteditor.AbstractTextEditor.safelySanityCheckState(AbstractTextEditor.java:4865) at org.eclipse.ui.texteditor.AbstractTextEditor$ActivationListener.handleActivation(AbstractTextEditor.java:984) at org.eclipse.ui.texteditor.AbstractTextEditor$ActivationListener.access$0(AbstractTextEditor.java:977) at org.eclipse.ui.texteditor.AbstractTextEditor$10.run(AbstractTextEditor.java:1005)
>3. Outside Eclipse, delete or rename sample.txt Mmh, I'd rather say it's data loss if the file is still there after you explicitly deleted it ;-).
Fixed in master: http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=e414aee94b0ec1e061c130b1408256ba52c875df