You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2003/02/06 17:19:25 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Copy.java
bodewig 2003/02/06 08:19:24
Modified: src/main/org/apache/tools/ant/taskdefs Copy.java
Log:
Try to clean up after a failed copy.
PR: 16768
Revision Changes Path
1.50 +6 -2 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copy.java
Index: Copy.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copy.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- Copy.java 4 Dec 2002 16:42:30 -0000 1.49
+++ Copy.java 6 Feb 2003 16:19:22 -0000 1.50
@@ -1,7 +1,7 @@
/*
* 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.
*
* Redistribution and use in source and binary forms, with or without
@@ -531,6 +531,10 @@
} catch (IOException ioe) {
String msg = "Failed to copy " + fromFile + " to " + toFile
+ " 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());
}
}