[
https://issues.apache.org/jira/browse/ARTEMIS-4657?focusedWorklogId=910169&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-910169
]
ASF GitHub Bot logged work on ARTEMIS-4657:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 15/Mar/24 18:59
Start Date: 15/Mar/24 18:59
Worklog Time Spent: 10m
Work Description: 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](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#%3Cinit%3E(byte%5B%5D))
(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."
For reference, [here's some of the malformed
bytes](https://github.com/openjdk/jdk/blob/master/test/jdk/sun/nio/cs/TestUTF8.java#L266)
I tried.
Issue Time Tracking
-------------------
Worklog Id: (was: 910169)
Time Spent: 4h 50m (was: 4h 40m)
> Support correlation ID compatibility between JMS clients
> --------------------------------------------------------
>
> Key: ARTEMIS-4657
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4657
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Reporter: Justin Bertram
> Assignee: Justin Bertram
> Priority: Major
> Time Spent: 4h 50m
> Remaining Estimate: 0h
>
> Currently there are some use-cases with both {{String}} and {{byte[]}} values
> of JMS correlation ID that don't work between Core, OpenWire, and AMQP. We
> should support as many as possible.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)