Author: sebb
Date: Thu Feb  8 11:55:10 2018
New Revision: 1823550

URL: http://svn.apache.org/viewvc?rev=1823550&view=rev
Log:
NET-643 NPE when closing telnet stream

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=1823550&r1=1823549&r2=1823550&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml [utf-8] (original)
+++ commons/proper/net/trunk/src/changes/changes.xml [utf-8] Thu Feb  8 
11:55:10 2018
@@ -74,6 +74,9 @@ This is mainly a bug-fix release. See fu
  The examples are not part of the public API, so this does not affect 
compatibility.
 
 ">
+            <action issue="NET-643" type="fix" dev="sebb" due-to="Vasily">
+            NPE when closing telnet stream
+            </action>
             <action issue="NET-648" type="add" dev="pschumacher">
             Add Automatic-Module-Name MANIFEST entry for Java 9 compatibility
             </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=1823550&r1=1823549&r2=1823550&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
 Thu Feb  8 11:55:10 2018
@@ -100,10 +100,16 @@ public class TelnetClient extends Telnet
 
     void _flushOutputStream() throws IOException
     {
+        if (_output_ == null) {
+            throw new IOException("Stream closed");
+        }
         _output_.flush();
     }
     void _closeOutputStream() throws IOException
     {
+        if (_output_ == null) {
+            return;
+        }
         try {
             _output_.close();
         } finally {


Reply via email to