On 8 February 2018 at 12:08, Gilles <gil...@harfang.homelinux.org> wrote:
> Hi.
>
> On Thu, 08 Feb 2018 11:55:10 -0000, s...@apache.org wrote:
>>
>> 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/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 {
>
>
> Why the difference in behaviour?

See NET-643

close() is supposed to be idempotent; flush() is not supposed to be
called on a closed stream.

> In the former case, "no-op" seems equally fine.

It was not a no-op; it was NPE.

> Gilles
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to