You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Andrea Cosentino (Jira)" <ji...@apache.org> on 2026/08/03 16:30:00 UTC
[jira] [Resolved] (CAMEL-24261) camel-aws2: producers silently no-op when pojoRequest=true and the body has the wrong type (complete CAMEL-23462 across all producers)
[ https://issues.apache.org/jira/browse/CAMEL-24261?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrea Cosentino resolved CAMEL-24261.
--------------------------------------
Resolution: Fixed
> camel-aws2: producers silently no-op when pojoRequest=true and the body has the wrong type (complete CAMEL-23462 across all producers)
> --------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24261
> URL: https://issues.apache.org/jira/browse/CAMEL-24261
> Project: Camel
> Issue Type: Bug
> Components: camel-aws
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 4.22.0
>
>
> h3. Summary
> CAMEL-23462 fixed {{BedrockProducer}} so that {{invoke*Model}} throws {{IllegalArgumentException}} instead of silently producing a {{null}} body when {{pojoRequest=true}} and the exchange body is not the expected request type. The *same antipattern* is still present in ~19 other AWS v2 producers, covering *191* operation branches.
> h3. The antipattern
> Every pojo-mode branch has the shape:
> {code:java}
> if (getConfiguration().isPojoRequest()) {
> Object payload = exchange.getIn().getMandatoryBody();
> if (payload instanceof ListBrokersRequest listBrokersRequest) {
> ... call AWS, set response ...
> }
> // <-- no else: a wrong-typed body falls straight through
> } else {
> ... build request from headers ...
> }
> {code}
> If {{pojoRequest=true}} and the body is not the expected request type, the {{instanceof}} is false, the branch is skipped, and the method returns without calling AWS or setting any response. The caller silently gets the *original body back and no error*.
> h4. Reproduced
> Sending a {{String}} body to {{aws2-mq:...?operation=listBrokers&pojoRequest=true}}:
> * {{exchange.getException()}} = {{null}}
> * out body = the original {{String}}, unchanged
> * AWS was never called
> This is the exact behaviour CAMEL-23462 classified as a bug for Bedrock.
> h3. Established fix (from CAMEL-23462)
> Add the missing {{else}} that throws, naming the required type:
> {code:java}
> } else {
> throw new IllegalArgumentException(
> "listBrokers operation requires ListBrokersRequest in POJO mode");
> }
> {code}
> h3. Inventory (silent-fallthrough sites per producer)
> {noformat}
> 30 Transcribe2Producer
> 27 Rekognition2Producer
> 22 AWS2S3Producer
> 16 StepFunctions2Producer
> 16 Timestream2WriteProducer
> 10 RedshiftData2Producer
> 10 Timestream2QueryProducer
> 9 AWS2EC2Producer
> 9 Textract2Producer
> 9 Polly2Producer
> 9 Comprehend2Producer
> 6 MQ2Producer
> 5 AWSConfigProducer
> 4 MSK2Producer
> 3 BedrockAgentProducer
> 3 STS2Producer
> 1 BedrockAgentRuntimeProducer (2 of 3 already fixed)
> 1 EventbridgeProducer
> 1 Translate2Producer
> ---
> 191 sites across 19 producers
> {noformat}
> ({{BedrockProducer}} is already fully fixed by CAMEL-23462 and is excluded.)
> h3. Notes for implementation
> * This is a *user-visible behaviour change* (silent no-op -> {{IllegalArgumentException}}), so it needs an upgrade-guide entry. CAMEL-23462 shipped the same change in a minor (4.21.0).
> * Recommend doing it *per component* (one PR each, mirroring CAMEL-23462) to keep diffs reviewable, rather than one 191-site sweep. This umbrella tracks the whole set.
> * Each message should name the operation and the required request type consistently with the Bedrock wording (\"<operation> operation requires <RequestType> in POJO mode\").
> Raised from an automated audit of the camel-aws components; filing for maintainer agreement on scope/packaging before the sweep.
> ----
> _Reported by Claude Code on behalf of acosentino._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)