Browse Source

add null guards when starting pumper threads

https://bz.apache.org/bugzilla/show_bug.cgi?id=62148
master
Stefan Bodewig 7 years ago
parent
commit
c851c3102f
1 changed files with 9 additions and 5 deletions
  1. +9
    -5
      src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java

+ 9
- 5
src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java View File

@@ -134,11 +134,9 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
* Start the <code>Thread</code>s. * Start the <code>Thread</code>s.
*/ */
public void start() { public void start() {
outputThread.start();
errorThread.start();
if (inputThread != null) {
inputThread.start();
}
start(outputThread);
start(errorThread);
start(inputThread);
} }


/** /**
@@ -163,6 +161,12 @@ public class PumpStreamHandler implements ExecuteStreamHandler {


private static final long JOIN_TIMEOUT = 200; private static final long JOIN_TIMEOUT = 200;


private void start(Thread t) {
if (t != null) {
t.start();
}
}

/** /**
* Waits for a thread to finish while trying to make it finish * Waits for a thread to finish while trying to make it finish
* quicker by stopping the pumper (if the thread is a {@link * quicker by stopping the pumper (if the thread is a {@link


Loading…
Cancel
Save