You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2007/10/15 23:36:38 UTC

svn commit: r584929 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java

Author: rajdavies
Date: Mon Oct 15 14:36:37 2007
New Revision: 584929

URL: http://svn.apache.org/viewvc?rev=584929&view=rev
Log:
fix for npe

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

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java?rev=584929&r1=584928&r2=584929&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java Mon Oct 15 14:36:37 2007
@@ -379,14 +379,17 @@
      */
     public Message getMessage(MessageId identity) throws IOException {
         Location location = getLocation(identity);
-        DataStructure rc = peristenceAdapter.readCommand(location);
-        try {
-            return (Message) rc;
-        } catch (ClassCastException e) {
-            throw new IOException("Could not read message " + identity
-                    + " at location " + location
-                    + ", expected a message, but got: " + rc);
+        if (location != null) {
+            DataStructure rc = peristenceAdapter.readCommand(location);
+            try {
+                return (Message) rc;
+            } catch (ClassCastException e) {
+                throw new IOException("Could not read message " + identity
+                        + " at location " + location
+                        + ", expected a message, but got: " + rc);
+            }
         }
+        return null;
     }
     
     protected Location getLocation(MessageId messageId) throws IOException {