From c851c3102fb9e76975f906b9484d794be26c9df2 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 17 Apr 2018 11:40:07 +0200 Subject: [PATCH] add null guards when starting pumper threads https://bz.apache.org/bugzilla/show_bug.cgi?id=62148 --- .../tools/ant/taskdefs/PumpStreamHandler.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java b/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java index 9f8484e5f..e7d24c7e3 100644 --- a/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java +++ b/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java @@ -134,11 +134,9 @@ public class PumpStreamHandler implements ExecuteStreamHandler { * Start the Threads. */ 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 void start(Thread t) { + if (t != null) { + t.start(); + } + } + /** * Waits for a thread to finish while trying to make it finish * quicker by stopping the pumper (if the thread is a {@link