You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2018/04/17 09:30:17 UTC

[1/2] ant git commit: properly verify preconditions in PumpStreamHandler

Repository: ant
Updated Branches:
  refs/heads/master 761f8e60b -> 36a2087a6


properly verify preconditions in PumpStreamHandler

https://bz.apache.org/bugzilla/show_bug.cgi?id=62148


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/0d306932
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/0d306932
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/0d306932

Branch: refs/heads/master
Commit: 0d30693274fbae7282ca345a1374d9060008682d
Parents: 38a22b0
Author: Stefan Bodewig <bo...@apache.org>
Authored: Tue Apr 17 11:28:28 2018 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Tue Apr 17 11:28:28 2018 +0200

----------------------------------------------------------------------
 WHATSNEW                                        | 10 ++++++++
 .../tools/ant/taskdefs/PumpStreamHandler.java   | 24 ++++++++++++--------
 2 files changed, 24 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/0d306932/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 4a75837..a40c4ed 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
 =====================================
 

http://git-wip-us.apache.org/repos/asf/ant/blob/0d306932/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java b/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
index 31671fc..9f8484e 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 <code>PumpStreamHandler</code>.
-     * @param out the output <code>OutputStream</code>.
-     * @param err the error <code>OutputStream</code>.
+     * @param out the output <code>OutputStream</code>, must not be null.
+     * @param err the error <code>OutputStream</code>, must not be null.
      * @param input the input <code>InputStream</code>.
      * @param nonBlockingRead set it to <code>true</code> 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 <code>PumpStreamHandler</code>.
-     * @param out the output <code>OutputStream</code>.
-     * @param err the error <code>OutputStream</code>.
+     * @param out the output <code>OutputStream</code>, must not be null.
+     * @param err the error <code>OutputStream</code>, must not be null.
      * @param input the input <code>InputStream</code>.
      */
     public PumpStreamHandler(OutputStream out, OutputStream err,
@@ -71,8 +77,8 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
 
     /**
      * Construct a new <code>PumpStreamHandler</code>.
-     * @param out the output <code>OutputStream</code>.
-     * @param err the error <code>OutputStream</code>.
+     * @param out the output <code>OutputStream</code>, must not be null.
+     * @param err the error <code>OutputStream</code>, 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 <code>PumpStreamHandler</code>.
-     * @param outAndErr the output/error <code>OutputStream</code>.
+     * @param outAndErr the output/error <code>OutputStream</code>, must not be null.
      */
     public PumpStreamHandler(OutputStream outAndErr) {
         this(outAndErr, outAndErr);
@@ -108,9 +114,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
      * @param is the <code>InputStream</code>.
      */
     public void setProcessErrorStream(InputStream is) {
-        if (err != null) {
-            createProcessErrorPump(is, err);
-        }
+        createProcessErrorPump(is, err);
     }
 
     /**


[2/2] ant git commit: Merge branch '1.9.x'

Posted by bo...@apache.org.
Merge branch '1.9.x'


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/36a2087a
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/36a2087a
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/36a2087a

Branch: refs/heads/master
Commit: 36a2087a6c5232b575329ebf02a8a3c810aa1732
Parents: 761f8e6 0d30693
Author: Stefan Bodewig <bo...@apache.org>
Authored: Tue Apr 17 11:30:04 2018 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Tue Apr 17 11:30:04 2018 +0200

----------------------------------------------------------------------
 WHATSNEW                                        |  7 ++++++
 .../tools/ant/taskdefs/PumpStreamHandler.java   | 24 ++++++++++++--------
 2 files changed, 21 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/36a2087a/WHATSNEW
----------------------------------------------------------------------
diff --cc WHATSNEW
index 611ff14,a40c4ed..78a1fbc
--- a/WHATSNEW
+++ b/WHATSNEW
@@@ -16,10 -16,14 +16,17 @@@ Fixed bugs
  Other changes:
  --------------
  
 + * AntAssert is deprecated, assertThat from JUnit 4.4+, Hamcrest matchers and/or
 +   ExpectedException rule provide equivalent functionality
 +
+  * 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
 +Changes from Ant 1.10.2 TO Ant 1.10.3
  =====================================
  
  Changes that could break older environments: