[ARTEMIS-502] AMQ224044, error acknowledging message: 
java.lang.NullPointerException, can happen sometimes during load


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/82019cb3
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/82019cb3
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/82019cb3

Branch: refs/heads/master
Commit: 82019cb3be9092a61a2bfbab041429f9df358e4e
Parents: d947741
Author: Ingo Weiss <[email protected]>
Authored: Mon Apr 25 09:56:51 2016 +0100
Committer: Martyn Taylor <[email protected]>
Committed: Mon Apr 25 14:33:17 2016 +0100

----------------------------------------------------------------------
 .../activemq/artemis/core/server/impl/ServerConsumerImpl.java   | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/82019cb3/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
index 7071da6..fac4cf3 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
@@ -930,6 +930,11 @@ public class ServerConsumerImpl implements ServerConsumer, 
ReadyListener {
 
       synchronized (lock) {
          // This is an optimization, if the reference is the first one, we 
just poll it.
+         // But first we need to make sure deliveringRefs isn't empty
+         if (deliveringRefs.isEmpty()) {
+            return null;
+         }
+
          if (deliveringRefs.peek().getMessage().getMessageID() == messageID) {
             return deliveringRefs.poll();
          }

Reply via email to