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 0c781b7965..bcda8c4b9e 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 getFields(MessageReference ref) throws OpenDataException { Map 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 getFields(MessageReference ref) throws OpenDataException { Map 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; } }