You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/04/14 21:16:50 UTC

[activemq-artemis] branch main updated: ARTEMIS-3778 Just avoiding NPE on Expiry Reaper

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new d0036ee0cc ARTEMIS-3778 Just avoiding NPE on Expiry Reaper
d0036ee0cc is described below

commit d0036ee0cc8ad64cf97820ce1e30736b7384ed1d
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Thu Apr 14 17:12:39 2022 -0400

    ARTEMIS-3778 Just avoiding NPE on Expiry Reaper
    
    Added an extra check on null, just in case
    it should not happen, but I preferred adding this clause on the safe side
---
 .../activemq/artemis/core/postoffice/impl/PostOfficeImpl.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

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 94eb81845c..744f41f2b8 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
@@ -1873,8 +1873,15 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
 
          currentQueue = iterator.next();
 
-         // we will expire messages on this queue, once done we move to the next queue
-         currentQueue.expireReferences(this::done);
+         if (currentQueue == null) {
+            logger.debug("iterator.next returned null on ExpiryReaper, giving up iteration");
+            // I don't think this should ever happen, this check should be moot
+            // However I preferred to have this in place just in case
+            iterator = null;
+         } else {
+            // we will expire messages on this queue, once done we move to the next queue
+            currentQueue.expireReferences(this::done);
+         }
       }
    }