bodewig 00/08/03 02:13:18
Modified: src/main/org/apache/tools/ant/taskdefs Zip.java
Log:
Delete the corrupt ZIP-file if <zip> or <jar> tasks fail.
Submitted by: Jesse Glick <[EMAIL PROTECTED]>
Revision Changes Path
1.10 +12 -0
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
Index: Zip.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Zip.java 2000/07/10 07:29:26 1.9
+++ Zip.java 2000/08/03 09:13:18 1.10
@@ -145,6 +145,18 @@
}
} catch (IOException ioe) {
String msg = "Problem creating " + archiveType + " " +
ioe.getMessage();
+
+ // delete a bogus ZIP file
+ if (zOut != null) {
+ try {
+ zOut.close();
+ zOut = null;
+ } catch (IOException e) {}
+ if (!zipFile.delete()) {
+ msg = zipFile + " is probably corrupt but I could not
delete it";
+ }
+ }
+
throw new BuildException(msg, ioe, location);
} finally {
if (zOut != null) {