activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r390379 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQInputStream.java
Date Fri, 31 Mar 2006 09:31:59 GMT
Author: jstrachan
Date: Fri Mar 31 01:31:57 2006
New Revision: 390379

URL: http://svn.apache.org/viewcvs?rev=390379&view=rev
Log:
added better exception message

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQInputStream.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQInputStream.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQInputStream.java?rev=390379&r1=390378&r2=390379&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQInputStream.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQInputStream.java
Fri Mar 31 01:31:57 2006
@@ -197,9 +197,10 @@
                 ActiveMQMessage m = receive();
                 if( m!=null && m.getDataStructureType() == CommandTypes.ACTIVEMQ_BYTES_MESSAGE
) {
                     // First message.
+                    long producerSequenceId = m.getMessageId().getProducerSequenceId();
                     if( producerId == null ) {
                         // We have to start a stream at sequence id = 0
-                        if( m.getMessageId().getProducerSequenceId()!=0 ) {
+                        if( producerSequenceId!=0 ) {
                             continue;
                         }
                         nextSequenceId++;
@@ -209,8 +210,8 @@
                         if( !m.getMessageId().getProducerId().equals(producerId) ) {
                             throw new IOException("Received an unexpected message: invalid
producer: "+m);
                         }
-                        if( m.getMessageId().getProducerSequenceId()!=nextSequenceId++ )
{
-                            throw new IOException("Received an unexpected message: invalid
sequence id: "+m);
+                        if( producerSequenceId!=nextSequenceId++ ) {
+                            throw new IOException("Received an unexpected message: expected
ID: " + (nextSequenceId - 1)  +  " but was: " + producerSequenceId + " for message: "+m);
                         }
                     }
                     



Mime
View raw message