https://issues.apache.org/bugzilla/show_bug.cgi?id=49173
Summary: Telnet task is broken on read
Product: Ant
Version: 1.8.0
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Optional Tasks
AssignedTo: [email protected]
ReportedBy: [email protected]
re: org.apache.tools.ant.taskdefs.optional.net.TelnetTask
The two instances of while-loops currently written like this
while (windowStart++ < 0
|| !sb.substring(windowStart).equals(s)) {
are wrong. The increment happens before taking the substring. Changing it to
this
while (windowStart < 0
|| !sb.substring(windowStart).equals(s)) {
windowStart++;
makes it clearer when windowStart is incremented, and makes the code correct.
Debugging the code while doing the classic case, looking for "ogin:" before
typing the username demonstrates that the comparison will be "ogin:" to "gin:"
at the iteration when it should break out of the loop, making the loop
invariant true.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.