From 934fe24e5c03f4801e8a3934cc02bbc10f0325ff Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Mon, 22 Apr 2024 13:07:07 -0500 Subject: [PATCH] ARTEMIS-4734 mitigate NPE in ReplicationManager --- .../activemq/artemis/core/replication/ReplicationManager.java | 3 +++ .../activemq/artemis/core/server/ActiveMQMessageBundle.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java index f6402bfe55..9bbbf46e3a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java @@ -462,6 +462,9 @@ public final class ReplicationManager implements ActiveMQComponent { } final OperationContext repliToken = OperationContextImpl.getContext(ioExecutorFactory); + if (repliToken == null) { + throw ActiveMQMessageBundle.BUNDLE.replicationFailureRepliTokenNull(packet.toString(), ioExecutorFactory.toString()); + } if (lineUp) { repliToken.replicationLineUp(); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java index bf2cf7491c..63f3956bab 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java @@ -548,4 +548,7 @@ public interface ActiveMQMessageBundle { @Message(id = 229252, value = "Invalid HAPolicy property: {}") RuntimeException unsupportedHAPolicyPropertyType(String invalidHAPolicy); + + @Message(id = 229253, value = "Unable to acquire OperationContext when replicating packet: {}. ExecutorFactory: {}") + IllegalStateException replicationFailureRepliTokenNull(String packet, String executorFactory); }