oscerd opened a new pull request, #25060:
URL: https://github.com/apache/camel/pull/25060
## Problem
Three AWS v2 producers throw `IllegalArgumentException` with a message that
was
copy-pasted from a neighbouring check and never updated, so it names the
wrong
parameter. A user who omits a required header is told to supply a
*different* one.
**camel-aws2-msk — `MSK2Producer.createCluster`**
The missing broker-nodes-number check reused the Kafka-version message:
```java
} else {
throw new IllegalArgumentException("Kafka Version must be specified");
// broker-nodes count is missing
}
```
**camel-aws2-mq — `MQ2Producer`**
`MISSING_BROKER_NAME = "Broker Name must be specified"` is correct only for
`createBroker` (which takes a broker *name*). It was also thrown for the
broker
*id* checks in `deleteBroker`, `rebootBroker`, `updateBroker` and
`describeBroker`, and for the `configurationId` check in `updateBroker` —
all of
which take an id, not a name.
**camel-aws2-sts — `STS2Producer.getFederationToken`**
The missing federated-name check carried the wrong operation name:
```java
throw new IllegalArgumentException("Federated name needs to be specified for
assumeRole operation");
```
## Impact
No functional misbehaviour, but the diagnostics actively mislead — calling
`createCluster` without a broker-node count reports "Kafka Version must be
specified" even though the Kafka version was supplied; calling `updateBroker`
without a configuration id tells you to specify a broker name.
## Fix
Each check now names the parameter it guards. For MQ, two dedicated constants
were added and used for the id checks, keeping `MISSING_BROKER_NAME` for
`createBroker`:
```java
public static final String MISSING_BROKER_NAME = "Broker Name must be
specified";
public static final String MISSING_BROKER_ID = "Broker Id must be specified";
public static final String MISSING_CONFIGURATION_ID = "Configuration Id must
be specified";
```
## Tests
Added focused tests asserting the corrected messages, reusing each module's
existing mock client and routes (AssertJ
`assertThatThrownBy(...).hasRootCauseMessage(...)`):
-
`MSKProducerTest.mskCreateClusterWithoutBrokerNodesNumberReportsThatParameter`
- `MQProducerTest.mqUpdateBrokerWithoutBrokerIdReportsThatParameter`
- `MQProducerTest.mqUpdateBrokerWithoutConfigurationIdReportsThatParameter`
-
`STS2ProducerTest.stsGetFederationTokenWithoutFederatedNameReportsTheCorrectOperation`
The MSK test was verified to fail on `main` with the old "Kafka Version must
be
specified" message. Modules build and pass: MSK 6/6, MQ 9/9, STS 4/4.
## Backport
All three producers carry these strings verbatim on `camel-4.18.x` and
`camel-4.14.x` → targeted at 4.22.0, 4.18.4 and 4.14.9.
---
_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]