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 50992 - FileAlreadyLockedException when trying to save project properties but metadata files are modified
Summary: FileAlreadyLockedException when trying to save project properties but metadat...
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant Project (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Jesse Glick
URL:
Keywords:
: 55927 59365 64627 74989 83099 (view as bug list)
Depends on: 92011
Blocks: 41535 57480
  Show dependency tree
 
Reported: 2004-10-30 06:17 UTC by pzgyuanf
Modified: 2007-01-09 09:15 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
the exceptions (5.18 KB, text/plain)
2004-10-30 06:18 UTC, pzgyuanf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pzgyuanf 2004-10-30 06:17:47 UTC
- open project.properties file
- edit something or simply add one blank space
- open the project properties UI editor
- change something, .ie. checked the 'Report uses
of deprecated APIs' in compling sources option panel
- ok it
the exception throws:
see attachment.
Comment 1 pzgyuanf 2004-10-30 06:18:32 UTC
Created attachment 18618 [details]
the exceptions
Comment 2 Jesse Glick 2004-10-30 16:20:12 UTC
Don't do that then - the project properties dialog wants to modify
files such as project.properties, private.properties, and project.xml,
and it can't do that correctly if you are editing them at the same
time. You have to pick one or the other at a time. Of course the IDE
should behave more gracefully, but do not plan to change that for 4.0.
Comment 3 Jesse Glick 2005-04-08 23:23:26 UTC
*** Issue 55927 has been marked as a duplicate of this issue. ***
Comment 4 Jesse Glick 2005-05-28 16:38:37 UTC
*** Issue 59365 has been marked as a duplicate of this issue. ***
Comment 5 Jesse Glick 2005-10-08 15:47:13 UTC
Cf. also issue #66295.
Comment 6 pzajac 2005-11-08 09:25:23 UTC
It is quite disturbing. 
Why not to save opened document for project.properties before is opened for
writing by project customizer? 
Comment 7 Martin Krauskopf 2005-11-08 09:44:14 UTC
I wouldn't do that. Since e.g. for apisupport/project it also applies also to
project.xml, manifest.mf, private.properties, Bunde, Layer,
platform.properties... maybe more, which all could be in inconsistent state.
Maybe tell the user that she is currently editing those files and e.g. force the
save or whatever - would have to be probably solved on the side of particular
customizers.
Comment 8 Jesse Glick 2006-04-13 19:59:55 UTC
*** Issue 74989 has been marked as a duplicate of this issue. ***
Comment 9 Jesse Glick 2006-08-17 23:22:16 UTC
*** Issue 64627 has been marked as a duplicate of this issue. ***
Comment 10 Jesse Glick 2006-08-21 16:06:52 UTC
*** Issue 83099 has been marked as a duplicate of this issue. ***
Comment 11 Jesse Glick 2006-11-21 23:10:18 UTC
Will simply prevent the Properties dialog from being opened when there are
unsaved files. (The exact list of files which might be modified by a project
properties dialog depends on the project type and in some cases may be difficult
to compute in advance.) Will not prevent you from editing files while a
(nonmodal) properties dialog is open, but that is just asking for trouble anyway.

Checking in Bundle.properties;
/shared/data/ccvs/repository/projects/projectui/src/org/netbeans/modules/project/ui/actions/Bundle.properties,v
 <--  Bundle.properties
new revision: 1.33; previous revision: 1.32
done
Checking in CustomizeProject.java;
/shared/data/ccvs/repository/projects/projectui/src/org/netbeans/modules/project/ui/actions/CustomizeProject.java,v
 <--  CustomizeProject.java
new revision: 1.10; previous revision: 1.9
done
Comment 12 pzajac 2006-11-22 14:50:23 UTC
Good idea. Verified. 
Comment 13 jrojcek 2007-01-05 15:23:03 UTC
Reopening as the fix is not good from UI perspective. Asking the user to save all files before opening the 
properties dialog is wrong. I think the fix should be rollbacked.

Can we do the following: When the user clicks the OK button in the properties dialog, we prompt the user 
to save all files the properties dialog will modify?
Comment 14 Jesse Glick 2007-01-05 15:45:02 UTC
If you want a different UI, please open a separate issue with suggestions and
make it block this issue. The original problem was indeed fixed and needs to be
tracked as such.

While the fix could be rolled back, IMHO the data loss potential of the original
problem overrides any annoyance caused by the fix.

Re. prompting only when OK is clicked in the properties dialog - this would be
way more work and would require separate effort from each project type
development team. If that were feasible with a modest development effort I would
have done it that way to begin with. The problems are that (1) you would need to
track precisely which files are about to be written, which requires nontrivial
logic for each project type; (2) that would already be too late, as you would
need to actually merge the unsaved text edits with the pending customizer edits,
meaning every project properties dialog would need to be rewritten to load all
of its information from unsaved editor documents, which would also require new
APIs. Not worth it, I think.

A possibility I considered was requiring save of just those files likely to be
read and possibly written by the properties dialog - metadata, basically, rather
than regular sources. Possible but would still be more complex and may require
cooperation from each project type separately. Not clear whether
DataFilesProviderImplementation (?) can provide a generic solution.

Tor suggested changing the buttons in the existing dialog to be "Save All" and
"Cancel" to be friendlier.