added better exception message

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@390379 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-03-31 09:31:57 +00:00
parent a38a90657b
commit d68fe55933
1 changed files with 4 additions and 3 deletions

View File

@ -197,9 +197,10 @@ public class ActiveMQInputStream extends InputStream implements ActiveMQDispatch
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 @@ public class ActiveMQInputStream extends InputStream implements ActiveMQDispatch
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);
}
}