From fbfe81eb4d5f3c3c625a9beaa9647b837ed6058a Mon Sep 17 00:00:00 2001 From: Pavel Perikov Date: Tue, 28 Nov 2023 00:19:40 +0400 Subject: [PATCH] ARTEMIS-4581 fix NPE crash in PostOfficeImpl --- .../activemq/artemis/core/postoffice/impl/PostOfficeImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java index 92eb2fadbc6..f241a964afb 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java @@ -1969,7 +1969,9 @@ void reapAddresses(boolean initialCheck) { AddressSettings settings = addressSettingsRepository.getMatch(queue.getAddress().toString()); if (!queue.isInternalQueue() && queue.isAutoDelete() && QueueManagerImpl.consumerCountCheck(queue) && (initialCheck || QueueManagerImpl.delayCheck(queue, settings)) && QueueManagerImpl.messageCountCheck(queue) && (initialCheck || queueWasUsed(queue, settings))) { // we only reap queues on the initialCheck if they are actually empty - boolean validInitialCheck = initialCheck && queue.getMessageCount() == 0 && !queue.getPagingStore().isPaging(); + PagingStore queuePagingStore = queue.getPagingStore(); + boolean isPaging = queuePagingStore != null && queuePagingStore.isPaging(); + boolean validInitialCheck = initialCheck && queue.getMessageCount() == 0 && !isPaging; if (validInitialCheck || queue.isSwept()) { if (logger.isDebugEnabled()) { if (initialCheck) {