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


##########
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java:
##########
@@ -825,8 +826,14 @@ protected ReadableBuffer createDeliveryCopy(int 
deliveryCount, DeliveryAnnotatio
       }
 
       writeDeliveryAnnotationsForSendBuffer(result, deliveryAnnotations);
-      // skip existing delivery annotations of the original message
-      duplicate.position(encodedHeaderSize + encodedDeliveryAnnotationsSize);
+
+      if (headerPosition > deliveryAnnotationsPosition && headerPosition != 
VALUE_NOT_PRESENT && deliveryAnnotationsPosition != VALUE_NOT_PRESENT) {
+         // this is for a case where delivery annotations was swiched wrongly 
in a previous version
+         duplicate.position(deliveryAnnotationsPosition + 
encodedDeliveryAnnotationsSize);

Review Comment:
   I dont understand the issue to the extent you do, but if from the comment in 
the code you are saying the sections were reversed, then the code as-is simply 
does not seem correct. If they were something more than reversed, its not clear 
to me it could be handled. (Its not clear to me that it should be trying at 
all, its basically a corrupted message).
   
   The tests also passed before, so that may just mean you dont have a focused 
enough test yet. I probably wouldnt be using Qpid JMS to ultimately check this 
either, it should be verifying/decoding the payload more closely. Arguably this 
should be more easily unit testable given its in the message object.
   



-- 
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]

Reply via email to