[1/2] activemq-artemis git commit: ARTEMIS-1505: NPE prevents browsing queue with large messages

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[1/2] activemq-artemis git commit: ARTEMIS-1505: NPE prevents browsing queue with large messages

clebertsuconic-2
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 92ce07a58 -> e71be13f1


ARTEMIS-1505: NPE prevents browsing queue with large messages


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

Branch: refs/heads/master
Commit: 6315e3faf010c198d173ca406db278b17eab9d29
Parents: 92ce07a
Author: saurabhrai <[hidden email]>
Authored: Mon Nov 27 13:01:04 2017 +0530
Committer: Clebert Suconic <[hidden email]>
Committed: Mon Nov 27 15:01:34 2017 -0500

----------------------------------------------------------------------
 .../impl/openmbean/OpenTypeSupport.java         | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6315e3fa/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/openmbean/OpenTypeSupport.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/openmbean/OpenTypeSupport.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/openmbean/OpenTypeSupport.java
index 0c781b7..bcda8c4 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/openmbean/OpenTypeSupport.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/openmbean/OpenTypeSupport.java
@@ -267,10 +267,14 @@ public final class OpenTypeSupport {
       public Map<String, Object> getFields(MessageReference ref) throws OpenDataException {
          Map<String, Object> rc = super.getFields(ref);
          ICoreMessage m = ref.getMessage().toCore();
-         ActiveMQBuffer bodyCopy = m.getReadOnlyBodyBuffer();
-         byte[] bytes = new byte[bodyCopy.readableBytes()];
-         bodyCopy.readBytes(bytes);
-         rc.put(CompositeDataConstants.BODY, bytes);
+         if (!m.isLargeMessage()) {
+            ActiveMQBuffer bodyCopy = m.getReadOnlyBodyBuffer();
+            byte[] bytes = new byte[bodyCopy.readableBytes()];
+            bodyCopy.readBytes(bytes);
+            rc.put(CompositeDataConstants.BODY, bytes);
+         } else {
+            rc.put(CompositeDataConstants.BODY, new byte[0]);
+         }
          return rc;
       }
    }
@@ -288,8 +292,12 @@ public final class OpenTypeSupport {
       public Map<String, Object> getFields(MessageReference ref) throws OpenDataException {
          Map<String, Object> rc = super.getFields(ref);
          ICoreMessage m = ref.getMessage().toCore();
-         SimpleString text = m.getReadOnlyBodyBuffer().readNullableSimpleString();
-         rc.put(CompositeDataConstants.TEXT_BODY, text != null ? text.toString() : "");
+         if (!m.isLargeMessage()) {
+            SimpleString text = m.getReadOnlyBodyBuffer().readNullableSimpleString();
+            rc.put(CompositeDataConstants.TEXT_BODY, text != null ? text.toString() : "");
+         } else {
+            rc.put(CompositeDataConstants.TEXT_BODY, "");
+         }
          return rc;
       }
    }

Reply | Threaded
Open this post in threaded view
|

[2/2] activemq-artemis git commit: This closes #1670

clebertsuconic-2
This closes #1670


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

Branch: refs/heads/master
Commit: e71be13f12bd48111076212c669d0434e0b52cdc
Parents: 92ce07a 6315e3f
Author: Clebert Suconic <[hidden email]>
Authored: Mon Nov 27 15:01:50 2017 -0500
Committer: Clebert Suconic <[hidden email]>
Committed: Mon Nov 27 15:01:50 2017 -0500

----------------------------------------------------------------------
 .../impl/openmbean/OpenTypeSupport.java         | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------