sanoopsivan / jsmpp

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

misuse of IOException in SMPPSession.connectAndBind() #59

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

Many exception are trapped inside this method but the information is hidden
as only an IOException is thrown with the appropriate message.  This is sad
since it prevents the application from reacting appropriately.  

For example:
...
          } catch (NegativeResponseException e) {
                 String message = "Receive negative bind response";
                 logger.error(message, e);
                 close();
                 throw new IOException(message + ": " + e.getMessage());
} ... 

Replacing:
              throw new IOException(message + ": " + e.getMessage());
by:
              throw new IOException(message + ": " + e.getMessage(), e);

would allow the app to extract the 'commandStatus' and act accordingly

A patch is attached and provide the above change.  It applies cleanly to
the head of the current trunk branch (2.2.x)

Cheers

Original issue reported on code.google.com by jean.phi...@gmail.com on 14 Dec 2009 at 9:20

Attachments:

GoogleCodeExporter commented 8 years ago
Hmm... 
You right. How can I miss that.
I will fix this, expose the detail error for detailed report about the 
exception (not only stracktrace but 
commandStatus also).

Original comment by uuda...@gmail.com on 15 Dec 2009 at 2:16