[
https://issues.apache.org/jira/browse/CAMEL-24766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18116649#comment-18116649
]
Claus Ibsen commented on CAMEL-24766:
-------------------------------------
Backported to camel-4.22.x by https://github.com/apache/camel/pull/26535
(commit 231b34560be0).
_Claude Code on behalf of davsclaus_
> camel-huaweicloud-smn: empty-body guard checks the raw endpoint operation
> instead of the resolved one
> -----------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24766
> URL: https://issues.apache.org/jira/browse/CAMEL-24766
> Project: Camel
> Issue Type: Bug
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 4.22.2, 4.23.0
>
>
> In SimpleNotificationProducer.validateServiceConfigurations the empty-body
> guard tests simpleNotificationEndpoint.getOperation() (the raw endpoint
> operation), but the operation actually dispatched is resolved a few lines
> later as the CamelHwCloudSmnOperation exchange property first, endpoint param
> as fallback. Consequences (verified against main): (a) if the operation is
> supplied only via the SMN_OPERATION property and the endpoint operation is
> left unset, the guard does null.equals(...) and throws a raw
> NullPointerException on any empty-body exchange; (b) if the endpoint
> operation is publishAsTemplatedMessage but the property overrides it to
> publishAsTextMessage, the guard checks the wrong value, does not fire, and an
> empty text message is published. The literal "publishAsTextMessage" is also
> hardcoded instead of SmnOperations.PUBLISH_AS_TEXT_MESSAGE. Fix: resolve the
> operation (property-or-endpoint) before the body check and compare the
> resolved value against the constant. Also: the topic URN is built from
> endpoint.getRegion() unconditionally, yielding urn:smn:null:... when a user
> configures endpoint without region; and withTimeToLive(...) is set twice in
> the templated-message branch (harmless copy-paste).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)