1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

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

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;