activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-1941 fix failing tests
Date Mon, 09 Jul 2018 21:40:55 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master ae29edf1b -> 8989da1a6


ARTEMIS-1941 fix failing tests


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/e2bae785
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/e2bae785
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/e2bae785

Branch: refs/heads/master
Commit: e2bae7856d414a6c8012eee20197451f378fd389
Parents: ae29edf
Author: Justin Bertram <jbertram@apache.org>
Authored: Fri Jul 6 10:14:48 2018 -0500
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Mon Jul 9 17:35:51 2018 -0400

----------------------------------------------------------------------
 .../protocol/amqp/converter/CoreAmqpConverter.java        |  9 ++++++---
 .../message/JMSMappingOutboundTransformerTest.java        | 10 +++++-----
 2 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e2bae785/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
index eb20219..b287d0c 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
@@ -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);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e2bae785/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/message/JMSMappingOutboundTransformerTest.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/message/JMSMappingOutboundTransformerTest.java
b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/message/JMSMappingOutboundTransformerTest.java
index f1cd588..565f67b 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/message/JMSMappingOutboundTransformerTest.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/message/JMSMappingOutboundTransformerTest.java
@@ -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 -------------------------------------------//


Mime
View raw message