From fb915c3dc63940c54129ff2d516cedee050eab6e Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Mon, 16 Apr 2012 17:34:00 +0000 Subject: [PATCH] Fix for https://issues.apache.org/jira/browse/AMQ-3804 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1326692 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/store/kahadb/MessageDatabase.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java index 39f78d3e9d..1d33f2da6a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java @@ -2002,12 +2002,14 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe // Check if the message is reference by any other subscription. Long count = sd.messageReferences.get(messageSequence); + if (count != null){ long references = count.longValue() - 1; - if (references > 0) { - sd.messageReferences.put(messageSequence, Long.valueOf(references)); - return; - } else { - sd.messageReferences.remove(messageSequence); + if (references > 0) { + sd.messageReferences.put(messageSequence, Long.valueOf(references)); + return; + } else { + sd.messageReferences.remove(messageSequence); + } } // Find all the entries that need to get deleted.