cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with error handling in Java SDK (net.authorize.util.HttpClient)

The class net.authorize.util.HttpClient in the Java SDK which is used to post request to Authorize.NET swallows several exceptions (I/O, etc) which my be created during the post, so outer code doesn't know what happened, or have a chance to recover from the failure.

 

In other places it logs the error to System.err (using e.printStackTrace()), which has the same effect.  The client doesn't have a chance to know what went wrong, or doesn't know that something went wrong.

 

After manually inducing these error conditions, we found that in some cases it results in a RuntimeException because of a NullPointer caused by this poor exception handling.

 

Examples of these issues may be seen in the methods executeXML and convertStreamToString.  I can provide more specifics if necessary.  Fixing these problems will help SDK users to write more robust code.

damien
Member
1 REPLY 1

Damien,

 

Thanks for your input on the Java SDK.  I've passed on your suggestion to the development team consideration in a future release.

 

Richard

Community Manager

RichardH
Administrator Administrator
Administrator