Protect against null error object

In certain situations, library fails to parse the recurly error message (example below). This will lead to a null RecurlyAPIError object (which is fine) and an NPE in the RecurlyAPIException ctr - which is not.
This fix just guards against this, so that we have a reasonable RecurlyAPIException, and not an NPE.

Example:
RecurlyClient@832 inits recurlyError with null. An exception in line 834 would lead to an NPE in line 838.
yep. nothing fancy.


On Thu, Oct 23, 2014 at 6:24 PM, Pierre-Alexandre Meyer <
notifications@github.com> wrote:

> In src/main/java/com/ning/billing/recurly/RecurlyAPIException.java:
>
> > @@ -23,7 +23,7 @@
> >      private final RecurlyAPIError recurlyError;
> >
> >      public RecurlyAPIException(final RecurlyAPIError recurlyError) {
> > -        super(recurlyError.toString());
> > +        super(recurlyError.toString()==null? "Unspecified API Error" : recurlyError.toString());
>
> Did you mean recurlyError == null ? "Unspecified API Error" :
> recurlyError.toString())?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/killbilling/recurly-java-library/pull/56/files#r19284331>
> .
>



-- 

*Omri Spector*

Software Development & Consulting

Phone: +972-50-2190755 | Mail: omri.spector@gmail.com |
http://il.linkedin.com/in/ospector