peterreilly 2004/10/21 06:54:59
Modified: . Tag: ANT_16_BRANCH WHATSNEW
src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
Concat.java
Log:
sync
Revision Changes Path
No revision
No revision
1.503.2.141 +3 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.503.2.140
retrieving revision 1.503.2.141
diff -u -r1.503.2.140 -r1.503.2.141
--- WHATSNEW 21 Oct 2004 10:31:30 -0000 1.503.2.140
+++ WHATSNEW 21 Oct 2004 13:54:59 -0000 1.503.2.141
@@ -57,6 +57,9 @@
* 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
===================================
No revision
No revision
1.28.2.9 +23 -5 ant/src/main/org/apache/tools/ant/taskdefs/Concat.java
Index: Concat.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Concat.java,v
retrieving revision 1.28.2.8
retrieving revision 1.28.2.9
diff -u -r1.28.2.8 -r1.28.2.9
--- Concat.java 31 May 2004 08:24:30 -0000 1.28.2.8
+++ Concat.java 21 Oct 2004 13:54:59 -0000 1.28.2.9
@@ -93,7 +93,7 @@
/** Stores the binary attribute */
private boolean binary = false;
-
+
// Child elements.
/**
@@ -237,7 +237,6 @@
textBuffer.append(text);
}
-
/**
* Add a header to the concatenated output
* @param header the header
@@ -311,9 +310,9 @@
}
/**
- * 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();
@@ -423,6 +422,17 @@
}
/**
+ * execute the concat task.
+ */
+ public void execute() {
+ try {
+ checkAndExecute();
+ } finally {
+ resetTask();
+ }
+ }
+
+ /**
* Reset state to default.
*/
public void reset() {
@@ -439,6 +449,14 @@
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 @@
"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);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]