activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r584929 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java
Date Mon, 15 Oct 2007 21:36:38 GMT
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 {



Mime
View raw message