Nullpointer fixes

This commit is contained in:
Manfred Karrer 2016-03-10 20:26:41 +01:00
parent b2552b968c
commit 56008caef3
8 changed files with 17 additions and 13 deletions

View File

@ -78,8 +78,9 @@ public class FeePolicy {
}
// 0.1 BTC; about 4 EUR @ 400 EUR/BTC
// TODO will be increased once we get higher limits
// 0.01 BTC; about 0.4 EUR @ 400 EUR/BTC
public static Coin getSecurityDeposit() {
return Coin.valueOf(10_000_000);
return Coin.valueOf(1_000_000);
}
}

View File

@ -67,7 +67,7 @@ public final class PaymentMethod implements Persistable, Comparable {
public static PaymentMethod BLOCK_CHAINS;
public static final List<PaymentMethod> ALL_VALUES = new ArrayList<>(Arrays.asList(
OK_PAY = new PaymentMethod(OK_PAY_ID, 0, DAY, Coin.parseCoin("0.5")), // tx instant so min. wait time
OK_PAY = new PaymentMethod(OK_PAY_ID, 0, DAY, Coin.parseCoin("0.2")), // tx instant so min. wait time
PERFECT_MONEY = new PaymentMethod(PERFECT_MONEY_ID, 0, DAY, Coin.parseCoin("0.2")),
SEPA = new PaymentMethod(SEPA_ID, 0, 8 * DAY, Coin.parseCoin("0.1")), // sepa takes 1-3 business days. We use 8 days to include safety for holidays
NATIONAL_BANK = new PaymentMethod(NATIONAL_BANK_ID, 0, 4 * DAY, Coin.parseCoin("0.1")),
@ -78,7 +78,7 @@ public final class PaymentMethod implements Persistable, Comparable {
/* FED_WIRE = new PaymentMethod(FED_WIRE_ID, 0, DAY, Coin.parseCoin("0.1")),*/
/* TRANSFER_WISE = new PaymentMethod(TRANSFER_WISE_ID, 0, DAY, Coin.parseCoin("0.1")),*/
/* US_POSTAL_MONEY_ORDER = new PaymentMethod(US_POSTAL_MONEY_ORDER_ID, 0, DAY, Coin.parseCoin("0.1")),*/
BLOCK_CHAINS = new PaymentMethod(BLOCK_CHAINS_ID, 0, DAY, Coin.parseCoin("0.2"))
BLOCK_CHAINS = new PaymentMethod(BLOCK_CHAINS_ID, 0, DAY, Coin.parseCoin("0.3"))
));

View File

@ -58,9 +58,9 @@ public final class Offer implements StoragePayload, RequiresOwnerIsOnlinePayload
@JsonExclude
private static final Logger log = LoggerFactory.getLogger(Offer.class);
public static final long TTL = TimeUnit.SECONDS.toMillis(4 * 60);
public final static String TAC_OFFERER = "When placing that offer I accept that anyone who fulfills my conditions can " +
"take that offer.";
public static final String TAC_TAKER = "With taking the offer I commit to the trade conditions as defined.";
public final static String TAC_OFFERER = "With placing that offer I accept to trade " +
"with anyone who fulfills the conditions as defined above.";
public static final String TAC_TAKER = "With taking that offer I commit to the trade conditions as defined above.";
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -68,7 +68,7 @@ bg color of non edit textFields: fafafa
-bs-sell-hover: derive(-bs-sell, -10%);
-bs-sell-transparent: derive(-bs-sell, 95%);
-bs-cancel: -bs-light-grey;
-bs-cancel: #ddd;
-bs-cancel-focus: derive(-bs-cancel, -50%);
-bs-cancel-hover: derive(-bs-cancel, -10%);
@ -930,7 +930,7 @@ textfield */
#cancel-button {
-fx-base: -bs-cancel;
-fx-text-fill: white;
-fx-text-fill: #444;
-fx-font-weight: bold;
}

View File

@ -304,7 +304,8 @@ class CreateOfferDataModel extends ActivatableDataModel {
String code = tradeCurrency.getCode();
tradeCurrencyCode.set(code);
paymentAccount.setSelectedTradeCurrency(tradeCurrency);
if (paymentAccount != null)
paymentAccount.setSelectedTradeCurrency(tradeCurrency);
priceFeed.setCurrencyCode(code);
}

View File

@ -313,7 +313,8 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
void initWithData(Offer.Direction direction, TradeCurrency tradeCurrency) {
dataModel.initWithData(direction, tradeCurrency);
btcValidator.setPaymentMethod(dataModel.paymentAccount.getPaymentMethod());
if (dataModel.paymentAccount != null)
btcValidator.setPaymentMethod(dataModel.paymentAccount.getPaymentMethod());
}

View File

@ -500,7 +500,6 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
button.setMinWidth(150);
button.setMaxWidth(150);
button.setGraphicTextGap(10);
button.setStyle("-fx-text-fill: white;");
}
@Override
@ -540,11 +539,13 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
iconView.setId("image-remove");
title = "Remove";
button.setId("cancel-button");
button.setStyle("-fx-text-fill: #444;"); // does not take the font colors sometimes from the style
button.setOnAction(e -> onRemoveOpenOffer(offer));
} else {
boolean isSellOffer = offer.getDirection() == Offer.Direction.SELL;
iconView.setId(isSellOffer ? "image-buy-white" : "image-sell-white");
button.setId(isSellOffer ? "buy-button" : "sell-button");
button.setStyle("-fx-text-fill: white;"); // does not take the font colors sometimes from the style
title = model.getDirectionLabel(offer);
button.setOnAction(e -> onTakeOffer(offer));
}

View File

@ -70,7 +70,7 @@ public class BtcValidator extends NumberValidator {
}
protected ValidationResult validateIfNotExceedsMaxBtcValue(String input) {
if (Coin.parseCoin(input).compareTo(paymentMethod.getMaxTradeLimitInBitcoin()) > 0)
if (paymentMethod != null && Coin.parseCoin(input).compareTo(paymentMethod.getMaxTradeLimitInBitcoin()) > 0)
return new ValidationResult(false, BSResources.get("validation.btc.toLarge", formatter.formatCoinWithCode(paymentMethod.getMaxTradeLimitInBitcoin())));
else
return new ValidationResult(true);