Skip to content

Commit

Permalink
Fix stack overflow during massive log output
Browse files Browse the repository at this point in the history
  • Loading branch information
zaplatynski committed May 3, 2016
1 parent 1585953 commit cc5d413
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class ConsoleOutputStream extends ByteArrayOutputStream {

private final String endOfLine;
private final StringBuffer buffer; // NOPMD
private final StringBuilder buffer; //NOPMD
private MessageConsole messageConsole;
private SimpleAttributeSet attributes;
private PrintStream printStream;
Expand All @@ -32,7 +32,7 @@ public class ConsoleOutputStream extends ByteArrayOutputStream {
public ConsoleOutputStream(final MessageConsole messageConsole, final Color textColor,
final PrintStream printStream) {
endOfLine = System.lineSeparator();
buffer = new StringBuffer(80);
buffer = new StringBuilder(80); //NOPMD
this.messageConsole = messageConsole;
if (textColor != null) {
attributes = new SimpleAttributeSet();
Expand Down Expand Up @@ -128,8 +128,8 @@ private void clearBuffer() {
messageConsole.getDocument().insertString(0, line, attributes);
messageConsole.getTextComponent().setCaretPosition(0);
}
} catch (final BadLocationException ble) {
ble.printStackTrace(System.out);
} catch (final BadLocationException ble) { //NOPMD
//ignore to avoid stack overflows
}

if (printStream != null) {
Expand Down

0 comments on commit cc5d413

Please sign in to comment.