oscerd opened a new pull request, #26499:
URL: https://github.com/apache/camel/pull/26499

   ## Issue
   [CAMEL-24766](https://issues.apache.org/jira/browse/CAMEL-24766)
   
   ## Problem
   `SimpleNotificationProducer.validateServiceConfigurations` guards the 
empty-body case against the **raw** endpoint operation 
(`simpleNotificationEndpoint.getOperation()`), but the operation actually 
dispatched is resolved a few lines later — the `CamelHwCloudSmnOperation` 
exchange property takes precedence, with the endpoint parameter as fallback. So:
   
   - when the operation is supplied only via the property (no `operation=` on 
the endpoint), an empty body reaches `null.equals("publishAsTextMessage")` → 
**NullPointerException**;
   - when the endpoint operation is `publishAsTemplatedMessage` but the 
property overrides it to `publishAsTextMessage`, the guard checks the wrong 
value, doesn't fire, and an **empty text message is published**.
   
   The check also hardcoded the `"publishAsTextMessage"` literal.
   
   ## Fix
   Resolve the operation **before** the body check and compare the resolved 
value against `SmnOperations.PUBLISH_AS_TEXT_MESSAGE`. Also drops a duplicated 
`withTimeToLive(...)` in the templated-message branch (harmless copy-paste).
   
   ## Testing
   - New `PublishTextMessageOperationViaPropertyTest`: operation supplied only 
via the property + empty body now yields the clear `IllegalArgumentException` 
instead of an NPE.
   - Full `camel-huaweicloud-smn` unit suite green.
   - `mvn -Psourcecheck validate` green.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to