mabe02/lanterna

Regression in input from Telnet terminal

ljosa opened this issue · 4 comments

ljosa commented

The demo in TelnetTerminalTest.java no longer works.

Bisecting shows that it broke with commit 04acb75.

After connecting, the telnet connection is lost immediately. Here is the stack trace and output:

terminal$ java -cp ~/tmp/lanterna/src/main/java:~/tmp/lanterna/src/test/java com.googlecode.lanterna.terminal.TelnetTerminalTest
Resized to {113x36}
java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:150)
        at java.net.SocketInputStream.read(SocketInputStream.java:121)
        at com.googlecode.lanterna.terminal.ansi.TelnetTerminal$TelnetClientIACFilterer.fillBuffer(TelnetTerminal.java:277)
        at com.googlecode.lanterna.terminal.ansi.TelnetTerminal$TelnetClientIACFilterer.available(TelnetTerminal.java:246)
        at com.googlecode.lanterna.terminal.ansi.TelnetTerminal$TelnetClientIACFilterer.read(TelnetTerminal.java:256)
        at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
        at java.io.InputStreamReader.read(InputStreamReader.java:184)
        at java.io.BufferedReader.fill(BufferedReader.java:161)
        at java.io.BufferedReader.read(BufferedReader.java:182)
        at com.googlecode.lanterna.input.InputDecoder.getNextCharacter(InputDecoder.java:144)
        at com.googlecode.lanterna.terminal.ansi.StreamBasedTerminal.readInput(StreamBasedTerminal.java:228)
        at com.googlecode.lanterna.terminal.ansi.StreamBasedTerminal.readInput(StreamBasedTerminal.java:207)
        at com.googlecode.lanterna.terminal.ansi.ANSITerminal.readInput(ANSITerminal.java:287)
        at com.googlecode.lanterna.terminal.TelnetTerminalTest$1.run(TelnetTerminalTest.java:70)
avl42 commented

As the committer of that change, you can be pretty sure, that it did work for me - back then :-)

avl42 commented

well, I see it now, too... can reproduce it ... will try to fix it...

avl42 commented

Back then I used eclipse... my eclipse machine is currently out of reach, so now I compiled and ran it on command line.

The strange thing is, that the "Read timed out" happens pretty instantly (in less than 20 milliseconds).
Maybe other Java implementations need some special stroking to get it working... or ...
I guess I need to get back to eclipse and see what it did differently, back then, than java
on command line does now.

avl42 commented

update: I got hold of my eclipse machine, and ... it does works there.
I will have to resort to other debugging tricks to fix it for plain Java...
It ain't ready until it runs in all the supported javas.