From a62add45e7276bb767cd19082c7dd38404c117b6 Mon Sep 17 00:00:00 2001 From: Matt Pavlovich Date: Wed, 17 May 2023 10:27:31 -0500 Subject: [PATCH] [AMQ-9258] Add NPE guards to kahadb test that intermittently fails on slower CI servers (#1006) (cherry picked from commit 0a042964c8e0d8c5f694728ded6d278810756bc7) --- .../kahadb/JournalCorruptionEofIndexRecoveryTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java index 0033e0b2c7..da89e5fd83 100644 --- a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java +++ b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java @@ -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); }