From f72c0c4d3eb602b7bd6f8a262c0a527e89050ba7 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sat, 26 Oct 2019 20:45:41 -0500 Subject: [PATCH 1/2] Avoid null objects --- .../bisq/core/account/witness/AccountAgeWitnessService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/bisq/core/account/witness/AccountAgeWitnessService.java b/core/src/main/java/bisq/core/account/witness/AccountAgeWitnessService.java index 3e5a948f64d..7fe43ecc7d2 100644 --- a/core/src/main/java/bisq/core/account/witness/AccountAgeWitnessService.java +++ b/core/src/main/java/bisq/core/account/witness/AccountAgeWitnessService.java @@ -65,6 +65,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.Random; import java.util.concurrent.TimeUnit; @@ -616,6 +617,7 @@ public List getTraderPaymentAccounts(long safeDate, PaymentMetho .filter(this::hasChargebackRisk) .filter(this::isBuyerWinner) .flatMap(this::getTraderData) + .filter(Objects::nonNull) .filter(traderDataItem -> !signedWitnessService.isSignedAccountAgeWitness(traderDataItem.getAccountAgeWitness())) .filter(traderDataItem -> traderDataItem.getAccountAgeWitness().getDate() < safeDate) From 39feb98868ee9086ab5598dabdc91502ecd4283b Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sat, 26 Oct 2019 22:34:25 -0500 Subject: [PATCH 2/2] Remove check for type Historical data can be arbitration instead of mediation (arbitration was fallback at last update), so we need to tolerate the incorrect type here. Is only for tickets from pre 1.2. --- .../dispute/mediation/MediationDisputeList.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/core/src/main/java/bisq/core/support/dispute/mediation/MediationDisputeList.java b/core/src/main/java/bisq/core/support/dispute/mediation/MediationDisputeList.java index 2b58f98d586..ce45e2fede5 100644 --- a/core/src/main/java/bisq/core/support/dispute/mediation/MediationDisputeList.java +++ b/core/src/main/java/bisq/core/support/dispute/mediation/MediationDisputeList.java @@ -18,7 +18,6 @@ package bisq.core.support.dispute.mediation; import bisq.core.proto.CoreProtoResolver; -import bisq.core.support.SupportType; import bisq.core.support.dispute.Dispute; import bisq.core.support.dispute.DisputeList; @@ -34,8 +33,6 @@ import lombok.ToString; import lombok.extern.slf4j.Slf4j; -import static com.google.common.base.Preconditions.checkArgument; - @Slf4j @ToString /* @@ -69,9 +66,6 @@ private MediationDisputeList(Storage storage, List checkArgument(dispute.getSupportType().equals(SupportType.MEDIATION), "Support type has to be MEDIATION")); - return protobuf.PersistableEnvelope.newBuilder().setMediationDisputeList(protobuf.MediationDisputeList.newBuilder() .addAllDispute(ProtoUtil.collectionToProto(new ArrayList<>(list)))).build(); } @@ -82,11 +76,7 @@ public static MediationDisputeList fromProto(protobuf.MediationDisputeList proto List list = proto.getDisputeList().stream() .map(disputeProto -> Dispute.fromProto(disputeProto, coreProtoResolver)) .collect(Collectors.toList()); - - list.forEach(e -> { - checkArgument(e.getSupportType().equals(SupportType.MEDIATION), "Support type has to be MEDIATION"); - e.setStorage(storage); - }); + list.forEach(e -> e.setStorage(storage)); return new MediationDisputeList(storage, list); } }