tabish121 commented on code in PR #6323:
URL: https://github.com/apache/artemis/pull/6323#discussion_r3089203199


##########
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPStandardMessage.java:
##########
@@ -198,8 +198,10 @@ public synchronized int getMemoryEstimate() {
    private int getApplicationPropertiesEncodingSize(ReadableBuffer data) {
       ensureScanning();
 
-      // ensureScanning will make sure we know the positions, and we will 
return the encoding used based on those positions
-      if (remainingBodyPosition != VALUE_NOT_PRESENT) {
+      // if still VALUE_NOT_PRESENT, it means we have no application 
properties, we must return 0
+      if (applicationPropertiesPosition == VALUE_NOT_PRESENT) {
+         return 0;
+      } else if (remainingBodyPosition != VALUE_NOT_PRESENT) {
          return remainingBodyPosition - applicationPropertiesPosition;
       } else if (applicationPropertiesPosition != VALUE_NOT_PRESENT) {

Review Comment:
   Since the first if checks if `applicationPropertiesPosition == 
VALUE_NOT_PRESENT` the final else in this conditional is unreachable and you 
can remove it and just have the `return data.capacity() - 
applicationPropertiesPosition;` as the final else case.  



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to