CAMEL-24285: camel-aws2-polly - throw when pojoRequest=true and the body is the wrong type - #25199
Open
oscerd wants to merge 1 commit into
Open
CAMEL-24285: camel-aws2-polly - throw when pojoRequest=true and the body is the wrong type#25199oscerd wants to merge 1 commit into
oscerd wants to merge 1 commit into
Conversation
…ody is the wrong type Child of CAMEL-24261. Polly2Producer's nine operations (synthesizeSpeech, describeVoices, listLexicons, getLexicon, putLexicon, deleteLexicon, startSpeechSynthesisTask, getSpeechSynthesisTask, listSpeechSynthesisTasks) 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. A parameterized test covers all nine operations; 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>
davsclaus
approved these changes
Jul 28, 2026
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
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,Polly2Producer's nine operations only acted when thebody was the matching request type; any other body fell through the
instanceofwith no
else, so no AWS call was made, no response was set, and the originalbody was returned with no error.
Fix
Each branch now throws
IllegalArgumentExceptionnaming the required requesttype, e.g.
"getLexicon operation requires GetLexiconRequest in POJO mode".Tests
A
@ParameterizedTestcovers all nine operations, sending a wrong-typed body topojoRequest=trueroutes and asserting each message. Verified to fail (silentno-op) before the fix — with the
getLexiconelse removed, exactly that casereports "Expecting code to raise a throwable". Class 20/20 green. Hermetic unit
tests, 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