Browse Source

Concat task instance could not be run twice

PR: 31814
Reported by: 	elara at smartops dot com (Eduardo)


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276953 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 21 years ago
parent
commit
a340fef0f6
2 changed files with 26 additions and 5 deletions
  1. +3
    -0
      WHATSNEW
  2. +23
    -5
      src/main/org/apache/tools/ant/taskdefs/Concat.java

+ 3
- 0
WHATSNEW View File

@@ -127,6 +127,9 @@ Fixed bugs:
* ExecTask executes checkConfiguration() even though os does not match.
Bugzilla report 31805.

* Concat task instance could not be run twice.
Bugzilla report 31814.

Changes from Ant 1.6.1 to Ant 1.6.2
===================================



+ 23
- 5
src/main/org/apache/tools/ant/taskdefs/Concat.java View File

@@ -93,7 +93,7 @@ public class Concat extends Task {

/** Stores the binary attribute */
private boolean binary = false;
// Child elements.

/**
@@ -237,7 +237,6 @@ public class Concat extends Task {
textBuffer.append(text);
}

/**
* Add a header to the concatenated output
* @param header the header
@@ -311,9 +310,9 @@ public class Concat extends Task {
}

/**
* This method performs the concatenation.
* This method checks the attributes and performs the concatenation.
*/
public void execute() {
private void checkAndExecute() {

// treat empty nested text as no text
sanitizeText();
@@ -422,6 +421,17 @@ public class Concat extends Task {
}
}

/**
* execute the concat task.
*/
public void execute() {
try {
checkAndExecute();
} finally {
resetTask();
}
}

/**
* Reset state to default.
*/
@@ -439,6 +449,14 @@ public class Concat extends Task {
header = null;
}

/**
* reset the used variables to allow the same task
* instance to be used again.
*/
private void resetTask() {
sourceFiles.clear();
}

private void checkAddFiles(File base, String[] filenames) {
for (int i = 0; i < filenames.length; ++i) {
File file = new File(base, filenames[i]);
@@ -471,7 +489,7 @@ public class Concat extends Task {
"Unable to open " + destinationFile
+ " for writing", t);
}
for (Iterator i = sourceFiles.iterator(); i.hasNext(); ) {
for (Iterator i = sourceFiles.iterator(); i.hasNext();) {
File sourceFile = (File) i.next();
try {
in = new FileInputStream(sourceFile);


Loading…
Cancel
Save