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 162526 - FileObject.revert
Summary: FileObject.revert
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jesse Glick
Depends on:
Blocks: 90220 196450
  Show dependency tree
Reported: 2009-04-13 16:48 UTC by Jesse Glick
Modified: 2011-12-01 12:10 UTC (History)
1 user (show)

See Also:
Exception Reporter:

Proposed patch (API plus usages) (28.01 KB, patch)
2011-11-22 22:22 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2009-04-13 16:48:55 UTC
In cases where there is a corrupt configuration file, it is often desirable to revert local modifications to it after
logging the error. You can do this by asking for a magic file attribute, but this is essentially impossible to discover
and pretty ugly. Better to hide that (for the client) behind a convenience method.

See issue #90220 for an example use case. (Would be good to grep sources for "removeWritables".)
Comment 1 Jesse Glick 2009-09-21 21:49:54 UTC
Now used also in

BTW if a file is removed from $userdir/config and the containing folder is now empty, the folder should be removed too,
recursively (up to $userdir/config itself).
Comment 2 Jaroslav Tulach 2010-04-06 05:05:58 UTC
We have "removeWritables" as you pointed out. If you want nicer API, consider passing API review.
Comment 3 Jesse Glick 2010-10-13 15:56:08 UTC
Probably need also canRevertConfigFile to check ahead of time for modifications. Would like to use to simplify c50b3b53f3db, though unfortunately it seems that removeWritables is currently not listed on folders, only files??
Comment 4 Jesse Glick 2010-11-24 16:13:24 UTC
Feel free to assign back to me.
Comment 5 Jaroslav Tulach 2010-11-24 16:33:56 UTC
No patch, no change.
Comment 6 Jesse Glick 2010-11-24 17:01:22 UTC
That's why it was assigned to me.
Comment 7 Jesse Glick 2011-11-22 22:22:33 UTC
Created attachment 113430 [details]
Proposed patch (API plus usages)
Comment 8 Jesse Glick 2011-11-22 22:24:33 UTC
Please review.
Comment 9 Jesse Glick 2011-11-29 11:26:59 UTC
Added an extra test contradicting comment #3, and tweaked the Templates dialog rename logic a bit to properly handle layer folders with user-added entries. core-main #17c7e53a5354
Comment 10 Quality Engineering 2011-12-01 12:10:22 UTC
Integrated into 'main-golden'
User: Jesse Glick <>
Log: #162526: FileObject.revert.