-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null pointer exception when Serializing Transaction with a Refund #64
Comments
Hi @vladaspasic If I understand you correctly, the null pointer is thrown from getResponseCodeDetail(). Is that the case? cheers |
Hi @nikoloff yes, that is the method. |
Hi @vladaspasic cheers |
Hi @nikoloff here is the stacktrace of the Exception:
As you can see the exception occurs on the first line in this method : /**
* Returns the response code as detailed message.
* @return the message or <code>null</code> if no message is available.
*/
public String getResponseCodeDetail() {
if( getResponseCode() == 10001 ) {
return "General undefined response";
} else if( getResponseCode() == 10002 ) {... Because the You can check the explanation here: http://stackoverflow.com/questions/3352791/why-comparing-integer-with-int-can-throw-nullpointerexception-in-java |
fixed in v5.1.1. thx @vladaspasic for the clarification about the java unboxing :) |
Thank you @nikoloff I have just updated the dependency, the error is gone, but I found a new one :(
It is the same problem like before, but in a different method, this one happens here: /**
* Checks if the transaction was successful. Utility method, checks if the response_code is 20000.
* @return true if successful, false otherwise
*/
public boolean isSuccessful() {
return getResponseCode() == 20000;
} |
Hi @vladaspasic 10x again for the report will deploy new fix today |
While trying to list all Transactions for a certain Client I got this
NullPointerException
.This occurs when Jackson tries to serialize the
Transaction
that contains aRefund
, that again contains aTransaction
which does not have aresponseCode
property set.When Jackson tries to access the
getResponseCodeDetail
method, from the Refunded transaction, thisnull
value is compared and Java throws an Exception when unboxing the Integer value.There should be a
null
check before theseif
checks to fix this issue.The text was updated successfully, but these errors were encountered: