diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java index 92e83ec22..a573e1a3b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -331,6 +331,14 @@ public class Zip extends MatchingTask { addFiles(tmp, zOut); } finalizeZipOutputStream(zOut); + + // If we've been successful on an update, delete the temporary file + if (doUpdate) { + if (!renamedFile.delete()) { + log ("Warning: unable to delete temporary file " + + renamedFile.getName(), Project.MSG_WARN); + } + } success = true; } finally { // Close the output stream. @@ -369,14 +377,6 @@ public class Zip extends MatchingTask { } finally { cleanUp(); } - - // If we've been successful on an update, delete the temporary file - if (success && doUpdate) { - if (!renamedFile.delete()) { - log ("Warning: unable to delete temporary file " + - renamedFile.getName(), Project.MSG_WARN); - } - } } /**