Browse Source

In <zip> and <jara> only reset internal state at the end of execute,

not the attributes and child elements obtained via configuration.

Add a new method that allows the task instances to be reset to their
unconfigured state.

PR: 7552


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272319 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
6454a8ffac
2 changed files with 34 additions and 2 deletions
  1. +14
    -1
      src/main/org/apache/tools/ant/taskdefs/Jar.java
  2. +20
    -1
      src/main/org/apache/tools/ant/taskdefs/Zip.java

+ 14
- 1
src/main/org/apache/tools/ant/taskdefs/Jar.java View File

@@ -455,15 +455,28 @@ public class Jar extends Zip {
/**
* Make sure we don't think we already have a MANIFEST next time this task
* gets executed.
*
* @see Zip#cleanUp
*/
protected void cleanUp() {
super.cleanUp();

manifest = null;
}

/**
* reset to default values.
*
* @see Zip#reset
*
* @since 1.44, Ant 1.5
*/
public void reset() {
super.reset();
configuredManifest = null;
filesetManifest = null;
mergeManifests = false;
mergeManifestsMain = false;
manifest = null;
manifestFile = null;
index = false;
}


+ 20
- 1
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -846,14 +846,33 @@ public class Zip extends MatchingTask {
*
* <p>When we get here, the Zip file has been closed and all we
* need to do is to reset some globals.</p>
*
* <p>This method will only reset globals that have been changed
* during execute(), it will not alter the attributes or nested
* child elements. If you want to reset the instance so that you
* can later zip a completely different set of files, you must use
* the reset method.</p>
*
* @see #reset
*/
protected void cleanUp() {
addedDirs.clear();
addedFiles.removeAllElements();
entries.clear();
}

/**
* Makes this instance reset all attributes to their default
* values and forget all children.
*
* @since 1.72, Ant 1.5
*
* @see #cleanUp
*/
public void reset() {
filesets.removeAllElements();
zipFile = null;
baseDir = null;
entries.clear();
groupfilesets.removeAllElements();
duplicate = "add";
archiveType = "zip";


Loading…
Cancel
Save