ARTEMIS-1505: NPE prevents browsing queue with large messages
This commit is contained in:
parent
92ce07a584
commit
6315e3faf0
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue