You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2010/05/11 02:09:30 UTC
[jira] Resolved: (NET-264) Telnet spyStream NullPointerException
[ https://issues.apache.org/jira/browse/NET-264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb resolved NET-264.
----------------------
Fix Version/s: 2.1
Resolution: Fixed
> Telnet spyStream NullPointerException
> -------------------------------------
>
> Key: NET-264
> URL: https://issues.apache.org/jira/browse/NET-264
> Project: Commons Net
> Issue Type: Bug
> Affects Versions: 2.0
> Reporter: Jeremy Stone
> Fix For: 2.1
>
>
> 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 TelnetInputStream.run() 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)
> {
> try
> {
> if (ch != '\r')
> {
> _spyStream.write(ch);
> if (ch == '\n')
> {
> _spyStream.write('\r');
> }
> _spyStream.flush();
> }
> }
> 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.