| Summary: | [resources] Need to know if a move/delete failed in Move/Delete hook | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Michael Valenta <Michael.Valenta> |
| Component: | Resources | Assignee: | Platform-Resources-Inbox <platform-resources-inbox> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P4 | ||
| Version: | 3.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 28300 | ||
|
Description
Michael Valenta
Another scenario where this would be helpful is in bug 28300. We currently need to use a pre_auto_build lisenter to ensure that instances of RepositoryProvider are consistent after a project move. It would be more efficient to do this in the Move/Delete hook but we can't because we don't know if the operation succeeded. I also find the "silent" failure of move to be undesirable in general.
One scenario that I found: if for whatever reason, something is holding onto a
file (say, a running process that never closed the file handle),
java.io.File.rename will fail.
The problem here is, in FileSystemStore.move(), if rename fails, it tries to do
a copy and then a delete, but it never checks to see if the delete succeeded.
As a result, the move will fail silently.
The following snippet is from FileSystemStore.move(). Note the return code from
Workspace.clear() is never checked.
if (success)
Workspace.clear(source);
else {
if (!canceled) {
// We do not want to delete the destination in case of failure. It might
// the case where we already had contents in the destination, so we would
// be deleting resources we don't know about and the user might lose data.
String message = Policy.bind("localstore.couldnotMove",
source.getAbsolutePath()); //$NON-NLS-1$
throw new ResourceException(new
ResourceStatus(IResourceStatus.FAILED_WRITE_LOCAL, new
Path(source.getAbsolutePath()), message, null));
}
}
Time to move this one out of the inbox... Not planning to address this. |