From 03d7f7d69589468d122bd5f3ef0a5306bf675cfc Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 4 Jan 2001 12:37:20 +0000 Subject: [PATCH] Reset the global flags that say we have a MANIFEST.MF/web.xml after execute has been run. would print a warning in Ant's own bootstrap when it zipped ant.jar for the second time. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268398 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/Jar.java | 9 +++++++++ src/main/org/apache/tools/ant/taskdefs/War.java | 11 ++++++++++- src/main/org/apache/tools/ant/taskdefs/Zip.java | 10 ++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Jar.java b/src/main/org/apache/tools/ant/taskdefs/Jar.java index bdb6e1dc1..60273fa0a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Jar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Jar.java @@ -129,4 +129,13 @@ public class Jar extends Zip { super.zipFile(file, zOut, vPath); } } + + /** + * Make sure we don't think we already have a MANIFEST next time this task + * gets executed. + */ + protected void cleanUp() { + manifestAdded = false; + super.cleanUp(); + } } diff --git a/src/main/org/apache/tools/ant/taskdefs/War.java b/src/main/org/apache/tools/ant/taskdefs/War.java index d0d169c3e..6f3dea607 100644 --- a/src/main/org/apache/tools/ant/taskdefs/War.java +++ b/src/main/org/apache/tools/ant/taskdefs/War.java @@ -142,4 +142,13 @@ public class War extends Jar { super.zipFile(file, zOut, vPath); } } -} \ No newline at end of file + + /** + * Make sure we don't think we already have a web.xml next time this task + * gets executed. + */ + protected void cleanUp() { + descriptorAdded = false; + super.cleanUp(); + } +} diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java index f543df55f..84fb19f6d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -231,6 +231,8 @@ public class Zip extends MatchingTask { } throw new BuildException(msg, ioe, location); + } finally { + cleanUp(); } } @@ -525,4 +527,12 @@ public class Zip extends MatchingTask { addFiles(ds, zOut, prefix, fullpath); } } + + /** + * Do any clean up necessary to allow this instance to be used again. + * + *

When we get here, the Zip file has been closed and all we + * need to do is to reset some globals.

+ */ + protected void cleanUp() {} }