Gerasimos Kalouris created CAMEL-18110:
------------------------------------------

             Summary: DeliverSM handle message payload optional parameter
                 Key: CAMEL-18110
                 URL: https://issues.apache.org/jira/browse/CAMEL-18110
             Project: Camel
          Issue Type: Bug
          Components: camel-smpp
    Affects Versions: 3.14.2
            Reporter: Gerasimos Kalouris
         Attachments: image-2022-05-13-16-24-24-522.png

As per [https://smpp.org/SMPP_v3_4_Issue1_2.pdf], the optional parameter 
message_payload is used when:

!image-2022-05-13-16-25-36-756.png|width=486,height=364!

The issue CAMEL-9356, tried to solve this but it did not succeed. Not sure if 
it's a regression, but the deliverSm.shortMessage is never null [1], but it's 
set to an empty byte array when the message payload optional parameter exists. 
Thus the message payload is never set as shown in the below snippet:

Snippet from SmppBinding.java
{code:java}
    String messagePayload = null;        if (deliverSm.getShortMessage() == 
null && deliverSm.getOptionalParameters() != null) {
            List<OptionalParameter> oplist = 
Arrays.asList(deliverSm.getOptionalParameters());            for 
(OptionalParameter optPara : oplist) {
                if (OptionalParameter.Tag.MESSAGE_PAYLOAD.code() == optPara.tag 
&& OctetString.class
                        .isInstance(optPara)) {
                    messagePayload = ((OctetString) optPara).getValueAsString();
                    break;
                }
            }
        } {code}
 

That being said I would not alter the null checks but I would add additional 
for the empty body (zero-length). I would like to do a PR for this bug and I 
would like it to be merged with camel *3.14.X* (LTS) which is the version I 
currently use. Should I do a PR based on this branch?

 [1]This is my conclusion after integration tests, using an implementation of 
jSMPP as the server. jSMPP would set the content to the empty message when 
sending the deliverSm.(org.jsmpp.DefaultPDUSender#checkShortMessage) .



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to