cshannon opened a new pull request, #2256:
URL: https://github.com/apache/activemq/pull/2256

   This fixes the AmqpMessageSupport utility to correctly decompress the body 
of Object Message's in all cases.
   
   Previously the decompression could stop early and not decompress the entire 
stream of data. This was due to the loop incorrectly casting the read int from 
the inflater stream as a byte before comparing to -1 to look for end of stream.
   
   This is incorrect because the read() method can return a value between -1 
and 255. Java uses Two's Complement to represent signed ints, so if the 
returned value int is 255 and is cast to a byte it becomes -1. This meant that 
reading 255 would return -1 leading to the code to exit thinking end of stream 
has been reached.
   
   This was discovered when I as was looking into the "flaky" test error for 
https://github.com/apache/activemq/issues/2238, 
`JMSInteroperabilityTest.testOpenWireToQpidObjectMessageWithOpenWireCompression:493
 ยป MessageFormat Failed to read object: null`
   
   Turns out, the test was not flaky but showed a real error. The test uses a 
random UUID, so by the test would intermittently fail depending on if the UUID 
decompression ran into a 255 int or not.


-- 
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]
For further information, visit: https://activemq.apache.org/contact


Reply via email to