commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Stone (JIRA)" <>
Subject [jira] Created: (NET-264) Telnet spyStream NullPointerException
Date Thu, 12 Mar 2009 15:20:50 GMT
Telnet spyStream NullPointerException

                 Key: NET-264
             Project: Commons Net
          Issue Type: Bug
    Affects Versions: 2.0
            Reporter: Jeremy Stone

Calling stopSpyStream on TelnetClient sets spyStream to null without regard to whether _spyRead
or _spyWrite are being invoked on another thread. 

Resulting NPE in _spyRead/_spy_Write is caught in which goes on to
close the stream.

May be able to fix by taking local copy of spyStream (which ought also to be volatile) in
both of _spyRead and _spyWrite. E.g. for _spyRead:

    void _spyRead(int ch)
        OutputStream _spyStream = spyStream;
        if (_spyStream != null)
                if (ch != '\r')
                    if (ch == '\n')
            catch (IOException e)
                spyStream = null;

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message