jbertram commented on code in PR #4833:
URL: https://github.com/apache/activemq-artemis/pull/4833#discussion_r1526705787
##########
artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java:
##########
@@ -590,9 +591,11 @@ private static ActiveMQMessage
toAMQMessage(MessageReference reference,
}
amqMsg.setCommandId(commandId);
- final SimpleString corrId = getObjectProperty(coreMessage,
SimpleString.class, OpenWireConstants.JMS_CORRELATION_ID_PROPERTY);
- if (corrId != null) {
- amqMsg.setCorrelationId(corrId.toString());
+ final Object correlationID = coreMessage.getCorrelationID();
+ if (correlationID instanceof String || correlationID instanceof
SimpleString) {
+ amqMsg.setCorrelationId(correlationID.toString());
+ } else if (correlationID instanceof byte[]) {
+ amqMsg.setCorrelationId(new String((byte[])correlationID,
StandardCharsets.UTF_8));
Review Comment:
After doing some more testing directly with `new String(byte[])` I see now
why I wasn't able to generate a failure. This is what the JavaDoc for that
method states (in part):
> This method always replaces malformed-input and unmappable-character
sequences with this charset's default replacement string.
So this won't blow up and tank the message conversion even with "not
actually UTF-8 decodable content."
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]