#8 SSHExec output incorrect in Swing GUI

open
nobody
None
5
2008-03-10
2008-03-10
Doug Webster
No

The output from SSHExec is incorrect when displayed in the Swing GUI.

The method:
org.tp23.gui.widget.JTextAreaPrintStream.write(int)
incorrectly passes the integer value straight to the StringBuffer.append(int) method. The StringBuffer.append(int) method calls String.toString(int) turning the byte value into the representation of the number and appends that.

The JTextAreaPrintStream.write(int) method should proboably be re-written as:

public synchronized void write(int c){
line.append(Character.toChars(c));
}

I have tested this change and it does correct output from SSHExec in the Swing GUI.

Discussion