davsclaus opened a new pull request, #25355:
URL: https://github.com/apache/camel/pull/25355

   ## Backport of #25330
   
   Cherry-pick of #25330 onto `camel-4.18.x`.
   
   **Original PR:** #25330 - CAMEL-24355: Fix NIOConverter.toByteArray for 
fully consumed ByteBuffer
   **Original author:** @atiaomar1978-hub
   **Target branch:** `camel-4.18.x`
   
   ### Original description
   
   Fixes [CAMEL-24355](https://issues.apache.org/jira/browse/CAMEL-24355): 
`NIOConverter.toByteArray(ByteBuffer)` threw `BufferUnderflowException` when 
the buffer was already fully read (`position == limit`), which breaks Kinesis 
KCL dead-letter-queue conversion and similar flows.
   
   - Read bytes with absolute `buffer.get(0, bArray)` so conversion uses `[0, 
limit)` regardless of current position
   - Preserve the original buffer position (no side effect on the input 
`ByteBuffer`)
   - Add tests for fully consumed, partially consumed, empty, and read-only 
buffers, plus `toString`/`toInputStream` paths that delegate to `toByteArray`
   
   ---
   _Claude Code on behalf of davsclaus_


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