Skip to content

Commit

Permalink
Return a copy of messages in MockMTAppender (elastic#94982)
Browse files Browse the repository at this point in the history
Couldn't reproduce the failure, but in principle there is an issue
there. Other options are a CopyOnWriteArrayList or just synchronizing on
`messages()` return value. Returning a copy should be enough, since this
is only used in one place for asserting some test expectations in an
`assertBusy`.

Closes elastic#94559
  • Loading branch information
pxsalehi committed Apr 4, 2023
1 parent d9007c3 commit c4091fb
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2546,7 +2546,7 @@ private static class MockMTAppender extends AbstractAppender {
private final List<String> messages = Collections.synchronizedList(new ArrayList<>());

List<String> messages() {
return messages;
return List.copyOf(messages);
}

MockMTAppender(final String name) throws IllegalAccessException {
Expand Down

0 comments on commit c4091fb

Please sign in to comment.