[
https://issues.apache.org/jira/browse/NET-543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14020865#comment-14020865
]
Sebb commented on NET-543:
--------------------------
Actually, the problem has been there since the _spyRead method was first added
in r139367:
http://svn.apache.org/viewvc/jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/telnet/Telnet.java?r1=139367&r2=139366&pathrev=139367
This was over 11 years ago. I'm surprised that no-one has noticed this before,
so thanks very much for the report.
> 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
> Attachments:
> 0001-Fix-NET-543-net-telnet-spy-read-EOL-is-reversed.patch
>
>
> 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)