CAMEL-24277: camel-aws2-msk - throw when pojoRequest=true and the body is the wrong type - #25170
Merged
Merged
Conversation
…y is the wrong type Child of CAMEL-24261. MSK2Producer's listClusters, createCluster, deleteCluster and describeCluster branches only acted when the body was the matching request type under pojoRequest=true; any other body silently fell through with no AWS call and no error. Add the missing else that throws IllegalArgumentException naming the required type, consistent with CAMEL-23462. Tests send a wrong-typed body to pojoRequest=true routes and assert the message; each was verified to fail (silent no-op) before the fix. The shared 4.22 upgrade-guide entry was added with CAMEL-24263. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Contributor
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 9 tested, 29 compile-only — current: 9 all testedMaveniverse Scalpel detected 38 affected modules (current approach: 9).
|
davsclaus
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Child of CAMEL-24261 (completing CAMEL-23462 across the AWS2 producers).
Problem
With
pojoRequest=true,MSK2Producer'slistClusters,createCluster,deleteClusteranddescribeClusterbranches only acted when the body was thematching request type; any other body fell through the
instanceofwith noelse, so no AWS call was made, no response was set, and the original body wasreturned with no error.
Fix
Each branch now throws
IllegalArgumentExceptionnaming the required requesttype, e.g.:
Tests
Four tests in
MSKProducerTestsend a wrong-typed body topojoRequest=trueroutes (reusing the module's
AmazonMSKClientMock) and assert the message. Eachwas verified to fail (silent no-op) before the fix — the
createClusterone, forexample, reports "Expecting code to raise a throwable" on
main. Class 10/10 green.These are hermetic unit tests against the in-JVM mock client (run region-free) —
no localstack or real AWS.
Docs / backport
The shared 4.22 upgrade-guide entry was added with CAMEL-24263. Main only, matching
the CAMEL-23462 precedent (behaviour change, shipped in a minor, not backported).
Claude Code on behalf of oscerd