diff --git a/WHATSNEW b/WHATSNEW
index 4a7583726..a40c4ed3f 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -13,6 +13,16 @@ Fixed bugs:
* The junit task when used with includeantruntime="no" was incorrectly
printing a warning about multiple versions of ant detected in path
+Other changes:
+--------------
+
+ * PumpStreamHandler now explicitly verifies the streams for output
+ and error are not null and will throw an exception if they
+ are. This way creating a PumpStreamHandler will fail early as
+ opposed to some obscure errors later when closing streams or
+ finishing threads might fail.
+ Bugzilla Report 62148
+
Changes from Ant 1.9.10 TO Ant 1.9.11
=====================================
diff --git a/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java b/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
index 31671fc13..9f8484e5f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
+++ b/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
@@ -44,14 +44,20 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
/**
* Construct a new PumpStreamHandler
.
- * @param out the output OutputStream
.
- * @param err the error OutputStream
.
+ * @param out the output OutputStream
, must not be null.
+ * @param err the error OutputStream
, must not be null.
* @param input the input InputStream
.
* @param nonBlockingRead set it to true
if the input should be
* read with simulated non blocking IO.
*/
public PumpStreamHandler(OutputStream out, OutputStream err,
InputStream input, boolean nonBlockingRead) {
+ if (out == null) {
+ throw new NullPointerException("out must not be null");
+ }
+ if (err == null) {
+ throw new NullPointerException("err must not be null");
+ }
this.out = out;
this.err = err;
this.input = input;
@@ -60,8 +66,8 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
/**
* Construct a new PumpStreamHandler
.
- * @param out the output OutputStream
.
- * @param err the error OutputStream
.
+ * @param out the output OutputStream
, must not be null.
+ * @param err the error OutputStream
, must not be null.
* @param input the input InputStream
.
*/
public PumpStreamHandler(OutputStream out, OutputStream err,
@@ -71,8 +77,8 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
/**
* Construct a new PumpStreamHandler
.
- * @param out the output OutputStream
.
- * @param err the error OutputStream
.
+ * @param out the output OutputStream
, must not be null.
+ * @param err the error OutputStream
, must not be null.
*/
public PumpStreamHandler(OutputStream out, OutputStream err) {
this(out, err, null);
@@ -80,7 +86,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
/**
* Construct a new PumpStreamHandler
.
- * @param outAndErr the output/error OutputStream
.
+ * @param outAndErr the output/error OutputStream
, must not be null.
*/
public PumpStreamHandler(OutputStream outAndErr) {
this(outAndErr, outAndErr);
@@ -108,9 +114,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
* @param is the InputStream
.
*/
public void setProcessErrorStream(InputStream is) {
- if (err != null) {
- createProcessErrorPump(is, err);
- }
+ createProcessErrorPump(is, err);
}
/**