You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2017/02/07 23:52:49 UTC

svn commit: r1782091 - in /commons/proper/net/trunk/src: changes/changes.xml main/java/org/apache/commons/net/telnet/TelnetClient.java

Author: sebb
Date: Tue Feb  7 23:52:49 2017
New Revision: 1782091

URL: http://svn.apache.org/viewvc?rev=1782091&view=rev
Log:
NET-596 NullPointerException when disconnecting TelnetClient twice with JDK 7

Modified:
    commons/proper/net/trunk/src/changes/changes.xml
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/TelnetClient.java

Modified: commons/proper/net/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/changes/changes.xml?rev=1782091&r1=1782090&r2=1782091&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml [utf-8] (original)
+++ commons/proper/net/trunk/src/changes/changes.xml [utf-8] Tue Feb  7 23:52:49 2017
@@ -87,6 +87,9 @@ without checking it if is a space.
   The POP3Mail examples can now get password from console, stdin or an environment variable.
   
 ">
+            <action issue="NET-596" type="fix" dev="sebb" due-to="Vincent Bories-Azeau">
+            NullPointerException when disconnecting TelnetClient twice with JDK 7
+            </action>
             <action issue="NET-602" type="fix" dev="sebb" due-to="Ross Braithwaite">
             Failure to parse times from SYST_L8 systems that report as "WINDOWS Type: L8"
             </action>

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/TelnetClient.java?rev=1782091&r1=1782090&r2=1782091&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/TelnetClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/TelnetClient.java Tue Feb  7 23:52:49 2017
@@ -80,7 +80,11 @@ public class TelnetClient extends Telnet
     }
     void _closeOutputStream() throws IOException
     {
-        _output_.close();
+        try {
+            _output_.close();            
+        } finally {
+            _output_ = null;
+        }
     }
 
     /***
@@ -125,6 +129,8 @@ public class TelnetClient extends Telnet
                 __output.close();
             }
         } finally { // NET-594
+            __output = null;
+            __input = null;
             super.disconnect();
         }
     }