You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2007/09/18 22:57:49 UTC

svn commit: r577054 - /geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java

Author: jdillon
Date: Tue Sep 18 13:57:48 2007
New Revision: 577054

URL: http://svn.apache.org/viewvc?rev=577054&view=rev
Log:
Protect against nulls

Modified:
    geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java

Modified: geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java?rev=577054&r1=577053&r2=577054&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java Tue Sep 18 13:57:48 2007
@@ -116,13 +116,17 @@
         setChildOutputStream(p.getInputStream());
         setChildErrorStream(p.getErrorStream());
     }
-
     /**
      * Start pumping the streams.
      */
     public void start() {
-        outputThread.start();
-        errorThread.start();
+        if (outputThread != null) {
+            outputThread.start();
+        }
+
+        if (errorThread != null) {
+            errorThread.start();
+        }
 
         if (inputPump != null) {
             Thread inputThread = new Thread(inputPump);
@@ -135,18 +139,22 @@
      * Stop pumping the streams.
      */
     public void stop() {
-        try {
-            outputThread.join();
-        }
-        catch (InterruptedException e) {
-            // ignore
+        if (outputThread != null) {
+            try {
+                outputThread.join();
+            }
+            catch (InterruptedException e) {
+                // ignore
+            }
         }
 
-        try {
-            errorThread.join();
-        }
-        catch (InterruptedException e) {
-            // ignore
+        if (errorThread != null) {
+            try {
+                errorThread.join();
+            }
+            catch (InterruptedException e) {
+                // ignore
+            }
         }
 
         if (inputPump != null) {