commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ferry Huberts (JIRA)" <j...@apache.org>
Subject [jira] [Created] (NET-543) net: telnet: spy read EOL is reversed
Date Thu, 05 Jun 2014 11:53:02 GMT
Ferry Huberts created NET-543:
---------------------------------

             Summary: net: telnet: spy read EOL is reversed
                 Key: NET-543
                 URL: https://issues.apache.org/jira/browse/NET-543
             Project: Commons Net
          Issue Type: Bug
          Components: Telnet
    Affects Versions: 3.3
         Environment: Linux x64
            Reporter: Ferry Huberts
            Priority: Minor


the code in Telnet::_spyRead has a bug that results in a 'reversed' EOL.
I'm expecting SocketClient.NETASCII_EOL (\r\n) but I'm getting '\n\r'.

the code
{noformat}
    void _spyRead(int ch)
    {
        OutputStream spy = spyStream;
        if (spy != null)
        {
            try
            {
                if (ch != '\r')
                {
                    spy.write(ch);
                    if (ch == '\n')
                    {
                        spy.write('\r');
                    }
                    spy.flush();
                }
            }
            catch (IOException e)
            {
                spyStream = null;
            }
        }
    }
{noformat}

should be replaced by
{noformat}
    void _spyRead(int ch)
    {
        OutputStream spy = spyStream;
        if (spy != null)
        {
            try
            {
                if (ch != '\r')
                {
                    if (ch == '\n')
                    {
                        spy.write('\r');
                    }
                    spy.write(ch);
                    spy.flush();
                }
            }
            catch (IOException e)
            {
                spyStream = null;
            }
        }
    }
{noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message