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
This commit is contained in:
Clebert Suconic 2022-04-14 17:12:39 -04:00
parent f4bdacbc4c
commit d0036ee0cc
1 changed files with 9 additions and 2 deletions

View File

@ -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);
}
}
}