killbill-client-java
killbill-client-java copied to clipboard
unmarshalResponse masks errors that aren't in JSON format
Particularly this error.
I am getting an error when using pluginPOST:
org.killbill.billing.client.KillBillClientException: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Invalid': was expecting 'null', 'true', 'false' or NaN
at [Source: org.jboss.netty.buffer.ChannelBufferInputStream@15590dd4; line: 1, column: 9]
at org.killbill.billing.client.KillBillHttpClient.unmarshalResponse(KillBillHttpClient.java:718)
at org.killbill.billing.client.KillBillHttpClient.deserializeResponse(KillBillHttpClient.java:648)
at org.killbill.billing.client.KillBillHttpClient.throwExceptionOnResponseError(KillBillHttpClient.java:632)
at org.killbill.billing.client.KillBillHttpClient.doPrepareRequest(KillBillHttpClient.java:503)
at org.killbill.billing.client.KillBillHttpClient.doPost(KillBillHttpClient.java:247)
at org.killbill.billing.client.KillBillHttpClient.doPost(KillBillHttpClient.java:242)
at org.killbill.billing.client.KillBillHttpClient.doPost(KillBillHttpClient.java:238)
at org.killbill.billing.client.KillBillClient.pluginPOST(KillBillClient.java:3979)
This is masking the actual error that is being returned. There should be a catch handler there somewhere to detect JsonParseExceptions and return response.getResponseBody() instead. Possibly, just add JsonParseException to the catch block on line 731 of KillBillHttpClient? I realize I could switch the DEBUG flag on, but if this is an intermittent error in production, that flag doesn't help too much.
And actually, the default Kill Bill installation logs at INFO and up and wouldn't include the debugging output even if DEBUG=true. (I think.)