ARTEMIS-1941 fix failing tests

This commit is contained in:
Justin Bertram 2018-07-06 10:14:48 -05:00 committed by Timothy Bish
parent ae29edf1bd
commit e2bae7856d
2 changed files with 11 additions and 8 deletions

View File

@ -451,9 +451,12 @@ public class CoreAmqpConverter {
// this will represent a readOnly buffer for the message
ActiveMQBuffer buffer = internalMessage.getDataBuffer();
try {
Object s = buffer.readNullableSimpleString();
if (s != null) {
body = new AmqpValue(s.toString());
// the buffer may be completely empty (e.g. if the original AMQP message had a null body)
if (buffer.readableBytes() > 0) {
Object s = buffer.readNullableSimpleString();
if (s != null) {
body = new AmqpValue(s.toString());
}
}
} catch (Throwable ignored) {
logger.debug("Exception ignored during conversion", ignored.getMessage(), ignored);

View File

@ -341,11 +341,11 @@ public class JMSMappingOutboundTransformerTest {
Message amqp = AMQPConverter.getInstance().fromCore(outbound.getInnerMessage()).getProtonMessage();
assertNotNull(amqp.getBody());
assertTrue(amqp.getBody() instanceof Data);
assertTrue(((Data) amqp.getBody()).getValue() instanceof Binary);
assertFalse(0 == ((Binary) ((Data) amqp.getBody()).getValue()).getLength());
assertTrue(amqp.getBody() instanceof AmqpValue);
assertTrue(((AmqpValue) amqp.getBody()).getValue() instanceof Binary);
assertFalse(0 == ((Binary) ((AmqpValue) amqp.getBody()).getValue()).getLength());
Object value = deserialize((((Data) amqp.getBody()).getValue()).getArray());
Object value = deserialize(((Binary) ((AmqpValue) amqp.getBody()).getValue()).getArray());
assertNotNull(value);
assertTrue(value instanceof UUID);
}
@ -361,7 +361,7 @@ public class JMSMappingOutboundTransformerTest {
assertNotNull(amqp.getBody());
assertTrue(amqp.getBody() instanceof AmqpValue);
assertTrue(((AmqpValue) amqp.getBody()).getValue() instanceof Binary);
assertEquals(0, ((Binary) ((AmqpValue) amqp.getBody()).getValue()).getLength());
assertEquals(5, ((Binary) ((AmqpValue) amqp.getBody()).getValue()).getLength());
}
// ----- TextMessage type tests -------------------------------------------//