jskeet 02/02/26 07:25:15
Modified: src/main/org/apache/tools/ant DemuxOutputStream.java
Log:
Fixed problem which gave (on Windows) output such as:
[java] First line of real output
[java]
[java] Second line of real output
[java]
Revision Changes Path
1.8 +18 -1
jakarta-ant/src/main/org/apache/tools/ant/DemuxOutputStream.java
Index: DemuxOutputStream.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/DemuxOutputStream.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DemuxOutputStream.java 24 Feb 2002 08:57:02 -0000 1.7
+++ DemuxOutputStream.java 26 Feb 2002 15:25:15 -0000 1.8
@@ -139,10 +139,26 @@
*/
private void resetBufferInfo() {
Thread current = Thread.currentThread();
- buffers.remove(current);
+ BufferInfo bufferInfo = (BufferInfo)buffers.get(current);
+ try {
+ bufferInfo.buffer.close();
+ }
+ catch (IOException e) {
+ // Shouldn't happen
+ }
+ bufferInfo.buffer = new ByteArrayOutputStream();
+ bufferInfo.skip = false;
}
/**
+ * Removes the buffer for the current thread.
+ */
+ private void removeBuffer() {
+ Thread current = Thread.currentThread();
+ buffers.remove (current);
+ }
+
+ /**
* Writes the data to the buffer and flushes the buffer if a line
* separator is detected or if the buffer has reached its maximum size.
*
@@ -189,6 +205,7 @@
*/
public void close() throws IOException {
flush();
+ removeBuffer();
}
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>