This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 82668 - Open editors w/ changes don't handle having the underlying file removed very well.
Summary: Open editors w/ changes don't handle having the underlying file removed very ...
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Data Systems (show other bugs)
Version: 5.x
Hardware: All All
: P4 blocker (vote)
Assignee: Jiri Skrivanek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-14 23:47 UTC by _ pcw
Modified: 2009-12-21 05:26 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
stack trace when attempting to save changed editor after deleting underlying file. (3.93 KB, text/plain)
2006-08-14 23:50 UTC, _ pcw
Details
Informational trace after cancelling disposal of editor if underlying file is deleted and there are unsaved changes. (3.87 KB, text/plain)
2006-08-14 23:51 UTC, _ pcw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ pcw 2006-08-14 23:47:43 UTC
Create a java project, add a java class.
Open the java file in the editor and make some change -- do not save --.
Open a command line shell, go to the directory where this file is and delete the
file.

Now switch back to the IDE and focus the editor.

You'll automatically get a message box that says "File [filename] was change to
read only.  All changes will be discarded.  [OK] [Cancel]".

Bug #1: This message is wrong.  The file is not readonly.  It's been deleted.

If you hit OK, the editor will be closed.  Seems to be ok.

Bug #2: If you hit Cancel, the editor will stay, which is good, but it will be
useless, which is bad.  You won't be able to save your changes.  Other user
actions produce varying message in popups and exceptions on the console (see
attached).  For example, the title of the window is deleted after the first save
attempt.
Comment 1 _ pcw 2006-08-14 23:50:17 UTC
Created attachment 32913 [details]
stack trace when attempting to save changed editor after deleting underlying file.
Comment 2 _ pcw 2006-08-14 23:51:46 UTC
Created attachment 32914 [details]
Informational trace after cancelling disposal of editor if underlying file is deleted and there are unsaved changes.
Comment 3 Jaroslav Tulach 2006-08-15 09:10:51 UTC
Ok. If you want to suggest your preferred fix, then go on and tell me...
Comment 4 _ pcw 2006-08-15 09:28:27 UTC
I'll think about it.

The manual deletion argument is a bit arcane, but I suspected this might also
happen if a file was removed while open due to a VCS update.  I have not tested
this - no dummy VCS to bounce against.
Comment 5 _ pcw 2006-08-15 23:03:43 UTC
1) incorrect message - the message is incorrect because the low level
java.io.File api used to check for readonly also returns the same result if the
file is non existent.  File existence could be checked for separately at a
reasonable place in NetBeans to differentiate these two cases.

If the file really is readonly, no changes is no problem just make editor
readonly.  If there are changes maybe offer "Save As" option?  Better handled on
a save attempt from the user rather than on IDE focus gained.

2) Closing the editor if no changes, or dying in place if there are changes is
bad.  What about, for either case (file modified or not), when the top component
regains focus, inform the user that the underlying file has been removed and
offer them a choice of closing the editor or continuing (in which case editor is
marked modified so that it'll be saved even in the "no changes" case).
Comment 6 _ pcw 2006-08-15 23:06:13 UTC
Heh, just reread my original report, looks like we already sort of try to do #2
and maybe what you are asking me is how to keep an editor w/ no underlying
dataobject open?  How do we do it today w/ new files?  Can we have unsaved but
named open files?
Comment 7 Jaroslav Tulach 2007-09-10 12:50:49 UTC
We have "Save as..." now. So the only outstanding issue is the wrong message, if I am not mistaken.

Plus log messages like, which are not nice either, but otherwise harmless:
java.lang.IllegalStateException: The data object MasterFileObject@e5a644
[space/tmp/WebApplication3/src/java/test/Test.java] is invalid; you may not call getNodeDelegate on it any more; see 
#17020 and please fix your code
[catch] at org.openide.loaders.DataObject.getNodeDelegate(DataObject.java:247)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Comment 8 Lukas Hasik 2008-04-10 21:15:46 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 9 Antonin Nebuzelsky 2008-11-13 13:35:21 UTC
Reassigning all openide/data systems issues to the new owner jskrivanek.
Comment 10 Quality Engineering 2009-12-21 05:26:41 UTC
This bug was reported against NetBeans IDE 6.0 or an older release, or against a non-maintained module. NetBeans team does not have enough resources to get to this issue, therefore we are closing the issue as a WONTFIX. If you are interested in providing a patch for this bug, please see our NetFIX guidelines for how to proceed. 

We apologize for any inconvenience.


Thank you.
The NetBeans Team