mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Fix null pointers, improve logs
This commit is contained in:
parent
972721cdba
commit
f5d05f0940
5 changed files with 26 additions and 15 deletions
|
@ -548,8 +548,9 @@ public class BtcWalletService extends WalletService {
|
||||||
"Missing " + (e.missing != null ? e.missing.toFriendlyString() : "null"));
|
"Missing " + (e.missing != null ? e.missing.toFriendlyString() : "null"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.warn("sendResult is null");
|
String errorMessage = "We could not find inputs we control in the transaction we want to double spend.";
|
||||||
errorMessageHandler.handleErrorMessage("We could not find inputs we control in the transaction we want to double spend.");
|
log.warn(errorMessage);
|
||||||
|
errorMessageHandler.handleErrorMessage(errorMessage);
|
||||||
}
|
}
|
||||||
} else if (confidenceType == TransactionConfidence.ConfidenceType.BUILDING) {
|
} else if (confidenceType == TransactionConfidence.ConfidenceType.BUILDING) {
|
||||||
errorMessageHandler.handleErrorMessage("That transaction is already in the blockchain so we cannot double spend it.");
|
errorMessageHandler.handleErrorMessage("That transaction is already in the blockchain so we cannot double spend it.");
|
||||||
|
|
|
@ -23,6 +23,7 @@ import io.bitsquare.locale.TradeCurrency;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -80,6 +81,7 @@ public abstract class PaymentAccount implements Persistable {
|
||||||
setSelectedTradeCurrency(tradeCurrency);
|
setSelectedTradeCurrency(tradeCurrency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public TradeCurrency getSingleTradeCurrency() {
|
public TradeCurrency getSingleTradeCurrency() {
|
||||||
if (!tradeCurrencies.isEmpty())
|
if (!tradeCurrencies.isEmpty())
|
||||||
return tradeCurrencies.get(0);
|
return tradeCurrencies.get(0);
|
||||||
|
|
|
@ -96,11 +96,12 @@ public class CryptoCurrencyForm extends PaymentMethodForm {
|
||||||
@Override
|
@Override
|
||||||
protected void autoFillNameTextField() {
|
protected void autoFillNameTextField() {
|
||||||
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
||||||
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
|
||||||
String address = addressInputTextField.getText();
|
|
||||||
address = StringUtils.abbreviate(address, 9);
|
|
||||||
String currency = paymentAccount.getSingleTradeCurrency() != null ? paymentAccount.getSingleTradeCurrency().getCode() : "?";
|
String currency = paymentAccount.getSingleTradeCurrency() != null ? paymentAccount.getSingleTradeCurrency().getCode() : "?";
|
||||||
accountNameTextField.setText(currency.concat(": ").concat(address));
|
if (currency != null) {
|
||||||
|
String address = addressInputTextField.getText();
|
||||||
|
address = StringUtils.abbreviate(address, 9);
|
||||||
|
accountNameTextField.setText(currency.concat(": ").concat(address));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -279,14 +279,18 @@ public class SepaForm extends PaymentMethodForm {
|
||||||
@Override
|
@Override
|
||||||
protected void autoFillNameTextField() {
|
protected void autoFillNameTextField() {
|
||||||
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
||||||
String iban = ibanInputTextField.getText();
|
TradeCurrency singleTradeCurrency = this.paymentAccount.getSingleTradeCurrency();
|
||||||
if (iban.length() > 9)
|
String currency = singleTradeCurrency != null ? singleTradeCurrency.getCode() : null;
|
||||||
iban = StringUtils.abbreviate(iban, 9);
|
if (currency != null) {
|
||||||
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
String iban = ibanInputTextField.getText();
|
||||||
CountryBasedPaymentAccount countryBasedPaymentAccount = (CountryBasedPaymentAccount) this.paymentAccount;
|
if (iban.length() > 9)
|
||||||
String country = countryBasedPaymentAccount.getCountry() != null ? countryBasedPaymentAccount.getCountry().code : "?";
|
iban = StringUtils.abbreviate(iban, 9);
|
||||||
String currency = this.paymentAccount.getSingleTradeCurrency() != null ? this.paymentAccount.getSingleTradeCurrency().getCode() : "?";
|
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
||||||
accountNameTextField.setText(method.concat(" (").concat(currency).concat("/").concat(country).concat("): ").concat(iban));
|
CountryBasedPaymentAccount countryBasedPaymentAccount = (CountryBasedPaymentAccount) this.paymentAccount;
|
||||||
|
String country = countryBasedPaymentAccount.getCountry() != null ? countryBasedPaymentAccount.getCountry().code : null;
|
||||||
|
if (country != null)
|
||||||
|
accountNameTextField.setText(method.concat(" (").concat(currency).concat("/").concat(country).concat("): ").concat(iban));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,10 @@ public class P2pNetworkListItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onLastActivityChanged(long timeStamp) {
|
private void onLastActivityChanged(long timeStamp) {
|
||||||
lastActivity.set(DurationFormatUtils.formatDuration(System.currentTimeMillis() - timeStamp, "mm:ss.SSS"));
|
// TODO
|
||||||
|
// Got one case where System.currentTimeMillis() - timeStamp resulted in a negative value,
|
||||||
|
// probably caused by a threading issue. Protect it with Math.abs for a quick fix...
|
||||||
|
lastActivity.set(DurationFormatUtils.formatDuration(Math.abs(System.currentTimeMillis() - timeStamp), "mm:ss.SSS"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue