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

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 6a25286  Fix null MessageId may be passed to its compareTo() method 
(#11607)
6a25286 is described below

commit 6a25286a5e0127e0a051cde48a056148860351b2
Author: Yunze Xu <xyzinfern...@163.com>
AuthorDate: Tue Aug 10 03:46:34 2021 +0800

    Fix null MessageId may be passed to its compareTo() method (#11607)
---
 .../pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java
 
b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java
index 0f34e08..21ef9b3 100644
--- 
a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java
+++ 
b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java
@@ -115,10 +115,11 @@ public class PersistentAcknowledgmentsGroupingTracker 
implements Acknowledgments
      */
     @Override
     public boolean isDuplicate(@NonNull MessageId messageId) {
-        if (lastCumulativeAck.messageId == null) {
+        final MessageId messageIdOfLastAck = lastCumulativeAck.messageId;
+        if (messageIdOfLastAck == null) {
             return false;
         }
-        if (messageId.compareTo(lastCumulativeAck.messageId) <= 0) {
+        if (messageId.compareTo(messageIdOfLastAck) <= 0) {
             // Already included in a cumulative ack
             return true;
         } else {

Reply via email to