Possible NullPointerException during UsBankAccount instantiation
Closed this issue · 2 comments
kmichalak commented
General information
- SDK/Library version: 2.68.0 to 2.76.1-SNAPSHOT
- Environment: Sandbox
- Java, 1.8.0_111-b14, and Fedora 26
Possible NullPointerException during UsBankAccount instantiation
I have found that constructor of the class com.braintreegateway.UsBankAccount adds subscription objects to an uninitialized list
public UsBankAccount(NodeWrapper node) {
this.routingNumber= node.findString("routing-number");
this.last4 = node.findString("last-4");
this.accountType = node.findString("account-type");
this.accountHolderName = node.findString("account-holder-name");
this.token = node.findString("token");
this.imageUrl = node.findString("image-url");
this.bankName = node.findString("bank-name");
for (NodeWrapper subscriptionResponse : node.findAll("subscriptions/subscription")) {
// Here is the place where NullPointerException can be thrown
this.subscriptions.add(new Subscription(subscriptionResponse));
}
this.customerId = node.findString("customer-id");
this.isDefault = node.findBoolean("default");
this.achMandate = new AchMandate(node.findFirst("ach-mandate"));
}
In other places, like CoinbaseAccount, a for-loop is proceded with list initialization like this
this.subscriptions = new ArrayList<Subscription>();
jaypatel512 commented
You are absolutely right @kmichalak ! We will add that fix right away. Good catch.
jaypatel512 commented
Hey @kmichalak ! The fix has been released in v2.77.0. Thank you so much for pointing that out. 🎆