Browse Source

Diane has volunteered me, errm, I mean, remove dest if <get> fails.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272590 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
44f87d3ac9
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      src/main/org/apache/tools/ant/taskdefs/Get.java

+ 8
- 0
src/main/org/apache/tools/ant/taskdefs/Get.java View File

@@ -208,6 +208,7 @@ public class Get extends Task {
}

FileOutputStream fos = new FileOutputStream(dest);
boolean finished = false;
try {
byte[] buffer = new byte[100 * 1024];
int length;
@@ -221,11 +222,18 @@ public class Get extends Task {
if (verbose) {
System.out.println();
}
finished = true;
} finally {
if (fos != null) {
fos.close();
}
is.close();
// we have started to (over)write dest, but failed.
// Try to delete the garbage we'd otherwise leave
// behind.
if (!finished) {
dest.delete();
}
}

//if (and only if) the use file time option is set, then


Loading…
Cancel
Save