ARTEMIS-1009 Fixing compatibility

there was an issue with running older clients
Found by this testsuite:

https://github.com/clebertsuconic/messaging-versioning

this will fix further compatibility issues
This commit is contained in:
Clebert Suconic 2017-03-06 17:19:35 -05:00
parent 973c519217
commit 94b47e370b
3 changed files with 4 additions and 2 deletions

View File

@ -514,7 +514,7 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage {
// so we always need to take the BUFFER_HEADER_SPACE from packet impl into consideration // so we always need to take the BUFFER_HEADER_SPACE from packet impl into consideration
endOfBodyPosition = writableBuffer.writerIndex() + BUFFER_HEADER_SPACE - 4; endOfBodyPosition = writableBuffer.writerIndex() + BUFFER_HEADER_SPACE - 4;
} else if (endOfBodyPosition <= 0) { } else if (endOfBodyPosition <= 0) {
endOfBodyPosition = BUFFER_HEADER_SPACE; endOfBodyPosition = BUFFER_HEADER_SPACE + DataConstants.SIZE_INT;
} }
buffer.setIndex(0, 0); buffer.setIndex(0, 0);

View File

@ -197,7 +197,7 @@ public class CoreMessageTest {
empty2.receiveBuffer(buffer); empty2.receiveBuffer(buffer);
try { try {
empty2.getBodyBuffer().readByte(); empty2.getBodyBuffer().readLong();
Assert.fail("should throw exception"); Assert.fail("should throw exception");
} catch (Exception expected) { } catch (Exception expected) {

View File

@ -190,6 +190,8 @@ public class ConsumerTest extends ActiveMQTestBase {
Assert.assertEquals("hi", message2.getReadOnlyBodyBuffer().readString()); Assert.assertEquals("hi", message2.getReadOnlyBodyBuffer().readString());
Assert.assertNull(consumer.receiveImmediate());
session.close(); session.close();
} }