Browse Source

Try to clean up after a failed copy.

PR: 16768


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274008 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
7d868d2e29
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/main/org/apache/tools/ant/taskdefs/Copy.java

+ 5
- 1
src/main/org/apache/tools/ant/taskdefs/Copy.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -531,6 +531,10 @@ public class Copy extends Task {
} catch (IOException ioe) { } catch (IOException ioe) {
String msg = "Failed to copy " + fromFile + " to " + toFile String msg = "Failed to copy " + fromFile + " to " + toFile
+ " due to " + ioe.getMessage(); + " due to " + ioe.getMessage();
File targetFile = new File(toFile);
if (targetFile.exists() && !targetFile.delete()) {
msg += " and I couldn't delete the corrupt " + toFile;
}
throw new BuildException(msg, ioe, getLocation()); throw new BuildException(msg, ioe, getLocation());
} }
} }


Loading…
Cancel
Save