[AMQ-9258] Add NPE guards to kahadb test that intermittently fails on slower CI servers (#1006)

This commit is contained in:
Matt Pavlovich 2023-05-17 10:27:31 -05:00 committed by GitHub
parent 44ad644938
commit 0a042964c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -239,8 +239,13 @@ public class JournalCorruptionEofIndexRecoveryTest {
final var appender = new AbstractAppender("testAppender", new AbstractFilter() {}, new MessageLayout(), false, new Property[0]) {
@Override
public void append(LogEvent event) {
if (event.getLevel() == Level.WARN
if (event != null
&& event.getLevel() == Level.WARN
&& event.getMessage() != null
&& event.getMessage().getFormattedMessage() != null
&& event.getMessage().getFormattedMessage().contains("Cannot recover message audit")
&& event.getThrown() != null
&& event.getThrown().getLocalizedMessage() != null
&& event.getThrown().getLocalizedMessage().contains("Invalid location size")) {
trappedExpectedLogMessage.set(true);
}