aherbert opened a new pull request #32: [codec-259] Hex: consume all 
ByteBuffer.remaining() bytes
URL: https://github.com/apache/commons-codec/pull/32
 
 
   The use of ByteBuffer.array() for any array-backed buffers means that the 
Hex class can produce incorrect results if the backing array is not entirely 
filled with the data to encode/decode.
   
   This fixes the implementation by only using the backing array if the length 
is equal to the reported capacity. Otherwise the methods using ByteBuffer 
default to copying the remaining bytes into a copy array.
   
   The code has been documented as using all remaining bytes in the input 
ByteBuffer. The methods now handle input array backed ByteBuffers and directly 
allocated ByteBuffers equally.
   
   Tests have been added using limits on the buffer to encode/decode a 
sub-section of the bytes.
   
   The tests have been updated so all tests are run with a direct allocated 
ByteBuffer in AllocateDirectHexTest.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to