PammyS / jsmpp

Automatically exported from code.google.com/p/jsmpp
Apache License 2.0
0 stars 0 forks source link

Feature request for the implemetation of toString() method in all pdu classes #68

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create any concrete pdu of org.jsmpp.bean.Command subclasses (eg:
SubmitSm). Or create a pdu by composing/decomposing a valid pdu byte[].
2. set the appropriate fields in the pdu if required. 
3. invoke toString() on the concrete pdu object (eg submitsm.toString())

What is the expected output? What do you see instead?
Expected output is the string representation of all possible fields in the
concrete class. Instead we obtain only the Command class toString() output.
Reason is that the toString() of the Object class is overrided only in the
Command class with the following definition:

 public String toString() {

        return "PDUHeader(" + commandLength + ", " + getCommandIdAsHex() +
", " + getCommandStatusAsHex() + ", " + sequenceNumber + ")";

    }

Hence each time when we call toString() on a subclass, it wont give me the
attribute values of the subclass. It would only invoke the base class'
toString(). This requires the application developer to manually code the
toString() or invoke debugString() of the PDU class in Logica's smpp.jar
implementation by passing the byte[].

What version of the product are you using? On what operating system?
I am using the version 2.0.1. I saw the release 2.1.0. But when i went
through its code there also I found the same implementation of toString().
I am using Ubuntu 8.04. 

Please provide any additional information below.
A look into Logica's debugString() would be nice in this regard. I would
also suggest you not to forget the data coding value while creating the
String from byte[]. When the pdu contains UDH please provide appropriate
toString() implementation.

Original issue reported on code.google.com by hbkricha...@gmail.com on 14 Apr 2010 at 1:18