Hi Jason,
Sorry to bug you here again. If you know where I can find the JLine issue
tracker, could you let me know? Thanks.
Until then ;) I believe I've found a bug in JLine's handling of unsupported
terminals. Currently, when reading the input stream, when EOF is
encountered, JLine will return empty string "". I believe it should return
null in order to maintain consistency with supported terminal handling:
*The current implementation:*
/**
* Read a line for unsupported terminals.
*/
private String readLine(final InputStream in) throws IOException {
StringBuilder buff = new StringBuilder();
while (true) {
int i = in.read();
if (i == -1 || i == '\n' || i == '\r') {
return buff.toString();
}
buff.append((char) i);
}
// return new BufferedReader (new InputStreamReader (in)).readLine
();
}
*Should probably be updated to:*
/**
* Read a line for unsupported terminals.
*/
private String readLine(final InputStream in) throws IOException
{
StringBuilder buff = new StringBuilder();
while (true)
{
int i = in.read();
if (i == -1)
{
return null;
}
else if (i == '\n' || i == '\r')
{
return buff.toString();
}
buff.append((char) i);
}
// return new BufferedReader (new InputStreamReader (in)).readLine ();
}
Also, if performance is a reason for using the StringBuilder here, why not
use a *static final EMPTY_STRING = "";* and return that?
*The downstream issue, for reference:*
https://issues.jboss.org/browse/SEAMFORGE-77
Thanks for your time.
--
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"