oscerd opened a new pull request, #26781: URL: https://github.com/apache/camel/pull/26781
## What `NettyConverter.toByteArray(ByteBuf, Exchange)` had a fast path returning `buffer.array()` for array-backed buffers. `buffer.array()` returns the whole backing array, which does not necessarily match the buffer's readable region — it ignores `arrayOffset()`, `readerIndex()` and `readableBytes()`. For a shared or pooled backing array that can include bytes outside this buffer's own slice, and it also hands back a reference to a buffer that may later be reused. This drops the shortcut and always copies exactly the readable region (`readableBytes()` from `readerIndex()`) — the same thing the non-array branch already did — so the conversion is consistent regardless of the underlying allocator (heap/direct, pooled/unpooled). The shared converter is also used by `camel-netty-http`, `camel-hl7`, `camel-lumberjack` and `camel-syslog`, so they benefit too. ## Test Added a regression test that converts an array-backed (heap) buffer whose backing array is larger than the readable region and whose reader index has been advanced past a prefix, asserting only the readable bytes are returned. `mvn clean install` on `camel-netty` is green. JIRA: https://issues.apache.org/jira/browse/CAMEL-24936 _Claude Code on behalf of oscerd_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
