Skip to content

Commit

Permalink
Fix bug in ShortTermMemoryHandler with ArrayIndexOutOfBoundsException (
Browse files Browse the repository at this point in the history
  • Loading branch information
tzolotuhin authored and lukeis committed Sep 21, 2016
1 parent 12d92aa commit c120484
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public ShortTermMemoryHandler(int capacity, Level minimumLevel, Formatter format


@Override
public void publish(LogRecord record) {
public synchronized void publish(LogRecord record) {
if (record.getLevel().intValue() < minimumLevel) {
return;
}
Expand All @@ -67,12 +67,12 @@ public void publish(LogRecord record) {
}

@Override
public void flush() {
public synchronized void flush() {
/* NOOP */
}

@Override
public void close() throws SecurityException {
public synchronized void close() throws SecurityException {
for (int i = 0; i < capacity; i++) {
lastRecords[i] = null;
}
Expand All @@ -95,7 +95,7 @@ public synchronized LogRecord[] records() {
return validRecords.toArray(new LogRecord[validRecords.size()]);
}

public String formattedRecords() {
public synchronized String formattedRecords() {
final StringWriter writer;

writer = new StringWriter();
Expand Down

0 comments on commit c120484

Please sign in to comment.