peterreilly 2004/10/21 06:54:25 Modified: . WHATSNEW src/main/org/apache/tools/ant/taskdefs Concat.java Log: Concat task instance could not be run twice PR: 31814 Reported by: elara at smartops dot com (Eduardo) Revision Changes Path 1.675 +3 -0 ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.674 retrieving revision 1.675 diff -u -r1.674 -r1.675 --- WHATSNEW 21 Oct 2004 10:31:06 -0000 1.674 +++ WHATSNEW 21 Oct 2004 13:54:25 -0000 1.675 @@ -127,6 +127,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 =================================== 1.37 +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.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- Concat.java 31 May 2004 08:21:02 -0000 1.36 +++ Concat.java 21 Oct 2004 13:54:25 -0000 1.37 @@ -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]