You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Method parseData() from DefaultSMSPartStrategy adds a character to the text of the message to be sent, but there are no checks to see if it still fits SMSMessage.MAX_MSG_TEXT_LEN.
I think SMSMessage.checkMessageText() should check if the (length of the SMS + length of DefaultSMSParseStrategy.HIDDEN_CHARACTER) fits SMSMessage.MAX_MSG_TEXT_LEN.
However, if whoever is using this library creates a new SMSMessage and then uses SMSMessageParser.getInstance().setMessageParseStrategy() to change how many characters are added in the beginning of the message, then the checks on the validity of SMSMessages already created might be wrong, for example if the hidden characters become longer in the new strategy.
Doing the check in getSMSContent() (or in general after the SMSMessage is created correctly) would not be a good idea, because then the user won't know why their message was created correctly but then failed a second check on its length.
A simple solution could be removing class SMSMessageParser and letting the app using this library decide if and what character to insert at the beginning of messages. That class was meant to make it easier for different groups to decide how they wanted to identify messages meant for their app, but in the end it's unnecessarily complicating everything.
A worse solution would be letting custom MessageParseStrategy classes only use one character at the beginning of messages, because at that point we might as well remove the possibility of creating those custom strategies, since it's faster to just have a method to change the character that is added before the message.
In both cases the best thing to do is letting developers of the app using this library choose if and how they want to add some ID or password in the beginning of each message, as it was done in our killer app.
The text was updated successfully, but these errors were encountered:
Method
parseData()
fromDefaultSMSPartStrategy
adds a character to the text of themessage
to be sent, but there are no checks to see if it still fitsSMSMessage.MAX_MSG_TEXT_LEN
.I think
SMSMessage.checkMessageText()
should check if the (length of the SMS + length ofDefaultSMSParseStrategy.HIDDEN_CHARACTER
) fitsSMSMessage.MAX_MSG_TEXT_LEN
.However, if whoever is using this library creates a new
SMSMessage
and then usesSMSMessageParser.getInstance().setMessageParseStrategy()
to change how many characters are added in the beginning of the message, then the checks on the validity ofSMSMessages
already created might be wrong, for example if the hidden characters become longer in the new strategy.Doing the check in
getSMSContent()
(or in general after the SMSMessage is created correctly) would not be a good idea, because then the user won't know why their message was created correctly but then failed a second check on its length.A simple solution could be removing class
SMSMessageParser
and letting the app using this library decide if and what character to insert at the beginning of messages. That class was meant to make it easier for different groups to decide how they wanted to identify messages meant for their app, but in the end it's unnecessarily complicating everything.A worse solution would be letting custom
MessageParseStrategy
classes only use one character at the beginning of messages, because at that point we might as well remove the possibility of creating those custom strategies, since it's faster to just have a method to change the character that is added before the message.In both cases the best thing to do is letting developers of the app using this library choose if and how they want to add some ID or password in the beginning of each message, as it was done in our killer app.
The text was updated successfully, but these errors were encountered: