Integration and Testing

Authorize.Net API questions and help with your payment integration.

Posts: 1
Registered: ‎10-05-2012

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.

Posts: 2,765
Topics: 57
Kudos: 272
Blog Posts: 67
Registered: ‎12-05-2011

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



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



Community Manager