Claus Ibsen created CAMEL-26167:
-----------------------------------

             Summary: camel-cm-sms - the from of an SMSMessage is ignored and 
the SMS is sent with an empty sender
                 Key: CAMEL-26167
                 URL: https://issues.apache.org/jira/browse/CAMEL-26167
             Project: Camel
          Issue Type: Bug
          Components: camel-cm-sms
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of cm-sms (CAMEL-24961, PR #28410).

h4. 1. SMSMessage.from is ignored

{{CMProducer.process}} (main 2a465aa4814c, lines 86-90) sets the sender on the 
{{CMMessage}} only when {{smsMessage.getFrom()}} is empty (to {{defaultFrom}}); 
when {{from}} is set it is never copied, so the request has an empty 
{{<FROM/>}}. A message with its own sender can never be sent with it. Checked 
on 4.24.0-SNAPSHOT with a local JDK HttpServer in place of the CM gateway, 
which received {{<FROM/>}}.

Proposed: set the sender to {{smsMessage.getFrom()}} when it is not empty, else 
to {{defaultFrom}}.

h4. 2. A validation failure gives a misleading message, the violations only at 
DEBUG

When the Bean Validation of the {{SMSMessage}} fails, {{CMProducer.process}} 
(main 2a465aa4814c, lines 69-75) logs the violations at DEBUG and throws 
{{InvalidPayloadRuntimeException(exchange, SMSMessage.class)}}, which reads "No 
body available of type: SMSMessage but has type: SMSMessage". The user does not 
see which field is invalid. Checked on 4.24.0-SNAPSHOT with the local fake.

Proposed: throw an exception whose message has the violations (e.g. an 
{{IllegalArgumentException}} or a {{ConstraintViolationException}} with the 
built text).

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to