[
https://issues.apache.org/jira/browse/NET-543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14018736#comment-14018736
]
Ferry Huberts commented on NET-543:
-----------------------------------
git patch
{noformat}
>From 6384d2a4ff8838f705f6a28d025d54dc8ed65f30 Mon Sep 17 00:00:00 2001
From: Ferry Huberts <[email protected]>
Date: Thu, 5 Jun 2014 14:31:36 +0200
Subject: [PATCH] Fix NET-543: net: telnet: spy read EOL is reversed
Signed-off-by: Ferry Huberts <[email protected]>
---
src/main/java/org/apache/commons/net/telnet/Telnet.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/net/telnet/Telnet.java
b/src/main/java/org/apache/commons/net/telnet/Telnet.java
index 8f56f0f..e48b7e9 100644
--- a/src/main/java/org/apache/commons/net/telnet/Telnet.java
+++ b/src/main/java/org/apache/commons/net/telnet/Telnet.java
@@ -1205,11 +1205,11 @@ class Telnet extends SocketClient
{
if (ch != '\r')
{
- spy.write(ch);
if (ch == '\n')
{
spy.write('\r');
}
+ spy.write(ch);
spy.flush();
}
}
--
1.9.3
{noformat}
> 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)