This commit is contained in:
Clebert Suconic 2017-11-27 15:01:50 -05:00
commit e71be13f12
1 changed files with 14 additions and 6 deletions

View File

@ -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;
}
}