mirror of https://github.com/apache/activemq.git
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:
parent
a38a90657b
commit
d68fe55933
|
@ -197,9 +197,10 @@ public class ActiveMQInputStream extends InputStream implements ActiveMQDispatch
|
||||||
ActiveMQMessage m = receive();
|
ActiveMQMessage m = receive();
|
||||||
if( m!=null && m.getDataStructureType() == CommandTypes.ACTIVEMQ_BYTES_MESSAGE ) {
|
if( m!=null && m.getDataStructureType() == CommandTypes.ACTIVEMQ_BYTES_MESSAGE ) {
|
||||||
// First message.
|
// First message.
|
||||||
|
long producerSequenceId = m.getMessageId().getProducerSequenceId();
|
||||||
if( producerId == null ) {
|
if( producerId == null ) {
|
||||||
// We have to start a stream at sequence id = 0
|
// We have to start a stream at sequence id = 0
|
||||||
if( m.getMessageId().getProducerSequenceId()!=0 ) {
|
if( producerSequenceId!=0 ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
nextSequenceId++;
|
nextSequenceId++;
|
||||||
|
@ -209,8 +210,8 @@ public class ActiveMQInputStream extends InputStream implements ActiveMQDispatch
|
||||||
if( !m.getMessageId().getProducerId().equals(producerId) ) {
|
if( !m.getMessageId().getProducerId().equals(producerId) ) {
|
||||||
throw new IOException("Received an unexpected message: invalid producer: "+m);
|
throw new IOException("Received an unexpected message: invalid producer: "+m);
|
||||||
}
|
}
|
||||||
if( m.getMessageId().getProducerSequenceId()!=nextSequenceId++ ) {
|
if( producerSequenceId!=nextSequenceId++ ) {
|
||||||
throw new IOException("Received an unexpected message: invalid sequence id: "+m);
|
throw new IOException("Received an unexpected message: expected ID: " + (nextSequenceId - 1) + " but was: " + producerSequenceId + " for message: "+m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue