oscerd opened a new pull request, #26544: URL: https://github.com/apache/camel/pull/26544
Fixes [CAMEL-24792](https://issues.apache.org/jira/browse/CAMEL-24792). ## Problem `Ddb2JsonDataTypeTransformer.setHeaderIfNotPresent(String, Object, Message)` does not do what its name says — the body is an unconditional `setHeader` with no presence check: ```java private void setHeaderIfNotPresent(String headerName, Object value, Message message) { message.setHeader(headerName, value); } ``` It has been this way since the method was introduced in 2023 (`253abbee58e6`). All three call sites pass `Ddb2Constants.RETURN_VALUES`, so a `CamelAwsDdbReturnValues` header set by the route before the transformer runs is silently replaced by the transformer default — `ALL_OLD` for `PutItem`/`DeleteItem`, `ALL_NEW` for `UpdateItem`. There is currently no way to select a different `ReturnValue` through the transformer. ## Change Add the missing presence check so an explicitly set header wins, matching the method name and the evident intent. A `null` header value is treated as absent, so the default still applies in that case and downstream `AbstractDdbCommand.determineReturnValues()` cannot start seeing a null where it previously saw a default. The defaults are unchanged when the header is absent — the existing tests that assert them still pass untouched. ## Tests Three new tests in `Ddb2JsonDataTypeTransformerTest`, one per operation, asserting an explicitly set `CamelAwsDdbReturnValues` survives the transform. Verified they fail without the production change (3 failures) and pass with it. Full module suite: 68 tests, 0 failures. Kept in the module's existing JUnit `Assertions` style rather than introducing AssertJ as an outlier, per the project guidelines. ## Docs Behaviour change noted in the 4.23 upgrade guide. 🤖 Generated with [Claude Code](https://claude.com/claude-code) _Claude Code on behalf of oscerd_ -- 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]
