Browse Source

don't try to re-rename a target that failed to be renamed in the first place. Related to PR 41525.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@692082 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 17 years ago
parent
commit
5392ebd0db
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java

+ 4
- 0
src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java View File

@@ -432,9 +432,11 @@ public class Symlink extends DispatchTask {
FILE_UTILS.removeLeadingPath(canfil, linkfil));
}

boolean renamedTarget = false;
try {
try {
FILE_UTILS.rename(canfil, temp);
renamedTarget = true;
} catch (IOException e) {
throw new IOException(
"Couldn't rename resource when attempting to delete "
@@ -446,6 +448,7 @@ public class Symlink extends DispatchTask {
+ " (was it a real file? is this not a UNIX system?)");
}
} finally {
if (renamedTarget) {
// return the resource to its original name:
try {
FILE_UTILS.rename(temp, canfil);
@@ -455,6 +458,7 @@ public class Symlink extends DispatchTask {
+ "\n THE RESOURCE'S NAME ON DISK HAS "
+ "BEEN CHANGED BY THIS ERROR!\n");
}
}
}
}



Loading…
Cancel
Save