Andrea Cosentino created CAMEL-24766:
----------------------------------------

             Summary: 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


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)

Reply via email to