In EditorConsole::write(), use all arguments

When System.(out|err).print was used before there was a visible
EditorConsole, the message was written to the stderr/stdout by this
instead of the EditorConsole. However, the write(data, offset, length)
version would not pass on its offset and length parameters to the
stdout/stderr stream, causing (parts of) a message to be printed
multiple times.

This commit makes sure the parameters are all properly passed to the
real stream.

For some reason the write(int) and write(byte[], int, int) methods in
PrintStream do not throw an IOException like the write(byte[]) version,
so the try block has to go.
This commit is contained in:
Matthijs Kooijman 2013-10-29 19:01:18 +01:00
parent 4592acc213
commit c6795dde73
1 changed files with 5 additions and 7 deletions

View File

@ -333,13 +333,11 @@ public class EditorConsole extends JScrollPane {
if (currentConsole != null) {
currentConsole.write(b, offset, length, err);
} else {
try {
if (err) {
systemErr.write(b);
} else {
systemOut.write(b);
}
} catch (IOException e) { } // just ignore, where would we write?
if (err) {
systemErr.write(b, offset, length);
} else {
systemOut.write(b, offset, length);
}
}
OutputStream echo = err ? stderrFile : stdoutFile;