You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rw...@apache.org on 2009/02/05 19:18:22 UTC

svn commit: r741217 - in /commons/proper/net/trunk/src/java/org/apache/commons/net: SocketClient.java telnet/TelnetClient.java

Author: rwinston
Date: Thu Feb  5 18:18:21 2009
New Revision: 741217

URL: http://svn.apache.org/viewvc?rev=741217&view=rev
Log:
NET-232 Add null check before disconnect

Modified:
    commons/proper/net/trunk/src/java/org/apache/commons/net/SocketClient.java
    commons/proper/net/trunk/src/java/org/apache/commons/net/telnet/TelnetClient.java

Modified: commons/proper/net/trunk/src/java/org/apache/commons/net/SocketClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/java/org/apache/commons/net/SocketClient.java?rev=741217&r1=741216&r2=741217&view=diff
==============================================================================
--- commons/proper/net/trunk/src/java/org/apache/commons/net/SocketClient.java (original)
+++ commons/proper/net/trunk/src/java/org/apache/commons/net/SocketClient.java Thu Feb  5 18:18:21 2009
@@ -264,9 +264,9 @@
      */
     public void disconnect() throws IOException
     {
-        _socket_.close();
-        _input_.close();
-        _output_.close();
+        if(_socket_ != null) _socket_.close();
+        if(_input_ != null) _input_.close();
+        if(_output_ != null) _output_.close();
         _socket_ = null;
         _input_ = null;
         _output_ = null;

Modified: commons/proper/net/trunk/src/java/org/apache/commons/net/telnet/TelnetClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/java/org/apache/commons/net/telnet/TelnetClient.java?rev=741217&r1=741216&r2=741217&view=diff
==============================================================================
--- commons/proper/net/trunk/src/java/org/apache/commons/net/telnet/TelnetClient.java (original)
+++ commons/proper/net/trunk/src/java/org/apache/commons/net/telnet/TelnetClient.java Thu Feb  5 18:18:21 2009
@@ -75,11 +75,11 @@
 
     void _flushOutputStream() throws IOException
     {
-        _output_.flush();
+        if(_output_ != null) _output_.flush();
     }
     void _closeOutputStream() throws IOException
     {
-        _output_.close();
+    	if(_output_ != null) _output_.close();
     }
 
     /***
@@ -123,8 +123,8 @@
      ***/
     public void disconnect() throws IOException
     {
-        __input.close();
-        __output.close();
+        if(__input != null) __input.close();
+        if(__output != null) __output.close();
         super.disconnect();
     }