oscerd opened a new pull request, #25153:
URL: https://github.com/apache/camel/pull/25153

   Child of CAMEL-24261 (completing CAMEL-23462 across the AWS2 producers).
   
   ## Problem
   
   With `pojoRequest=true`, `STS2Producer` expects the body to be the AWS SDK
   request for the operation. Each branch has the shape:
   
   ```java
   if (getConfiguration().isPojoRequest()) {
       Object payload = exchange.getIn().getMandatoryBody();
       if (payload instanceof AssumeRoleRequest request) {
           ... call AWS, set response ...
       }
       // no else: a wrong-typed body falls straight through
   }
   ```
   
   If the body is not the expected type, the `instanceof` is false, the branch 
is
   skipped, and the method returns without calling STS or setting a response — 
the
   caller silently gets the original body back and no error. Reproduced for all
   three operations (`assumeRole`, `getSessionToken`, `getFederationToken`).
   
   ## Fix
   
   Add the missing `else` that throws `IllegalArgumentException` naming the 
required
   request type, exactly as CAMEL-23462 did for `camel-aws-bedrock`:
   
   ```java
   } else {
       throw new IllegalArgumentException(
               "assumeRole operation requires AssumeRoleRequest in POJO mode");
   }
   ```
   
   ## Tests
   
   Three tests in `STS2ProducerTest` send a wrong-typed body to a 
`pojoRequest=true`
   route and assert the `IllegalArgumentException` message. Each was verified to
   fail (silent no-op) before the fix. Full class 7/7 green.
   
   ## Docs
   
   Behaviour change → a single 4.22 upgrade-guide entry (`=== camel-aws2 -
   producers now fail fast on a wrong POJO request type`) covering the whole
   CAMEL-24261 roll-out; subsequent per-component PRs won't re-add it.
   
   ## Backport
   
   Main only, matching CAMEL-23462 (which shipped in 4.21.0 and was not 
backported)
   — this is a behaviour change, not a crash fix.
   
   ---
   _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]

Reply via email to