generating task PR: 21636 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274840 13f79535-47bb-0310-9956-ffa450edef68master
@@ -80,11 +80,10 @@ public class DemuxOutputStream extends OutputStream { | |||||
private ByteArrayOutputStream buffer; | private ByteArrayOutputStream buffer; | ||||
/** | /** | ||||
* Whether or not the next line-terminator should be skipped in terms | |||||
* of processing the buffer. Used to avoid \r\n invoking | |||||
* processBuffer twice. | |||||
* Indicates we have just seen a carriage return. It may be part of | |||||
* a crlf pair or a single cr invoking processBuffer twice. | |||||
*/ | */ | ||||
private boolean skip = false; | |||||
private boolean crSeen = false; | |||||
} | } | ||||
/** Maximum buffer size. */ | /** Maximum buffer size. */ | ||||
@@ -129,7 +128,7 @@ public class DemuxOutputStream extends OutputStream { | |||||
if (bufferInfo == null) { | if (bufferInfo == null) { | ||||
bufferInfo = new BufferInfo(); | bufferInfo = new BufferInfo(); | ||||
bufferInfo.buffer = new ByteArrayOutputStream(); | bufferInfo.buffer = new ByteArrayOutputStream(); | ||||
bufferInfo.skip = false; | |||||
bufferInfo.crSeen = false; | |||||
buffers.put(current, bufferInfo); | buffers.put(current, bufferInfo); | ||||
} | } | ||||
return bufferInfo; | return bufferInfo; | ||||
@@ -147,7 +146,7 @@ public class DemuxOutputStream extends OutputStream { | |||||
// Shouldn't happen | // Shouldn't happen | ||||
} | } | ||||
bufferInfo.buffer = new ByteArrayOutputStream(); | bufferInfo.buffer = new ByteArrayOutputStream(); | ||||
bufferInfo.skip = false; | |||||
bufferInfo.crSeen = false; | |||||
} | } | ||||
/** | /** | ||||
@@ -169,17 +168,23 @@ public class DemuxOutputStream extends OutputStream { | |||||
final byte c = (byte) cc; | final byte c = (byte) cc; | ||||
BufferInfo bufferInfo = getBufferInfo(); | BufferInfo bufferInfo = getBufferInfo(); | ||||
if ((c == '\n') || (c == '\r')) { | |||||
if (!bufferInfo.skip) { | |||||
processBuffer(bufferInfo.buffer); | |||||
} | |||||
} else { | |||||
if (c == '\n') { | |||||
// LF is always end of line (i.e. CRLF or single LF) | |||||
bufferInfo.buffer.write(cc); | bufferInfo.buffer.write(cc); | ||||
if (bufferInfo.buffer.size() > MAX_SIZE) { | |||||
processBuffer(bufferInfo.buffer); | |||||
} else { | |||||
if (bufferInfo.crSeen) { | |||||
// CR without LF - send buffer then add char | |||||
processBuffer(bufferInfo.buffer); | processBuffer(bufferInfo.buffer); | ||||
} | } | ||||
// add into buffer | |||||
bufferInfo.buffer.write(cc); | |||||
} | |||||
bufferInfo.crSeen = (c == '\r'); | |||||
if (!bufferInfo.crSeen && bufferInfo.buffer.size() > MAX_SIZE) { | |||||
processBuffer(bufferInfo.buffer); | |||||
} | } | ||||
bufferInfo.skip = (c == '\r'); | |||||
} | } | ||||
/** | /** | ||||
@@ -75,6 +75,8 @@ import org.apache.tools.ant.types.Description; | |||||
import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import org.apache.tools.ant.util.JavaEnvUtils; | import org.apache.tools.ant.util.JavaEnvUtils; | ||||
import org.apache.tools.ant.util.StringUtils; | |||||
/** | /** | ||||
* Central representation of an Ant project. This class defines an | * Central representation of an Ant project. This class defines an | ||||
@@ -1089,19 +1091,19 @@ public class Project { | |||||
* messages. If the current thread is not currently executing a task, | * messages. If the current thread is not currently executing a task, | ||||
* the message is logged directly. | * the message is logged directly. | ||||
* | * | ||||
* @param line Message to handle. Should not be <code>null</code>. | |||||
* @param output Message to handle. Should not be <code>null</code>. | |||||
* @param isError Whether the text represents an error (<code>true</code>) | * @param isError Whether the text represents an error (<code>true</code>) | ||||
* or information (<code>false</code>). | * or information (<code>false</code>). | ||||
*/ | */ | ||||
public void demuxOutput(String line, boolean isError) { | |||||
public void demuxOutput(String output, boolean isError) { | |||||
Task task = getThreadTask(Thread.currentThread()); | Task task = getThreadTask(Thread.currentThread()); | ||||
if (task == null) { | if (task == null) { | ||||
fireMessageLogged(this, line, isError ? MSG_ERR : MSG_INFO); | |||||
log(output, isError ? MSG_ERR : MSG_INFO); | |||||
} else { | } else { | ||||
if (isError) { | if (isError) { | ||||
task.handleErrorOutput(line); | |||||
task.handleErrorOutput(output); | |||||
} else { | } else { | ||||
task.handleOutput(line); | |||||
task.handleOutput(output); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -1158,19 +1160,19 @@ public class Project { | |||||
* | * | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
* | * | ||||
* @param line Message to handle. Should not be <code>null</code>. | |||||
* @param output Message to handle. Should not be <code>null</code>. | |||||
* @param isError Whether the text represents an error (<code>true</code>) | * @param isError Whether the text represents an error (<code>true</code>) | ||||
* or information (<code>false</code>). | * or information (<code>false</code>). | ||||
*/ | */ | ||||
public void demuxFlush(String line, boolean isError) { | |||||
public void demuxFlush(String output, boolean isError) { | |||||
Task task = getThreadTask(Thread.currentThread()); | Task task = getThreadTask(Thread.currentThread()); | ||||
if (task == null) { | if (task == null) { | ||||
fireMessageLogged(this, line, isError ? MSG_ERR : MSG_INFO); | |||||
fireMessageLogged(this, output, isError ? MSG_ERR : MSG_INFO); | |||||
} else { | } else { | ||||
if (isError) { | if (isError) { | ||||
task.handleErrorFlush(line); | |||||
task.handleErrorFlush(output); | |||||
} else { | } else { | ||||
task.handleFlush(line); | |||||
task.handleFlush(output); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -1915,7 +1917,13 @@ public class Project { | |||||
*/ | */ | ||||
private void fireMessageLoggedEvent(BuildEvent event, String message, | private void fireMessageLoggedEvent(BuildEvent event, String message, | ||||
int priority) { | int priority) { | ||||
event.setMessage(message, priority); | |||||
if (message.endsWith(StringUtils.LINE_SEP)) { | |||||
int endIndex = message.length() - StringUtils.LINE_SEP.length(); | |||||
event.setMessage(message.substring(0, endIndex), priority); | |||||
} else { | |||||
event.setMessage(message, priority); | |||||
} | |||||
Vector listeners = getBuildListeners(); | Vector listeners = getBuildListeners(); | ||||
synchronized (this) { | synchronized (this) { | ||||
if (loggingMessage) { | if (loggingMessage) { | ||||
@@ -305,23 +305,23 @@ public abstract class Task extends ProjectComponent { | |||||
} | } | ||||
/** | /** | ||||
* Handles a line of output by logging it with the INFO priority. | |||||
* Handles output by logging it with the INFO priority. | |||||
* | * | ||||
* @param line The line of output to log. Should not be <code>null</code>. | |||||
* @param output The output to log. Should not be <code>null</code>. | |||||
*/ | */ | ||||
protected void handleOutput(String line) { | |||||
log(line, Project.MSG_INFO); | |||||
protected void handleOutput(String output) { | |||||
log(output, Project.MSG_INFO); | |||||
} | } | ||||
/** | /** | ||||
* Handles a line of output by logging it with the INFO priority. | |||||
* Handles output by logging it with the INFO priority. | |||||
* | * | ||||
* @param line The line of output to log. Should not be <code>null</code>. | |||||
* @param output The output to log. Should not be <code>null</code>. | |||||
* | * | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
*/ | */ | ||||
protected void handleFlush(String line) { | |||||
handleOutput(line); | |||||
protected void handleFlush(String output) { | |||||
handleOutput(output); | |||||
} | } | ||||
/** | /** | ||||
@@ -342,23 +342,23 @@ public abstract class Task extends ProjectComponent { | |||||
} | } | ||||
/** | /** | ||||
* Handles an error line by logging it with the INFO priority. | |||||
* Handles an error output by logging it with the INFO priority. | |||||
* | * | ||||
* @param line The error line to log. Should not be <code>null</code>. | |||||
* @param output The error output to log. Should not be <code>null</code>. | |||||
*/ | */ | ||||
protected void handleErrorOutput(String line) { | |||||
log(line, Project.MSG_ERR); | |||||
protected void handleErrorOutput(String output) { | |||||
log(output, Project.MSG_ERR); | |||||
} | } | ||||
/** | /** | ||||
* Handles an error line by logging it with the INFO priority. | * Handles an error line by logging it with the INFO priority. | ||||
* | * | ||||
* @param line The error line to log. Should not be <code>null</code>. | |||||
* @param output The error output to log. Should not be <code>null</code>. | |||||
* | * | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
*/ | */ | ||||
protected void handleErrorFlush(String line) { | |||||
handleErrorOutput(line); | |||||
protected void handleErrorFlush(String output) { | |||||
handleErrorOutput(output); | |||||
} | } | ||||
/** | /** | ||||
@@ -192,13 +192,13 @@ public class UnknownElement extends Task { | |||||
/** | /** | ||||
* Handles output sent to System.out by this task or its real task. | * Handles output sent to System.out by this task or its real task. | ||||
* | * | ||||
* @param line The line of output to log. Should not be <code>null</code>. | |||||
* @param output The output to log. Should not be <code>null</code>. | |||||
*/ | */ | ||||
protected void handleOutput(String line) { | |||||
protected void handleOutput(String output) { | |||||
if (realThing instanceof Task) { | if (realThing instanceof Task) { | ||||
((Task) realThing).handleOutput(line); | |||||
((Task) realThing).handleOutput(output); | |||||
} else { | } else { | ||||
super.handleOutput(line); | |||||
super.handleOutput(output); | |||||
} | } | ||||
} | } | ||||
@@ -219,26 +219,26 @@ public class UnknownElement extends Task { | |||||
/** | /** | ||||
* Handles output sent to System.out by this task or its real task. | * Handles output sent to System.out by this task or its real task. | ||||
* | * | ||||
* @param line The line of output to log. Should not be <code>null</code>. | |||||
* @param output The output to log. Should not be <code>null</code>. | |||||
*/ | */ | ||||
protected void handleFlush(String line) { | |||||
protected void handleFlush(String output) { | |||||
if (realThing instanceof Task) { | if (realThing instanceof Task) { | ||||
((Task) realThing).handleFlush(line); | |||||
((Task) realThing).handleFlush(output); | |||||
} else { | } else { | ||||
super.handleFlush(line); | |||||
super.handleFlush(output); | |||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Handles error output sent to System.err by this task or its real task. | * Handles error output sent to System.err by this task or its real task. | ||||
* | * | ||||
* @param line The error line to log. Should not be <code>null</code>. | |||||
* @param output The error output to log. Should not be <code>null</code>. | |||||
*/ | */ | ||||
protected void handleErrorOutput(String line) { | |||||
protected void handleErrorOutput(String output) { | |||||
if (realThing instanceof Task) { | if (realThing instanceof Task) { | ||||
((Task) realThing).handleErrorOutput(line); | |||||
((Task) realThing).handleErrorOutput(output); | |||||
} else { | } else { | ||||
super.handleErrorOutput(line); | |||||
super.handleErrorOutput(output); | |||||
} | } | ||||
} | } | ||||
@@ -246,13 +246,13 @@ public class UnknownElement extends Task { | |||||
/** | /** | ||||
* Handles error output sent to System.err by this task or its real task. | * Handles error output sent to System.err by this task or its real task. | ||||
* | * | ||||
* @param line The error line to log. Should not be <code>null</code>. | |||||
* @param output The error output to log. Should not be <code>null</code>. | |||||
*/ | */ | ||||
protected void handleErrorFlush(String line) { | |||||
protected void handleErrorFlush(String output) { | |||||
if (realThing instanceof Task) { | if (realThing instanceof Task) { | ||||
((Task) realThing).handleErrorOutput(line); | |||||
((Task) realThing).handleErrorOutput(output); | |||||
} else { | } else { | ||||
super.handleErrorOutput(line); | |||||
super.handleErrorOutput(output); | |||||
} | } | ||||
} | } | ||||
@@ -263,11 +263,11 @@ public class Ant extends Task { | |||||
* | * | ||||
* @since Ant 1.5 | * @since Ant 1.5 | ||||
*/ | */ | ||||
public void handleOutput(String line) { | |||||
public void handleOutput(String output) { | |||||
if (newProject != null) { | if (newProject != null) { | ||||
newProject.demuxOutput(line, false); | |||||
newProject.demuxOutput(output, false); | |||||
} else { | } else { | ||||
super.handleOutput(line); | |||||
super.handleOutput(output); | |||||
} | } | ||||
} | } | ||||
@@ -290,11 +290,11 @@ public class Ant extends Task { | |||||
* | * | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
*/ | */ | ||||
public void handleFlush(String line) { | |||||
public void handleFlush(String output) { | |||||
if (newProject != null) { | if (newProject != null) { | ||||
newProject.demuxFlush(line, false); | |||||
newProject.demuxFlush(output, false); | |||||
} else { | } else { | ||||
super.handleFlush(line); | |||||
super.handleFlush(output); | |||||
} | } | ||||
} | } | ||||
@@ -303,11 +303,11 @@ public class Ant extends Task { | |||||
* | * | ||||
* @since Ant 1.5 | * @since Ant 1.5 | ||||
*/ | */ | ||||
public void handleErrorOutput(String line) { | |||||
public void handleErrorOutput(String output) { | |||||
if (newProject != null) { | if (newProject != null) { | ||||
newProject.demuxOutput(line, true); | |||||
newProject.demuxOutput(output, true); | |||||
} else { | } else { | ||||
super.handleErrorOutput(line); | |||||
super.handleErrorOutput(output); | |||||
} | } | ||||
} | } | ||||
@@ -316,11 +316,11 @@ public class Ant extends Task { | |||||
* | * | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
*/ | */ | ||||
public void handleErrorFlush(String line) { | |||||
public void handleErrorFlush(String output) { | |||||
if (newProject != null) { | if (newProject != null) { | ||||
newProject.demuxFlush(line, true); | |||||
newProject.demuxFlush(output, true); | |||||
} else { | } else { | ||||
super.handleErrorFlush(line); | |||||
super.handleErrorFlush(output); | |||||
} | } | ||||
} | } | ||||
@@ -190,11 +190,11 @@ public class CallTarget extends Task { | |||||
* | * | ||||
* @since Ant 1.5 | * @since Ant 1.5 | ||||
*/ | */ | ||||
public void handleOutput(String line) { | |||||
public void handleOutput(String output) { | |||||
if (callee != null) { | if (callee != null) { | ||||
callee.handleOutput(line); | |||||
callee.handleOutput(output); | |||||
} else { | } else { | ||||
super.handleOutput(line); | |||||
super.handleOutput(output); | |||||
} | } | ||||
} | } | ||||
@@ -217,11 +217,11 @@ public class CallTarget extends Task { | |||||
* | * | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
*/ | */ | ||||
public void handleFlush(String line) { | |||||
public void handleFlush(String output) { | |||||
if (callee != null) { | if (callee != null) { | ||||
callee.handleFlush(line); | |||||
callee.handleFlush(output); | |||||
} else { | } else { | ||||
super.handleFlush(line); | |||||
super.handleFlush(output); | |||||
} | } | ||||
} | } | ||||
@@ -230,11 +230,11 @@ public class CallTarget extends Task { | |||||
* | * | ||||
* @since Ant 1.5 | * @since Ant 1.5 | ||||
*/ | */ | ||||
public void handleErrorOutput(String line) { | |||||
public void handleErrorOutput(String output) { | |||||
if (callee != null) { | if (callee != null) { | ||||
callee.handleErrorOutput(line); | |||||
callee.handleErrorOutput(output); | |||||
} else { | } else { | ||||
super.handleErrorOutput(line); | |||||
super.handleErrorOutput(output); | |||||
} | } | ||||
} | } | ||||
@@ -243,11 +243,11 @@ public class CallTarget extends Task { | |||||
* | * | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
*/ | */ | ||||
public void handleErrorFlush(String line) { | |||||
public void handleErrorFlush(String output) { | |||||
if (callee != null) { | if (callee != null) { | ||||
callee.handleErrorFlush(line); | |||||
callee.handleErrorFlush(output); | |||||
} else { | } else { | ||||
super.handleErrorFlush(line); | |||||
super.handleErrorFlush(output); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -460,11 +460,11 @@ public class Java extends Task { | |||||
* | * | ||||
* @since Ant 1.5 | * @since Ant 1.5 | ||||
*/ | */ | ||||
protected void handleOutput(String line) { | |||||
protected void handleOutput(String output) { | |||||
if (redirector.getOutputStream() != null) { | if (redirector.getOutputStream() != null) { | ||||
redirector.handleOutput(line); | |||||
redirector.handleOutput(output); | |||||
} else { | } else { | ||||
super.handleOutput(line); | |||||
super.handleOutput(output); | |||||
} | } | ||||
} | } | ||||
@@ -482,11 +482,11 @@ public class Java extends Task { | |||||
* | * | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
*/ | */ | ||||
protected void handleFlush(String line) { | |||||
protected void handleFlush(String output) { | |||||
if (redirector.getOutputStream() != null) { | if (redirector.getOutputStream() != null) { | ||||
redirector.handleFlush(line); | |||||
redirector.handleFlush(output); | |||||
} else { | } else { | ||||
super.handleFlush(line); | |||||
super.handleFlush(output); | |||||
} | } | ||||
} | } | ||||
@@ -495,11 +495,11 @@ public class Java extends Task { | |||||
* | * | ||||
* @since Ant 1.5 | * @since Ant 1.5 | ||||
*/ | */ | ||||
protected void handleErrorOutput(String line) { | |||||
protected void handleErrorOutput(String output) { | |||||
if (redirector.getErrorStream() != null) { | if (redirector.getErrorStream() != null) { | ||||
redirector.handleErrorOutput(line); | |||||
redirector.handleErrorOutput(output); | |||||
} else { | } else { | ||||
super.handleErrorOutput(line); | |||||
super.handleErrorOutput(output); | |||||
} | } | ||||
} | } | ||||
@@ -508,11 +508,11 @@ public class Java extends Task { | |||||
* | * | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
*/ | */ | ||||
protected void handleErrorFlush(String line) { | |||||
protected void handleErrorFlush(String output) { | |||||
if (redirector.getErrorStream() != null) { | if (redirector.getErrorStream() != null) { | ||||
redirector.handleErrorFlush(line); | |||||
redirector.handleErrorFlush(output); | |||||
} else { | } else { | ||||
super.handleErrorOutput(line); | |||||
super.handleErrorOutput(output); | |||||
} | } | ||||
} | } | ||||
@@ -359,13 +359,13 @@ public class Redirector { | |||||
/** | /** | ||||
* Pass output sent to System.out to specified output. | * Pass output sent to System.out to specified output. | ||||
* | * | ||||
* @param line the data to be output | |||||
* @param output the data to be output | |||||
*/ | */ | ||||
protected void handleOutput(String line) { | |||||
protected void handleOutput(String output) { | |||||
if (outPrintStream == null) { | if (outPrintStream == null) { | ||||
outPrintStream = new PrintStream(outputStream); | outPrintStream = new PrintStream(outputStream); | ||||
} | } | ||||
outPrintStream.println(line); | |||||
outPrintStream.print(output); | |||||
} | } | ||||
/** | /** | ||||
@@ -392,38 +392,38 @@ public class Redirector { | |||||
/** | /** | ||||
* Process data due to a flush operation. | * Process data due to a flush operation. | ||||
* | * | ||||
* @param line the data being flushed. | |||||
* @param output the data being flushed. | |||||
*/ | */ | ||||
protected void handleFlush(String line) { | |||||
protected void handleFlush(String output) { | |||||
if (outPrintStream == null) { | if (outPrintStream == null) { | ||||
outPrintStream = new PrintStream(outputStream); | outPrintStream = new PrintStream(outputStream); | ||||
} | } | ||||
outPrintStream.print(line); | |||||
outPrintStream.print(output); | |||||
outPrintStream.flush(); | outPrintStream.flush(); | ||||
} | } | ||||
/** | /** | ||||
* Process error output | * Process error output | ||||
* | * | ||||
* @param line the error output data. | |||||
* @param output the error output data. | |||||
*/ | */ | ||||
protected void handleErrorOutput(String line) { | |||||
protected void handleErrorOutput(String output) { | |||||
if (errorPrintStream == null) { | if (errorPrintStream == null) { | ||||
errorPrintStream = new PrintStream(errorStream); | errorPrintStream = new PrintStream(errorStream); | ||||
} | } | ||||
errorPrintStream.println(line); | |||||
errorPrintStream.print(output); | |||||
} | } | ||||
/** | /** | ||||
* Handle a flush operation on the error stream | * Handle a flush operation on the error stream | ||||
* | * | ||||
* @param line the error information being flushed. | |||||
* @param output the error information being flushed. | |||||
*/ | */ | ||||
protected void handleErrorFlush(String line) { | |||||
protected void handleErrorFlush(String output) { | |||||
if (errorPrintStream == null) { | if (errorPrintStream == null) { | ||||
errorPrintStream = new PrintStream(errorStream); | errorPrintStream = new PrintStream(errorStream); | ||||
} | } | ||||
errorPrintStream.print(line); | |||||
errorPrintStream.print(output); | |||||
} | } | ||||
/** | /** | ||||
@@ -748,14 +748,14 @@ public class JUnitTask extends Task { | |||||
* | * | ||||
* @since Ant 1.5 | * @since Ant 1.5 | ||||
*/ | */ | ||||
protected void handleOutput(String line) { | |||||
protected void handleOutput(String output) { | |||||
if (runner != null) { | if (runner != null) { | ||||
runner.handleOutput(line); | |||||
runner.handleOutput(output); | |||||
if (showOutput) { | if (showOutput) { | ||||
super.handleOutput(line); | |||||
super.handleOutput(output); | |||||
} | } | ||||
} else { | } else { | ||||
super.handleOutput(line); | |||||
super.handleOutput(output); | |||||
} | } | ||||
} | } | ||||
@@ -780,14 +780,14 @@ public class JUnitTask extends Task { | |||||
* | * | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
*/ | */ | ||||
protected void handleFlush(String line) { | |||||
protected void handleFlush(String output) { | |||||
if (runner != null) { | if (runner != null) { | ||||
runner.handleFlush(line); | |||||
runner.handleFlush(output); | |||||
if (showOutput) { | if (showOutput) { | ||||
super.handleFlush(line); | |||||
super.handleFlush(output); | |||||
} | } | ||||
} else { | } else { | ||||
super.handleFlush(line); | |||||
super.handleFlush(output); | |||||
} | } | ||||
} | } | ||||
@@ -797,14 +797,14 @@ public class JUnitTask extends Task { | |||||
* | * | ||||
* @since Ant 1.5 | * @since Ant 1.5 | ||||
*/ | */ | ||||
public void handleErrorOutput(String line) { | |||||
public void handleErrorOutput(String output) { | |||||
if (runner != null) { | if (runner != null) { | ||||
runner.handleErrorOutput(line); | |||||
runner.handleErrorOutput(output); | |||||
if (showOutput) { | if (showOutput) { | ||||
super.handleErrorOutput(line); | |||||
super.handleErrorOutput(output); | |||||
} | } | ||||
} else { | } else { | ||||
super.handleErrorOutput(line); | |||||
super.handleErrorOutput(output); | |||||
} | } | ||||
} | } | ||||
@@ -815,14 +815,14 @@ public class JUnitTask extends Task { | |||||
* | * | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
*/ | */ | ||||
public void handleErrorFlush(String line) { | |||||
public void handleErrorFlush(String output) { | |||||
if (runner != null) { | if (runner != null) { | ||||
runner.handleErrorFlush(line); | |||||
runner.handleErrorFlush(output); | |||||
if (showOutput) { | if (showOutput) { | ||||
super.handleErrorFlush(line); | |||||
super.handleErrorFlush(output); | |||||
} | } | ||||
} else { | } else { | ||||
super.handleErrorFlush(line); | |||||
super.handleErrorFlush(output); | |||||
} | } | ||||
} | } | ||||
@@ -398,9 +398,9 @@ public class JUnitTestRunner implements TestListener { | |||||
} | } | ||||
} | } | ||||
protected void handleOutput(String line) { | |||||
protected void handleOutput(String output) { | |||||
if (systemOut != null) { | if (systemOut != null) { | ||||
systemOut.println(line); | |||||
systemOut.print(output); | |||||
} | } | ||||
} | } | ||||
@@ -414,21 +414,21 @@ public class JUnitTestRunner implements TestListener { | |||||
return -1; | return -1; | ||||
} | } | ||||
protected void handleErrorOutput(String line) { | |||||
protected void handleErrorOutput(String output) { | |||||
if (systemError != null) { | if (systemError != null) { | ||||
systemError.println(line); | |||||
systemError.print(output); | |||||
} | } | ||||
} | } | ||||
protected void handleFlush(String line) { | |||||
protected void handleFlush(String output) { | |||||
if (systemOut != null) { | if (systemOut != null) { | ||||
systemOut.print(line); | |||||
systemOut.print(output); | |||||
} | } | ||||
} | } | ||||
protected void handleErrorFlush(String line) { | |||||
protected void handleErrorFlush(String output) { | |||||
if (systemError != null) { | if (systemError != null) { | ||||
systemError.print(line); | |||||
systemError.print(output); | |||||
} | } | ||||
} | } | ||||
@@ -57,20 +57,20 @@ package org.apache.tools.ant.taskdefs; | |||||
import org.apache.tools.ant.BuildFileTest; | import org.apache.tools.ant.BuildFileTest; | ||||
/** | /** | ||||
* @author Gus Heck <gus.heck@olin.edu> | |||||
* @author Gus Heck <gus.heck@olin.edu> | |||||
*/ | */ | ||||
public class DefaultExcludesTest extends BuildFileTest { | |||||
public DefaultExcludesTest(String name) { | |||||
public class DefaultExcludesTest extends BuildFileTest { | |||||
public DefaultExcludesTest(String name) { | |||||
super(name); | super(name); | ||||
} | |||||
public void setUp() { | |||||
} | |||||
public void setUp() { | |||||
configureProject("src/etc/testcases/taskdefs/defaultexcludes.xml"); | configureProject("src/etc/testcases/taskdefs/defaultexcludes.xml"); | ||||
} | } | ||||
// Output the default excludes | // Output the default excludes | ||||
public void test1() { | |||||
public void test1() { | |||||
expectLog("test1", "Current Default Excludes:\n"+ | expectLog("test1", "Current Default Excludes:\n"+ | ||||
" **/*~\n"+ | " **/*~\n"+ | ||||
" **/#*#\n"+ | " **/#*#\n"+ | ||||
@@ -85,11 +85,11 @@ public class DefaultExcludesTest extends BuildFileTest { | |||||
" **/vssver.scc\n"+ | " **/vssver.scc\n"+ | ||||
" **/.svn\n"+ | " **/.svn\n"+ | ||||
" **/.svn/**\n"+ | " **/.svn/**\n"+ | ||||
" **/.DS_Store\n"); | |||||
" **/.DS_Store"); | |||||
} | } | ||||
// adding something to the excludes' | // adding something to the excludes' | ||||
public void test2() { | |||||
public void test2() { | |||||
expectLog("test2", "Current Default Excludes:\n"+ | expectLog("test2", "Current Default Excludes:\n"+ | ||||
" **/*~\n"+ | " **/*~\n"+ | ||||
" **/#*#\n"+ | " **/#*#\n"+ | ||||
@@ -105,11 +105,11 @@ public class DefaultExcludesTest extends BuildFileTest { | |||||
" **/.svn\n"+ | " **/.svn\n"+ | ||||
" **/.svn/**\n"+ | " **/.svn/**\n"+ | ||||
" **/.DS_Store\n"+ | " **/.DS_Store\n"+ | ||||
" foo\n"); // foo added | |||||
" foo"); // foo added | |||||
} | } | ||||
// removing something from the defaults | // removing something from the defaults | ||||
public void test3() { | |||||
public void test3() { | |||||
expectLog("test3", "Current Default Excludes:\n"+ | expectLog("test3", "Current Default Excludes:\n"+ | ||||
" **/*~\n"+ | " **/*~\n"+ | ||||
" **/#*#\n"+ | " **/#*#\n"+ | ||||
@@ -124,6 +124,6 @@ public class DefaultExcludesTest extends BuildFileTest { | |||||
" **/vssver.scc\n"+ | " **/vssver.scc\n"+ | ||||
" **/.svn\n"+ | " **/.svn\n"+ | ||||
" **/.svn/**\n"+ | " **/.svn/**\n"+ | ||||
" **/.DS_Store\n"); | |||||
" **/.DS_Store"); | |||||
} | } | ||||
} | } |
@@ -71,41 +71,41 @@ public class DemuxOutputTask extends Task { | |||||
private String randomErrValue; | private String randomErrValue; | ||||
private boolean outputReceived = false; | private boolean outputReceived = false; | ||||
private boolean errorReceived = false; | private boolean errorReceived = false; | ||||
public void execute() { | public void execute() { | ||||
Random generator = new Random(); | Random generator = new Random(); | ||||
randomOutValue = "Output Value is " + generator.nextInt(); | randomOutValue = "Output Value is " + generator.nextInt(); | ||||
randomErrValue = "Error Value is " + generator.nextInt(); | randomErrValue = "Error Value is " + generator.nextInt(); | ||||
System.out.println(randomOutValue); | System.out.println(randomOutValue); | ||||
System.err.println(randomErrValue); | System.err.println(randomErrValue); | ||||
if (!outputReceived) { | if (!outputReceived) { | ||||
throw new BuildException("Did not receive output"); | throw new BuildException("Did not receive output"); | ||||
} | |||||
} | |||||
if (!errorReceived) { | if (!errorReceived) { | ||||
throw new BuildException("Did not receive error"); | throw new BuildException("Did not receive error"); | ||||
} | } | ||||
} | } | ||||
protected void handleOutput(String line) { | protected void handleOutput(String line) { | ||||
line = line.trim(); | |||||
if (line.length() != 0 && !line.equals(randomOutValue)) { | if (line.length() != 0 && !line.equals(randomOutValue)) { | ||||
String message = "Received = [" + line + "], expected = [" | |||||
String message = "Received = [" + line + "], expected = [" | |||||
+ randomOutValue + "]"; | + randomOutValue + "]"; | ||||
throw new BuildException(message); | throw new BuildException(message); | ||||
} | } | ||||
outputReceived = true; | outputReceived = true; | ||||
} | } | ||||
protected void handleErrorOutput(String line) { | protected void handleErrorOutput(String line) { | ||||
line = line.trim(); | |||||
if (line.length() != 0 && !line.equals(randomErrValue)) { | if (line.length() != 0 && !line.equals(randomErrValue)) { | ||||
String message = "Received = [" + line + "], expected = [" | |||||
String message = "Received = [" + line + "], expected = [" | |||||
+ randomErrValue + "]"; | + randomErrValue + "]"; | ||||
throw new BuildException(message); | throw new BuildException(message); | ||||
} | } | ||||
errorReceived = true; | errorReceived = true; | ||||
} | } | ||||
} | } | ||||