fix null pointer, cleanups

This commit is contained in:
Manfred Karrer 2016-03-11 10:24:13 +01:00
parent 9cb9d0f88c
commit 546b6f7510
4 changed files with 18 additions and 16 deletions

View file

@ -17,11 +17,10 @@
package io.bitsquare.payment; package io.bitsquare.payment;
import io.bitsquare.common.persistance.Persistable;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public abstract class PaymentAccountFactory implements Persistable { public class PaymentAccountFactory {
private static final Logger log = LoggerFactory.getLogger(PaymentAccountFactory.class); private static final Logger log = LoggerFactory.getLogger(PaymentAccountFactory.class);
public static PaymentAccount getPaymentAccount(PaymentMethod paymentMethod) { public static PaymentAccount getPaymentAccount(PaymentMethod paymentMethod) {

View file

@ -271,7 +271,10 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
}; };
model.dataModel.feeFromFundingTxProperty.addListener(feeFromFundingTxListener); model.dataModel.feeFromFundingTxProperty.addListener(feeFromFundingTxListener);
if (spinner != null && takeOfferButton.isVisible()) if (offerAvailabilitySpinner != null && offerAvailabilitySpinner.isVisible())
offerAvailabilitySpinner.setProgress(-1);
if (spinner != null && spinner.isVisible())
spinner.setProgress(-1); spinner.setProgress(-1);
} }
@ -429,16 +432,16 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
String tradeAmountText = model.isSeller() ? "the trade amount, " : ""; String tradeAmountText = model.isSeller() ? "the trade amount, " : "";
new Popup().headLine("Fund your trading wallet") new Popup().headLine("Fund your trading wallet")
.instruction("You need to pay in " + .instruction("You need to pay in " +
model.totalToPay.get() + " to your local Bitsquare trading wallet.\n" + model.totalToPay.get() + " to your local Bitsquare trading wallet.\n" +
"The amount is the sum of " + tradeAmountText + "the security deposit, the trading fee and " + "The amount is the sum of " + tradeAmountText + "the security deposit, the trading fee and " +
"the bitcoin mining fee.\n\n" + "the bitcoin mining fee.\n\n" +
"Please send from your external Bitcoin wallet the exact amount to the address: " + "Please send from your external Bitcoin wallet the exact amount to the address: " +
model.getAddressAsString() + "\n(you can copy the address in the screen below after closing that popup)\n\n" + model.getAddressAsString() + "\n(you can copy the address in the screen below after closing that popup)\n\n" +
"Make sure you use a sufficiently high mining fee of at least " + "Make sure you use a sufficiently high mining fee of at least " +
model.formatter.formatCoinWithCode(FeePolicy.getMinRequiredFeeForFundingTx()) + model.formatter.formatCoinWithCode(FeePolicy.getMinRequiredFeeForFundingTx()) +
" to avoid problems that your transaction does not get confirmed in the blockchain.\n" + " to avoid problems that your transaction does not get confirmed in the blockchain.\n" +
"Transactions with a lower fee will not be accepted.\n\n" + "Transactions with a lower fee will not be accepted.\n\n" +
"You can see the status of your incoming payment and all the details in the screen below.") "You can see the status of your incoming payment and all the details in the screen below.")
.dontShowAgainId(key, preferences) .dontShowAgainId(key, preferences)
.show(); .show();
} }

View file

@ -73,5 +73,4 @@ public class TacWindow extends Overlay<TacWindow> {
protected void onShow() { protected void onShow() {
display(); display();
} }
} }

View file

@ -203,7 +203,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener {
broadcast(new AddDataMessage(protectedStorageEntry), sender, listener, isDataOwner); broadcast(new AddDataMessage(protectedStorageEntry), sender, listener, isDataOwner);
} }
hashMapChangedListeners.stream().forEach(e -> e.onAdded(protectedStorageEntry)); hashMapChangedListeners.stream().forEach(e -> e.onAdded(protectedStorageEntry));
} else { } else {
log.trace("add failed"); log.trace("add failed");
@ -442,7 +442,8 @@ public class P2PDataStorage implements MessageListener, ConnectionListener {
else else
result = expirableMailboxStoragePayload.receiverPubKeyForRemoveOperation.equals(protectedStorageEntry.ownerPubKey); result = expirableMailboxStoragePayload.receiverPubKeyForRemoveOperation.equals(protectedStorageEntry.ownerPubKey);
} else { } else {
result = protectedStorageEntry.getStoragePayload().getOwnerPubKey().equals(protectedStorageEntry.ownerPubKey); result = protectedStorageEntry != null && protectedStorageEntry.getStoragePayload() != null &&
protectedStorageEntry.getStoragePayload().getOwnerPubKey().equals(protectedStorageEntry.ownerPubKey);
} }
if (!result) if (!result)