ARTEMIS-4581 fix NPE crash in PostOfficeImpl

This commit is contained in:
Pavel Perikov 2023-11-28 00:19:40 +04:00 committed by Clebert Suconic
parent 6f6c5723d5
commit fbfe81eb4d
1 changed files with 3 additions and 1 deletions

View File

@ -1969,7 +1969,9 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
AddressSettings settings = addressSettingsRepository.getMatch(queue.getAddress().toString()); 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))) { 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 // 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 (validInitialCheck || queue.isSwept()) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
if (initialCheck) { if (initialCheck) {