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 da89e5fd83..d12474523a 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 @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.io.EOFException; import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -239,14 +240,20 @@ public class JournalCorruptionEofIndexRecoveryTest { final var appender = new AbstractAppender("testAppender", new AbstractFilter() {}, new MessageLayout(), false, new Property[0]) { @Override public void append(LogEvent event) { + /** + * NOTE: As of JDK v11.0.19 RandomAccessFile throws a messageless EOFException when read fails + * + * throw new EOFException(); + */ 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")) { + && event.getThrown() instanceof EOFException + && event.getThrown().getMessage() == null) { + trappedExpectedLogMessage.set(true); } } @@ -263,6 +270,8 @@ public class JournalCorruptionEofIndexRecoveryTest { } assertEquals("no missing message", 50, broker.getAdminView().getTotalMessageCount()); + assertEquals("Drain", 50, drainQueue(50)); + assertEquals("no problem draining messages", 0, broker.getAdminView().getTotalMessageCount()); assertTrue("Did replay records on invalid location size", trappedExpectedLogMessage.get()); }