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

(cherry picked from commit 0a042964c8)
This commit is contained in:
Matt Pavlovich 2023-05-17 10:27:31 -05:00 committed by Christopher L. Shannon (cshannon)
parent 53f2b4a0cb
commit 3d21425d37
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);
}