Claus Ibsen created CAMEL-27741:
-----------------------------------

             Summary: camel-smpp: replace-if-present header type, missing byte 
defaults, wrong javaTypes and labels
                 Key: CAMEL-27741
                 URL: https://issues.apache.org/jira/browse/CAMEL-27741
             Project: Camel
          Issue Type: Bug
          Components: camel-smpp
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while improving the option descriptions of camel-smpp for CAMEL-23832 
(commit 
https://github.com/apache/camel/commit/b82eef5b59e581059179cfd3aa240e1194ec9c8c).
These are separate problems of the component; the descriptions commit only 
documents the current behavior.

h4. 1. CamelSmppReplaceIfPresentFlag is documented as Boolean, but read as Byte
{{SmppConstants.REPLACE_IF_PRESENT_FLAG}} has {{javaType = "Boolean"}}. 
{{SmppSubmitSmCommand.createSubmitSmTemplate()}} and 
{{SmppSubmitMultiCommand.createSubmitMultiTemplate()}} read it with 
{{in.getHeader(SmppConstants.REPLACE_IF_PRESENT_FLAG, Byte.class)}} and pass it 
to the {{byte}} setter of jSMPP. Camel has no Boolean to Byte converter, so a 
Boolean header, as the metadata documents, converts to null and the send fails 
with a NullPointerException. The tests set the header to 
{{ReplaceIfPresentFlag.REPLACE.value()}}, a byte.
Proposed change: set the javaType to Byte, or also accept a Boolean in the 
commands.

h4. 2. Byte options have no defaultValue in the metadata
The byte options of {{SmppConfiguration}} have no {{defaultValue}} on 
{{@UriParam}}, so the catalog and the docs show no default: 
{{registeredDelivery}} and {{priorityFlag}} default to 1, and {{dataCoding}}, 
{{alphabet}}, {{sourceAddrTon}}, {{destAddrTon}}, {{sourceAddrNpi}}, 
{{destAddrNpi}}, {{protocolId}}, {{replaceIfPresentFlag}}, {{typeOfNumber}} and 
{{numberingPlanIndicator}} default to 0.
Proposed change: add the defaultValue to each of them.

h4. 3. Wrong javaType of CamelSmppScheduleDeliveryTime and CamelSmppError
* {{CamelSmppScheduleDeliveryTime}} has {{javaType = "Date"}}, but the consumer 
sets it to the String {{schedule_delivery_time}} of the deliver_sm 
({{SmppBinding.createSmppMessage(CamelContext, DeliverSm)}}). The producer 
reads it as a Date.
* {{CamelSmppError}} has {{javaType = "String or Map<String, List<Map<String, 
Object>>>"}}, but {{SmppQuerySmCommand.execute()}} sets it to 
{{querySmResult.getErrorCode()}}, a byte.
Proposed change: list the types that each side really uses.

h4. 4. Wrong or missing labels
* {{CamelSmppDataCoding}} has {{label = "producer"}}, but the consumer sets it 
too, for a received DeliverSm and DataSm ({{SmppBinding}}).
* {{CamelSmppOptionalParameters}} has {{label = "consumer"}}, but the producer 
reads it for SubmitSm, SubmitMulti and DataSm, and 
{{SmppDataSmCommand.execute()}} sets it for the response.
* The {{splittingPolicy}} option and the {{CamelSmppCommand}} header have no 
label, but only the producer uses them.
Proposed change: drop the label of the two headers (both sides), and set 
{{label = "producer"}} on the option and on {{CamelSmppCommand}}.

h4. 5. The enums of serviceType exclude its default
The {{serviceType}} option has {{enums = "CMT,CPT,VMN,VMA,WAP,USSD"}} and 
{{defaultValue = ""}}. The default is not in the list, and SMPP 3.4 allows 
other service types too (any string of at most 5 characters), which tooling 
that checks the enums then rejects.
Proposed change: remove the enums, and keep the generic service types in the 
description.

_Claude Code on behalf of davsclaus_



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

Reply via email to