commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwins...@apache.org
Subject svn commit: r741217 - in /commons/proper/net/trunk/src/java/org/apache/commons/net: SocketClient.java telnet/TelnetClient.java
Date Thu, 05 Feb 2009 18:18:22 GMT
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();
     }
 



Mime
View raw message