Author: jstrachan
Date: Fri Mar  9 04:48:36 2007
New Revision: 516401

URL: http://svn.apache.org/viewvc?view=rev&rev=516401
Log:
avoid NPE I was getting in the web console

Modified:
    
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java

Modified: 
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java?view=diff&rev=516401&r1=516400&r2=516401
==============================================================================
--- 
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java
 (original)
+++ 
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java
 Fri Mar  9 04:48:36 2007
@@ -163,19 +163,21 @@
             this.ackedLastAckLocations=new 
HashMap<SubscriptionKey,MessageId>();
         }
         Location location=super.doAsyncWrite();
-        transactionTemplate.run(new Callback(){
 
-            public void execute() throws Exception{
-                // Checkpoint the acknowledged messages.
-                Iterator<SubscriptionKey> 
iterator=cpAckedLastAckLocations.keySet().iterator();
-                while(iterator.hasNext()){
-                    SubscriptionKey subscriptionKey=iterator.next();
-                    MessageId 
identity=cpAckedLastAckLocations.get(subscriptionKey);
-                    
topicReferenceStore.acknowledge(transactionTemplate.getContext(),subscriptionKey.clientId,
-                            subscriptionKey.subscriptionName,identity);
+        if (cpAckedLastAckLocations != null) {
+            transactionTemplate.run(new Callback() {
+                public void execute() throws Exception {
+                    // Checkpoint the acknowledged messages.
+                    Iterator<SubscriptionKey> iterator = 
cpAckedLastAckLocations.keySet().iterator();
+                    while (iterator.hasNext()) {
+                        SubscriptionKey subscriptionKey = iterator.next();
+                        MessageId identity = 
cpAckedLastAckLocations.get(subscriptionKey);
+                        
topicReferenceStore.acknowledge(transactionTemplate.getContext(), 
subscriptionKey.clientId,
+                                subscriptionKey.subscriptionName, identity);
+                    }
                 }
-            }
-        });
+            });
+        }
         return location;
     }
 


Reply via email to