[
https://issues.apache.org/jira/browse/CAMEL-24261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18101377#comment-18101377
]
Andrea Cosentino commented on CAMEL-24261:
------------------------------------------
All producers in the sweep now have a child sub-task with a PR (main only, per
the CAMEL-23462 precedent). 191 pojo-mode branches across 17 producers/modules
covered:
* CAMEL-24263 sts (3) — #25153
* CAMEL-24264 translate (1) — #25158
* CAMEL-24277 msk (4) — #25170
* CAMEL-24280 mq (6) — #25184
* CAMEL-24283 comprehend (9) — #25194
* CAMEL-24285 polly (9) — #25199
* CAMEL-24289 textract (9) — #25210
* CAMEL-24300 ec2 (9) — #25215
* CAMEL-24302 timestream (26) — #25220
* CAMEL-24303 redshift (10) — #25227
* CAMEL-24304 step-functions (16) — #25229
* CAMEL-24307 rekognition (27) — #25243
* CAMEL-24316 transcribe (30) — #25250
* CAMEL-24317 eventbridge (1) — #25255
* CAMEL-24324 bedrock agent/agentruntime (4) — #25278
* CAMEL-24326 config (5) — #25305
* CAMEL-24329 s3 (22) — #25311
Each adds the missing else that throws IllegalArgumentException, with a test
(route-based for producers that have a mock harness; Mockito unit test for
eventbridge/bedrock/config/s3 which do not) verified to fail on the silent
no-op before the fix. Shared upgrade-guide entry added with CAMEL-24263.
BedrockProducer (runtime) was already covered by CAMEL-23462 and is excluded.
The umbrella can be resolved once all child PRs are merged.
_Claude Code on behalf of acosentino_
> 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)