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/07/23 09:37:00 UTC
[jira] [Created] (CAMEL-24249) camel-aws2 MSK/MQ/STS producers throw copy-pasted IllegalArgumentException messages naming the wrong parameter
Andrea Cosentino created CAMEL-24249:
----------------------------------------
Summary: camel-aws2 MSK/MQ/STS producers throw copy-pasted IllegalArgumentException messages naming the wrong parameter
Key: CAMEL-24249
URL: https://issues.apache.org/jira/browse/CAMEL-24249
Project: Camel
Issue Type: Bug
Components: camel-aws
Reporter: Andrea Cosentino
h3. Problem
Several AWS v2 producers validate required headers and throw {{IllegalArgumentException}} with a message that was copy-pasted from a neighbouring check and never updated, so the message names the wrong parameter. A user who forgets a required header is told to supply a *different* one.
h4. camel-aws2-msk -- MSK2Producer.createCluster
The number-of-broker-nodes check reuses the Kafka-version message:
{code:java}
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(MSK2Constants.BROKER_NODES_NUMBER))) {
Integer nodesNumber = exchange.getIn().getHeader(MSK2Constants.BROKER_NODES_NUMBER, Integer.class);
builder.numberOfBrokerNodes(nodesNumber);
} else {
throw new IllegalArgumentException("Kafka Version must be specified"); // should be the broker-nodes-number message
}
{code}
h4. camel-aws2-mq -- MQ2Producer
{{MISSING_BROKER_NAME = "Broker Name must be specified"}} is correct only for {{createBroker}} (which takes a broker *name*). It is 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:
{code:java}
// updateBroker
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(MQ2Constants.CONFIGURATION_ID))) {
configurationId = exchange.getIn().getHeader(MQ2Constants.CONFIGURATION_ID, ConfigurationId.class);
builder.configuration(configurationId);
} else {
throw new IllegalArgumentException(MISSING_BROKER_NAME); // configurationId is missing, not the broker name
}
{code}
h4. camel-aws2-sts -- STS2Producer.getFederationToken
The federated-name check carries the {{assumeRole}} operation name:
{code:java}
throw new IllegalArgumentException("Federated name needs to be specified for assumeRole operation");
{code}
The enclosing operation is {{getFederationToken}}.
h3. Impact
No functional misbehaviour, but the diagnostics actively mislead. Someone calling {{createCluster}} without a broker-node count is told "Kafka Version must be specified" even though they supplied the Kafka version; someone calling {{updateBroker}} without a configuration id is told to specify a broker name.
h3. Proposed fix
Give each check a message that names the parameter it guards: a broker-nodes-number message for MSK; dedicated {{MISSING_BROKER_ID}} / {{MISSING_CONFIGURATION_ID}} constants for the MQ id checks (keeping {{MISSING_BROKER_NAME}} for {{createBroker}}); and {{getFederationToken}} in the STS message.
h3. Affected versions
All three producers carry these strings verbatim on {{main}}, {{camel-4.18.x}} and {{camel-4.14.x}}.
----
_Reported by Claude Code on behalf of acosentino, from an automated audit of the camel-aws components._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)