Claus Ibsen created CAMEL-26095:
-----------------------------------
Summary: camel-aws2-mq - CamelAwsMQBrokerUsers as Strings fails,
CamelAwsMQConfigurationID as text is dropped, and no operation fails with a
NullPointerException
Key: CAMEL-26095
URL: https://issues.apache.org/jira/browse/CAMEL-26095
Project: Camel
Issue Type: Bug
Components: camel-aws2
Affects Versions: 4.18.0, 4.22.0, 4.23.0
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of aws2-mq (CAMEL-24961).
h4. 1. No operation fails with a NullPointerException
The operation option has no default, and with no CamelAwsMQOperation header,
{{switch (determineOperation(exchange))}} ({{MQ2Producer}}, main ed3d719b379c,
line 73) fails with {{NullPointerException: Cannot invoke "...ordinal()"
because the return value of "...determineOperation(...)" is null}}. Checked on
4.24.0-SNAPSHOT with {{camel run}} against the AWS emulator of {{camel infra
run aws}}.
*Proposed change*: fail with a message that says to set the operation option or
header, as aws2-kms does ("Operation must be specified").
h4. 2. CamelAwsMQBrokerUsers as Strings fails with a ClassCastException
createBroker passes the header to {{builder.users(...)}} as a raw List
({{MQ2Producer}}, main ed3d719b379c, lines 222-224), so anything but User
objects of the AWS SDK fails in the SDK with {{ClassCastException: class
java.lang.String cannot be cast to class ...User}}. Checked on 4.24.0-SNAPSHOT
with {{camel run}} against the AWS emulator of {{camel infra run aws}}. A YAML
route cannot build a User, so createBroker works from Java only.
h4. 3. A CamelAwsMQConfigurationID as text sends updateBroker without the
configuration
updateBroker checks that the header is set, then reads it as a
{{ConfigurationId}} of the AWS SDK (lines 351-353), which gives null for text:
the request goes out without the configuration, and Camel raises no error.
Checked on 4.24.0-SNAPSHOT with {{camel run}} against the AWS emulator of
{{camel infra run aws}}, through a proxy that logs the requests: with the
header "c-123" the request body is {{\{\}}}. The catalog describes the header
as "A list of information about the configuration" ({{MQ2Constants}}, line 38).
h4. 4. With pojoRequest, createBroker and describeBroker set no headers
createBroker sets {{CamelAwsMQBrokerID}} and {{CamelAwsMQBrokerArn}} (lines
243-244), and describeBroker the ARN and the state, only when the request comes
from headers. Checked on 4.24.0-SNAPSHOT with {{camel run}} against the AWS
emulator of {{camel infra run aws}}, through a proxy that logs the requests:
describeBroker with a DescribeBrokerRequest body gives the response and no
{{CamelAwsMQBrokerArn}} or {{CamelAwsMQBrokerState}}.
h4. Also read in the code, not run
* The component is described as "Send messages to AWS MQ." ({{MQ2Endpoint}},
line 33) and is in the messaging category, while it manages brokers; the
operation option says "It can be listBrokers, createBroker, deleteBroker"
({{MQ2Configuration}}, line 121), three of six.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)