Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 92990 invoked by uid 500); 3 Aug 2000 09:13:19 -0000 Delivered-To: apmail-jakarta-ant-cvs@apache.org Received: (qmail 92985 invoked by uid 1146); 3 Aug 2000 09:13:18 -0000 Date: 3 Aug 2000 09:13:18 -0000 Message-ID: <20000803091318.92984.qmail@locus.apache.org> From: bodewig@locus.apache.org To: jakarta-ant-cvs@apache.org Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Zip.java bodewig 00/08/03 02:13:18 Modified: src/main/org/apache/tools/ant/taskdefs Zip.java Log: Delete the corrupt ZIP-file if or tasks fail. Submitted by: Jesse Glick 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) {