gemmellr commented on code in PR #4833:
URL: https://github.com/apache/activemq-artemis/pull/4833#discussion_r1526725736


##########
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:
   Yeah I forgot about that nugget; so instead of blowing up or sending nothing 
it will just send a corrupted representation of the original bytes. Arguably 
worse? :)
   
   Per the next bit of that javadoc, you'd need to actually decode the bytes as 
UTF-8 rather than just creating a String instance with them, so that the 
decoder would instead blow up for garbage rather than substitute. Tim's idea 
for malformed bytes is simple, but as per your link the simplest is actually 
just a single byte that isnt an ASCII char or the multi-byte prefix.



-- 
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: gitbox-unsubscr...@activemq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to