From ff70edd797586f3029abcea7b12cf477675e6142 Mon Sep 17 00:00:00 2001 From: Matt Pavlovich Date: Tue, 4 Aug 2026 10:20:00 -0500 Subject: [PATCH] [#2406] Guard against null region subscriptions in duplicate suppression getRegionSubscriptions returns null when the destination's region is not an AbstractRegion; duplicateSuppressionIsRequired iterated the result unconditionally, throwing NPE on the advisory path and tearing down the bridge. Treat a null view as nothing to compare against. (cherry picked from commit 5b0f3fa822bf1f95540524262117d829d4820507) --- .../DemandForwardingBridgeSupport.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java b/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java index 0ca4cc2fcea..86dda092d42 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java +++ b/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java @@ -1583,17 +1583,21 @@ private boolean duplicateSuppressionIsRequired(DemandSubscription candidate) { } List candidateConsumers = consumerInfo.getNetworkConsumerIds(); + // null when the destination's region is not an AbstractRegion (no + // subscription view available) - nothing to compare against Collection currentSubs = getRegionSubscriptions(consumerInfo.getDestination()); - for (Subscription sub : currentSubs) { - List networkConsumers = sub.getConsumerInfo().getNetworkConsumerIds(); - if (!networkConsumers.isEmpty()) { - if (matchFound(candidateConsumers, networkConsumers)) { - if (isInActiveDurableSub(sub)) { - suppress = false; - } else { - suppress = hasLowerPriority(sub, candidate.getLocalInfo()); + if (currentSubs != null) { + for (Subscription sub : currentSubs) { + List networkConsumers = sub.getConsumerInfo().getNetworkConsumerIds(); + if (!networkConsumers.isEmpty()) { + if (matchFound(candidateConsumers, networkConsumers)) { + if (isInActiveDurableSub(sub)) { + suppress = false; + } else { + suppress = hasLowerPriority(sub, candidate.getLocalInfo()); + } + break; } - break; } } }