Skip to content

Commit

Permalink
Return a copy of messages in MockMTAppender (#94982) (#95004)
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 #94559
  • Loading branch information
pxsalehi committed Apr 4, 2023
1 parent 64f77a9 commit f7baae9
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 f7baae9

Please sign in to comment.