geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r577054 - /geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java
Date Tue, 18 Sep 2007 20:57:49 GMT
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) {



Mime
View raw message