Add null handling for PaymentAccountPayload in multiple views

This commit is contained in:
Christoph Atteneder 2021-07-12 11:39:12 +02:00
parent b80f3accb9
commit ff49ec17e8
No known key found for this signature in database
GPG key ID: CD5DC1C529CDFD3B
5 changed files with 22 additions and 13 deletions

View file

@ -189,9 +189,11 @@ public class ContractWindow extends Overlay<ContractWindow> {
nrOfDisputesAsBuyer + " / " + nrOfDisputesAsSeller);
addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("shared.paymentDetails", Res.get("shared.buyer")),
contract.getBuyerPaymentAccountPayload().getPaymentDetails()).second.setMouseTransparent(false);
contract.getBuyerPaymentAccountPayload() != null ?
contract.getBuyerPaymentAccountPayload().getPaymentDetails() : "NA").second.setMouseTransparent(false);
addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("shared.paymentDetails", Res.get("shared.seller")),
sellerPaymentAccountPayload.getPaymentDetails()).second.setMouseTransparent(false);
sellerPaymentAccountPayload != null ?
sellerPaymentAccountPayload.getPaymentDetails() : "NA").second.setMouseTransparent(false);
String title = "";
String agentKeyBaseUserName = "";

View file

@ -448,8 +448,10 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
if (contract != null) {
isBuyerOnion = contract.getBuyerNodeAddress().getFullAddress().contains(filterString);
isSellerOnion = contract.getSellerNodeAddress().getFullAddress().contains(filterString);
matchesBuyersPaymentAccountData = contract.getBuyerPaymentAccountPayload().getPaymentDetails().contains(filterString);
matchesSellersPaymentAccountData = contract.getSellerPaymentAccountPayload().getPaymentDetails().contains(filterString);
matchesBuyersPaymentAccountData = contract.getBuyerPaymentAccountPayload() != null &&
contract.getBuyerPaymentAccountPayload().getPaymentDetails().contains(filterString);
matchesSellersPaymentAccountData = contract.getSellerPaymentAccountPayload() != null &&
contract.getSellerPaymentAccountPayload().getPaymentDetails().contains(filterString);
}
return isBuyerOnion || isSellerOnion ||
matchesBuyersPaymentAccountData || matchesSellersPaymentAccountData;

View file

@ -298,8 +298,10 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
if (contract != null) {
isBuyerOnion = contract.getBuyerNodeAddress().getFullAddress().contains(filterString);
isSellerOnion = contract.getSellerNodeAddress().getFullAddress().contains(filterString);
matchesBuyersPaymentAccountData = contract.getBuyerPaymentAccountPayload().getPaymentDetails().contains(filterString);
matchesSellersPaymentAccountData = contract.getSellerPaymentAccountPayload().getPaymentDetails().contains(filterString);
matchesBuyersPaymentAccountData = contract.getBuyerPaymentAccountPayload() != null &&
contract.getBuyerPaymentAccountPayload().getPaymentDetails().contains(filterString);
matchesSellersPaymentAccountData = contract.getSellerPaymentAccountPayload() != null &&
contract.getSellerPaymentAccountPayload().getPaymentDetails().contains(filterString);
}
return isBuyerOnion || isSellerOnion ||
matchesBuyersPaymentAccountData || matchesSellersPaymentAccountData;

View file

@ -221,15 +221,18 @@ public class SellerStep3View extends TradeStepView {
// Not expected
myPaymentDetails = ((AssetsAccountPayload) myPaymentAccountPayload).getAddress();
}
peersPaymentDetails = ((AssetsAccountPayload) peersPaymentAccountPayload).getAddress();
peersPaymentDetails = peersPaymentAccountPayload != null ?
((AssetsAccountPayload) peersPaymentAccountPayload).getAddress() : "NA";
myTitle = Res.get("portfolio.pending.step3_seller.yourAddress", currencyName);
peersTitle = Res.get("portfolio.pending.step3_seller.buyersAddress", currencyName);
} else {
if (myPaymentDetails.isEmpty()) {
// Not expected
myPaymentDetails = myPaymentAccountPayload.getPaymentDetails();
myPaymentDetails = myPaymentAccountPayload != null ?
myPaymentAccountPayload.getPaymentDetails() : "NA";
}
peersPaymentDetails = peersPaymentAccountPayload.getPaymentDetails();
peersPaymentDetails = peersPaymentAccountPayload != null ?
peersPaymentAccountPayload.getPaymentDetails() : "NA";
myTitle = Res.get("portfolio.pending.step3_seller.yourAccount");
peersTitle = Res.get("portfolio.pending.step3_seller.buyersAccount");
}

View file

@ -782,11 +782,11 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> implements
.append(")\n");
String buyerPaymentAccountPayload = Utilities.toTruncatedString(
contract.getBuyerPaymentAccountPayload().getPaymentDetails().
replace("\n", " ").replace(";", "."), 100);
contract.getBuyerPaymentAccountPayload() != null ? contract.getBuyerPaymentAccountPayload().getPaymentDetails().
replace("\n", " ").replace(";", ".") : "NA", 100);
String sellerPaymentAccountPayload = Utilities.toTruncatedString(
contract.getSellerPaymentAccountPayload().getPaymentDetails()
.replace("\n", " ").replace(";", "."), 100);
contract.getSellerPaymentAccountPayload() != null ? contract.getSellerPaymentAccountPayload().getPaymentDetails()
.replace("\n", " ").replace(";", ".") : "NA", 100);
String buyerNodeAddress = contract.getBuyerNodeAddress().getFullAddress();
String sellerNodeAddress = contract.getSellerNodeAddress().getFullAddress();
csvStringBuilder.append(currency).append(";")