Format else statements on new line

Based on Manfred's existing IDEA settings
This commit is contained in:
Chris Beams 2014-08-26 15:28:18 +02:00
parent a3c4df8dc3
commit 424d4e8ff8
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73
42 changed files with 284 additions and 142 deletions

View File

@ -9,6 +9,7 @@
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="JAVA">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WRAP_LONG_LINES" value="true" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
</codeStyleSettings>

View File

@ -155,7 +155,8 @@ public class SeedNode extends Thread {
public void operationComplete(BaseFuture future) throws Exception {
if (future.isSuccess()) {
log.debug("peer online (TCP):" + peerAddress);
} else {
}
else {
log.debug("offline " + peerAddress);
}
}
@ -172,7 +173,8 @@ public class SeedNode extends Thread {
public void operationComplete(BaseFuture future) throws Exception {
if (future.isSuccess()) {
log.debug("peer online (UDP):" + peerAddress);
} else {
}
else {
log.debug("offline " + peerAddress);
}
}

View File

@ -110,7 +110,8 @@ public class AddressBasedCoinSelector extends DefaultCoinSelector {
protected boolean shouldSelect(Transaction tx) {
if (includePending) {
return isInBlockChainOrPending(tx);
} else {
}
else {
return isInBlockChain(tx);
}
}

View File

@ -129,7 +129,8 @@ public class WalletFacade {
// or progress widget to keep the user engaged whilst we initialise, but we don't.
if (params == RegTestParams.get()) {
walletAppKit.connectToLocalHost(); // You should run a regtest mode bitcoind locally.
} else if (params == MainNetParams.get()) {
}
else if (params == MainNetParams.get()) {
// Checkpoints are block headers that ship inside our app: for a new user, we pick the last header
// in the checkpoints file and then download the rest from the network. It makes things much faster.
// Checkpoint files are made using the BuildCheckpoints tool and usually we have to download the
@ -205,7 +206,8 @@ public class WalletFacade {
}
addressEntryList = persistedAddressEntryList;
registrationAddressEntry = addressEntryList.get(0);
} else {
}
else {
lock.lock();
DeterministicKey registrationKey = wallet.currentReceiveKey();
registrationAddressEntry = new AddressEntry(registrationKey, params,
@ -782,9 +784,11 @@ public class WalletFacade {
TransactionSignature txSig = new TransactionSignature(ecSig, Transaction.SigHash.ALL, false);
if (scriptPubKey.isSentToRawPubKey()) {
input.setScriptSig(ScriptBuilder.createInputScript(txSig));
} else if (scriptPubKey.isSentToAddress()) {
}
else if (scriptPubKey.isSentToAddress()) {
input.setScriptSig(ScriptBuilder.createInputScript(txSig, sigKey));
} else {
}
else {
throw new ScriptException("Don't know how to sign for this kind of scriptPubKey: " + scriptPubKey);
}
@ -896,9 +900,11 @@ public class WalletFacade {
TransactionSignature txSig = new TransactionSignature(ecSig, Transaction.SigHash.ALL, false);
if (scriptPubKey.isSentToRawPubKey()) {
input.setScriptSig(ScriptBuilder.createInputScript(txSig));
} else if (scriptPubKey.isSentToAddress()) {
}
else if (scriptPubKey.isSentToAddress()) {
input.setScriptSig(ScriptBuilder.createInputScript(txSig, sigKey));
} else {
}
else {
throw new ScriptException("Don't know how to sign for this kind of scriptPubKey: " + scriptPubKey);
}
@ -1102,7 +1108,8 @@ public class WalletFacade {
for (TransactionInput input : tx.getInputs()) {
if (input.getConnectedOutput() != null) {
log.trace(tracePrefix + " input value : " + input.getConnectedOutput().getValue().toFriendlyString());
} else {
}
else {
log.trace(tracePrefix + ": " + "Transaction already has inputs but we don't have the connected " +
"outputs, so we don't know the value.");
}

View File

@ -69,7 +69,8 @@ public class GuiceFXMLLoader {
item = cachedGUIItems.get(url);
log.debug("loaded from cache " + url);
return (T) cachedGUIItems.get(url).view;
} else {
}
else {
log.debug("load from disc " + url);
T result = loader.load();
item = new Item(result, loader.getController());

View File

@ -160,7 +160,8 @@ public class ArbitratorOverviewController extends CachedViewController implement
e.printStackTrace();
}
}
} else {
}
else {
allArbitrators.clear();
}

View File

@ -119,7 +119,8 @@ public class ArbitratorRegistrationController extends CachedViewController {
if (persistedArbitrator != null) {
arbitrator.applyPersistedArbitrator(persistedArbitrator);
applyArbitrator();
} else {
}
else {
languageList.add(LanguageUtil.getDefaultLanguageLocale());
languagesTextField.setText(BitSquareFormatter.languageLocalesToString(languageList));
}
@ -322,7 +323,8 @@ public class ArbitratorRegistrationController extends CachedViewController {
if (isEditMode) {
close();
} else {
}
else {
setupPayCollateralScreen();
accordion.setExpandedPane(payCollateralTitledPane);
}

View File

@ -133,7 +133,8 @@ public class Popups {
Action response = Popups.openErrorPopup("Application already running",
"This application is already running and cannot be started twice.", "");
if (response == Dialog.Actions.OK) Platform.exit();
} else {
}
else {
Action response = Popups.openExceptionPopup(throwable, "Exception", "",
"A critical error has occurred.\nPlease copy the exception details and send a bug report to " +
"bugs@bitsquare.io.");

View File

@ -143,7 +143,8 @@ public class ValidatedTextField extends TextField {
if (t1) {
// setStyle("-fx-font-weight: bold; -fx-text-fill: red;");
setEffect(invalidEffect);
} else {
}
else {
// setStyle("-fx-font-weight: normal; -fx-text-fill: inherit;");
setEffect(null);
}

View File

@ -156,7 +156,8 @@ public class ValidatingTextField extends TextField {
if (popOver != null) {
popOver.hide();
}
} else {
}
else {
if (popOver == null)
createErrorPopOver(validationResult.errorMessage);
else
@ -177,7 +178,8 @@ public class ValidatingTextField extends TextField {
if (errorPopupLayoutReference == null) {
point = localToScene(0, 0);
x = point.getX() + window.getX() + getWidth() + 20;
} else {
}
else {
point = errorPopupLayoutReference.localToScene(0, 0);
x = point.getX() + window.getX() + errorPopupLayoutReference.getWidth() + 20;
}

View File

@ -236,7 +236,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
if (spinner != null) {
if (getSkinnable().impl_isTreeVisible() && getSkinnable().getScene() != null) {
spinner.indeterminateTimeline.play();
} else {
}
else {
spinner.indeterminateTimeline.pause();
getChildren().remove(spinner);
spinner = null;
@ -258,7 +259,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
spinner = null;
timelineNulled = true;
}
} else {
}
else {
if (getSkinnable().getScene() != null && getSkinnable().isIndeterminate()) {
timelineNulled = false;
spinner = new IndeterminateSpinner(
@ -301,7 +303,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
if (getSkinnable().impl_isTreeVisible()) {
spinner.indeterminateTimeline.play();
}
} else {
}
else {
// clean up after spinner
if (spinner != null) {
spinner.indeterminateTimeline.stop();
@ -329,7 +332,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
if (spinner != null && getSkinnable().isIndeterminate()) {
spinner.layoutChildren();
spinner.resizeRelocate(0, 0, w, h);
} else if (determinateIndicator != null) {
}
else if (determinateIndicator != null) {
determinateIndicator.layoutChildren();
determinateIndicator.resizeRelocate(0, 0, w, h);
}
@ -433,7 +437,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
progress.setStyle("-fx-background-color: rgba(" + ((int) (255 * c.getRed())) + "," +
"" + ((int) (255 * c.getGreen())) + "," + ((int) (255 * c.getBlue())) + "," +
"" + c.getOpacity() + ");");
} else {
}
else {
progress.setStyle(null);
}
}
@ -651,7 +656,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
if (indeterminateTimeline != null) {
if (pause) {
indeterminateTimeline.pause();
} else {
}
else {
indeterminateTimeline.play();
}
}
@ -690,7 +696,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
region.setStyle("-fx-background-color: rgba(" + ((int) (255 * c.getRed())) + "," +
"" + ((int) (255 * c.getGreen())) + "," + ((int) (255 * c.getBlue())) + "," +
"" + c.getOpacity() + ");");
} else {
}
else {
region.setStyle(null);
}
pathsG.getChildren().add(region);
@ -719,7 +726,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
InvalidationListener treeVisibilityListener = valueModel -> {
if (piSkin.skin.getSkinnable().impl_isTreeVisible()) {
piSkin.pauseIndicator(false);
} else {
}
else {
piSkin.pauseIndicator(true);
}
};
@ -734,7 +742,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
Region region = (Region) child;
if (region.getShape() != null) {
w = Math.max(w, region.getShape().getLayoutBounds().getMaxX());
} else {
}
else {
w = Math.max(w, region.prefWidth(height));
}
}
@ -750,7 +759,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
Region region = (Region) child;
if (region.getShape() != null) {
h = Math.max(h, region.getShape().getLayoutBounds().getMaxY());
} else {
}
else {
h = Math.max(h, region.prefHeight(width));
}
}
@ -768,7 +778,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
region.resize(region.getShape().getLayoutBounds().getMaxX(),
region.getShape().getLayoutBounds().getMaxY());
region.getTransforms().setAll(new Scale(scale, scale, 0, 0));
} else {
}
else {
region.autosize();
}
});

View File

@ -140,7 +140,8 @@ public class DepositController extends CachedViewController {
log.info("Show trade details " + item.getAddressEntry().getOfferId()));
}
setGraphic(hyperlink);
} else {
}
else {
setGraphic(null);
setId(null);
}
@ -164,7 +165,8 @@ public class DepositController extends CachedViewController {
if (item != null && !empty) {
setGraphic(item.getBalanceLabel());
} else {
}
else {
setGraphic(null);
}
}
@ -202,7 +204,8 @@ public class DepositController extends CachedViewController {
clipboard.setContent(content);
});
} else {
}
else {
setGraphic(null);
}
}
@ -227,7 +230,8 @@ public class DepositController extends CachedViewController {
if (item != null && !empty) {
setGraphic(item.getProgressIndicator());
} else {
}
else {
setGraphic(null);
}
}

View File

@ -130,7 +130,8 @@ public class TransactionsController extends CachedViewController {
hyperlink.setOnAction(event -> log.info("Show trade details " + item
.getAddressString()));
setGraphic(hyperlink);
} else {
}
else {
setGraphic(null);
setId(null);
}
@ -157,7 +158,8 @@ public class TransactionsController extends CachedViewController {
if (item != null && !empty) {
setGraphic(item.getProgressIndicator());
} else {
}
else {
setGraphic(null);
}
}

View File

@ -61,12 +61,14 @@ public class TransactionsListItem {
address =
transactionOutput.getScriptPubKey().getToAddress(walletFacade.getWallet().getParams());
addressString = address.toString();
} else {
}
else {
addressString = "No sent to address script used.";
}
}
}
} else if (valueSentFromMe.isZero()) {
}
else if (valueSentFromMe.isZero()) {
//TODO use BitSquareFormatter
amount.set(valueSentToMe.toFriendlyString());
type.set("Received with");
@ -78,12 +80,14 @@ public class TransactionsListItem {
address =
transactionOutput.getScriptPubKey().getToAddress(walletFacade.getWallet().getParams());
addressString = address.toString();
} else {
}
else {
addressString = "No sent to address script used.";
}
}
}
} else {
}
else {
//TODO use BitSquareFormatter
amount.set(valueSentToMe.subtract(valueSentFromMe).toFriendlyString());
@ -96,7 +100,8 @@ public class TransactionsListItem {
address = transactionOutput.getScriptPubKey().getToAddress(walletFacade.getWallet().getParams
());
addressString = address.toString();
} else {
}
else {
addressString = "No sent to address script used.";
}
}
@ -104,7 +109,8 @@ public class TransactionsListItem {
if (outgoing) {
type.set("Sent to");
} else {
}
else {
type.set("Internal (TX Fee)");
addressString = "Internal swap between addresses.";
}

View File

@ -114,7 +114,8 @@ public class WithdrawalController extends CachedViewController {
amountTextField.setText(newValue.getBalance().toPlainString());
withdrawFromTextField.setText(newValue.getAddressEntry().getAddressString());
changeAddressTextField.setText(newValue.getAddressEntry().getAddressString());
} else {
}
else {
withdrawFromTextField.setText("");
withdrawFromTextField.setPromptText("No fund to withdrawal on that address.");
amountTextField.setText("");
@ -186,7 +187,8 @@ public class WithdrawalController extends CachedViewController {
}
}
} else {
}
else {
Popups.openErrorPopup("Insufficient amount",
"The amount to transfer is lower the the transaction fee and the min. possible tx value.");
}
@ -232,7 +234,8 @@ public class WithdrawalController extends CachedViewController {
().getOfferId()));
}
setGraphic(hyperlink);
} else {
}
else {
setGraphic(null);
setId(null);
}
@ -289,7 +292,8 @@ public class WithdrawalController extends CachedViewController {
clipboard.setContent(content);
});
} else {
}
else {
setGraphic(null);
}
}
@ -314,7 +318,8 @@ public class WithdrawalController extends CachedViewController {
if (item != null && !empty) {
setGraphic(item.getProgressIndicator());
} else {
}
else {
setGraphic(null);
}
}

View File

@ -136,7 +136,8 @@ public class OfferController extends CachedViewController {
Tooltip.install(hyperlink, tooltip);
hyperlink.setOnAction(event -> openOfferDetails(item));
setGraphic(hyperlink);
} else {
}
else {
setGraphic(null);
setId(null);
}
@ -170,7 +171,8 @@ public class OfferController extends CachedViewController {
if (offerListItem != null) {
button.setOnAction(event -> removeOffer(offerListItem));
setGraphic(button);
} else {
}
else {
setGraphic(null);
}
}

View File

@ -232,14 +232,16 @@ public class PendingTradeController extends CachedViewController {
if (transaction == null) {
trade.depositTxChangedProperty().addListener((observableValue, aBoolean, aBoolean2) ->
updateTx(trade.getDepositTransaction()));
} else {
}
else {
updateTx(trade.getDepositTransaction());
}
// back details
if (trade.getContract() != null) {
setBankData(trade);
} else {
}
else {
trade.contractChangedProperty().addListener((observableValue, aBoolean, aBoolean2) -> setBankData(trade));
}
@ -385,7 +387,8 @@ public class PendingTradeController extends CachedViewController {
BankAccountType bankAccountType = tradesTableItem.getTrade().getOffer()
.getBankAccountType();
setText(Localisation.get(bankAccountType.toString()));
} else {
}
else {
setText("");
}
}
@ -422,7 +425,8 @@ public class PendingTradeController extends CachedViewController {
if (offer.getDirection() == Direction.SELL) {
icon = buyIcon;
title = BitSquareFormatter.formatDirection(Direction.BUY, true);
} else {
}
else {
icon = sellIcon;
title = BitSquareFormatter.formatDirection(Direction.SELL, true);
}
@ -430,7 +434,8 @@ public class PendingTradeController extends CachedViewController {
iconView.setImage(icon);
button.setText(title);
setGraphic(button);
} else {
}
else {
setGraphic(null);
}
}
@ -456,7 +461,8 @@ public class PendingTradeController extends CachedViewController {
if (tradesTableItem != null) {
button.setOnAction(event -> showTradeDetails(tradesTableItem));
setGraphic(button);
} else {
}
else {
setGraphic(null);
}
}

View File

@ -105,7 +105,8 @@ public class SettingsController extends CachedViewController {
languageList = FXCollections.observableArrayList(settings.getAcceptedLanguageLocales());
countryList = FXCollections.observableArrayList(settings.getAcceptedCountries());
arbitratorList = FXCollections.observableArrayList(settings.getAcceptedArbitrators());
} else {
}
else {
languageList = FXCollections.observableArrayList(new ArrayList<>());
countryList = FXCollections.observableArrayList(new ArrayList<>());
arbitratorList = FXCollections.observableArrayList(new ArrayList<>());
@ -314,7 +315,8 @@ public class SettingsController extends CachedViewController {
label.setText(item.getDisplayName());
removeButton.setOnAction(actionEvent -> removeLanguage(item));
setGraphic(hBox);
} else {
}
else {
setGraphic(null);
}
}
@ -384,7 +386,8 @@ public class SettingsController extends CachedViewController {
label.setText(item.getName());
removeButton.setOnAction(actionEvent -> removeCountry(item));
setGraphic(hBox);
} else {
}
else {
setGraphic(null);
}
}
@ -441,7 +444,8 @@ public class SettingsController extends CachedViewController {
label.setText(item.getName());
removeButton.setOnAction(actionEvent -> removeArbitrator(item));
setGraphic(hBox);
} else {
}
else {
setGraphic(null);
}
}
@ -503,7 +507,8 @@ public class SettingsController extends CachedViewController {
bankAccountPrimaryIDTextField.setPromptText(currentBankAccount.getBankAccountType().getPrimaryId());
bankAccountSecondaryIDTextField.setText(currentBankAccount.getAccountSecondaryID());
bankAccountSecondaryIDTextField.setPromptText(currentBankAccount.getBankAccountType().getSecondaryId());
} else {
}
else {
resetBankAccountInput();
}
}
@ -553,7 +558,8 @@ public class SettingsController extends CachedViewController {
if (user.getBankAccounts().isEmpty()) {
bankAccountComboBox.setPromptText("No bank account available");
bankAccountComboBox.setDisable(true);
} else {
}
else {
bankAccountComboBox.setPromptText("Select bank account");
bankAccountComboBox.setDisable(false);
bankAccountComboBox.setItems(FXCollections.observableArrayList(user.getBankAccounts()));

View File

@ -102,7 +102,8 @@ public class TradeController extends CachedViewController {
orderBookController = orderBookLoader.getController();
orderBookController.setParentController(this);
return orderBookController;
} else if (navigationItem == NavigationItem.CREATE_OFFER) {
}
else if (navigationItem == NavigationItem.CREATE_OFFER) {
checkArgument(createOfferController == null);
// CreateOffer and TakeOffer must not be cached by GuiceFXMLLoader as we cannot use a view multiple times
@ -121,7 +122,8 @@ public class TradeController extends CachedViewController {
log.error(e.getMessage());
}
return null;
} else if (navigationItem == NavigationItem.TAKE_OFFER) {
}
else if (navigationItem == NavigationItem.TAKE_OFFER) {
checkArgument(takerOfferController == null);
// CreateOffer and TakeOffer must not be cached by GuiceFXMLLoader as we cannot use a view multiple times
@ -140,7 +142,8 @@ public class TradeController extends CachedViewController {
log.error(e.getMessage());
}
return null;
} else {
}
else {
log.error("navigationItem not supported: " + navigationItem);
return null;
}

View File

@ -226,7 +226,8 @@ public class OrderBookController extends CachedViewController {
ViewController nextController = parentController.loadViewAndGetChildController(NavigationItem.CREATE_OFFER);
if (nextController != null)
((CreateOfferController) nextController).setOrderBookFilter(orderBookFilter);
} else {
}
else {
showRegistrationDialog();
}
}
@ -253,7 +254,8 @@ public class OrderBookController extends CachedViewController {
if (walletFacade.isRegistrationFeeBalanceSufficient()) {
if (walletFacade.isRegistrationFeeConfirmed()) {
selectedIndex = 2;
} else {
}
else {
Action response = Popups.openErrorPopup("Registration fee not confirmed yet",
"The registration fee transaction has not been confirmed yet in the blockchain. " +
"Please wait until it has at least 1 confirmation.");
@ -261,7 +263,8 @@ public class OrderBookController extends CachedViewController {
MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.FUNDS);
}
}
} else {
}
else {
Action response = Popups.openErrorPopup("Missing registration fee",
"You have not funded the full registration fee of " + BitSquareFormatter
.formatCoinWithCode(FeePolicy.ACCOUNT_REGISTRATION_FEE) + " BTC.");
@ -269,10 +272,12 @@ public class OrderBookController extends CachedViewController {
MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.FUNDS);
}
}
} else {
}
else {
selectedIndex = 1;
}
} else {
}
else {
selectedIndex = 0;
}
@ -295,9 +300,11 @@ public class OrderBookController extends CachedViewController {
selectedIndex);
if (registrationMissingAction == settingsCommandLink) {
MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.SETTINGS);
} else if (registrationMissingAction == depositFeeCommandLink) {
}
else if (registrationMissingAction == depositFeeCommandLink) {
MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.FUNDS);
} else if (registrationMissingAction == sendRegistrationCommandLink) {
}
else if (registrationMissingAction == sendRegistrationCommandLink) {
payRegistrationFee();
}
}
@ -338,14 +345,16 @@ public class OrderBookController extends CachedViewController {
Coin requestedAmount;
if (!"".equals(amount.getText())) {
requestedAmount = BitSquareFormatter.parseToCoin(amount.getText());
} else {
}
else {
requestedAmount = offer.getAmount();
}
if (takerOfferController != null) {
takerOfferController.initWithData(offer, requestedAmount);
}
} else {
}
else {
showRegistrationDialog();
}
}
@ -370,7 +379,8 @@ public class OrderBookController extends CachedViewController {
pollingTimer = Utilities.setInterval(1000, (animationTimer) -> {
if (user.getCurrentBankAccount() != null) {
messageFacade.getDirtyFlag(user.getCurrentBankAccount().getCurrency());
} else {
}
else {
messageFacade.getDirtyFlag(CurrencyUtil.getDefaultCurrency());
}
return null;
@ -414,11 +424,13 @@ public class OrderBookController extends CachedViewController {
icon = ImageUtil.getIconImage(ImageUtil.REMOVE);
title = "Remove";
button.setOnAction(event -> removeOffer(orderBookListItem.getOffer()));
} else {
}
else {
if (offer.getDirection() == Direction.SELL) {
icon = buyIcon;
title = BitSquareFormatter.formatDirection(Direction.BUY, true);
} else {
}
else {
icon = sellIcon;
title = BitSquareFormatter.formatDirection(Direction.SELL, true);
}
@ -431,7 +443,8 @@ public class OrderBookController extends CachedViewController {
iconView.setImage(icon);
button.setText(title);
setGraphic(button);
} else {
}
else {
setGraphic(null);
}
}
@ -497,7 +510,8 @@ public class OrderBookController extends CachedViewController {
if (orderBookListItem != null) {
BankAccountType bankAccountType = orderBookListItem.getOffer().getBankAccountType();
setText(Localisation.get(bankAccountType.toString()));
} else {
}
else {
setText("");
}
}

View File

@ -155,16 +155,20 @@ public class TakerOfferController extends CachedViewController {
// TODO more validation (fee payment, blacklist,...)
if (amountTextField.isInvalid()) {
Popups.openErrorPopup("Invalid input", "The requested amount you entered is not a valid amount.");
} else if (BitSquareValidator.tradeAmountOutOfRange(amount, offer)) {
}
else if (BitSquareValidator.tradeAmountOutOfRange(amount, offer)) {
Popups.openErrorPopup(
"Invalid input", "The requested amount you entered is outside of the range of the offered amount.");
} else if (addressEntry == null ||
}
else if (addressEntry == null ||
getTotal().compareTo(walletFacade.getBalanceForAddress(addressEntry.getAddress())) > 0) {
Popups.openErrorPopup("Insufficient money", "You don't have enough funds for that trade.");
} else if (tradeManager.isOfferAlreadyInTrades(offer)) {
}
else if (tradeManager.isOfferAlreadyInTrades(offer)) {
Popups.openErrorPopup("Offer previously accepted",
"You have that offer already taken. Open the offer section to find that trade.");
} else {
}
else {
takeOfferButton.setDisable(true);
amountTextField.setEditable(false);
tradeManager.takeOffer(amount, offer, new ProtocolForTakerAsSellerListener() {

View File

@ -103,7 +103,8 @@ public class BitSquareValidator {
textField.setEffect(invalidEffect);
textField.setStyle(invalidStyle);
throw new ValidationException();
} else {
}
else {
double val = Double.parseDouble(input);
if (val <= 0) {
textField.setEffect(invalidEffect);

View File

@ -182,7 +182,8 @@ public class ConfidenceDisplay {
if (transaction.getUpdateTime().compareTo(latestTransaction.getUpdateTime()) > 0) {
latestTransaction = transaction;
}
} else {
}
else {
latestTransaction = transaction;
}
}

View File

@ -91,17 +91,20 @@ public class ValidationHelper {
"Amount cannot be smaller than minimum amount.",
NumberValidator.ErrorType.AMOUNT_LESS_THAN_MIN_AMOUNT));
amountTextField.reValidate();
} else {
}
else {
amountValidator.overrideResult(null);
minAmountTextField.reValidate();
}
} else if (currentTextField == minAmountTextField) {
}
else if (currentTextField == minAmountTextField) {
if (Double.parseDouble(minAmountCleaned) > Double.parseDouble(amountCleaned)) {
minAmountValidator.overrideResult(new NumberValidator.ValidationResult(false,
"Minimum amount cannot be larger than amount.",
NumberValidator.ErrorType.MIN_AMOUNT_LARGER_THAN_MIN_AMOUNT));
minAmountTextField.reValidate();
} else {
}
else {
minAmountValidator.overrideResult(null);
amountTextField.reValidate();
}

View File

@ -137,7 +137,8 @@ public class CountryUtil {
private static String getRegionCode(String countryCode) {
if (!countryCode.isEmpty() && countryCodeList.contains(countryCode)) {
return regionCodeList.get(countryCodeList.indexOf(countryCode));
} else {
}
else {
return "Undefined";
}
}

View File

@ -73,7 +73,8 @@ class UTF8Control extends ResourceBundle.Control {
stream = connection.getInputStream();
}
}
} else {
}
else {
stream = loader.getResourceAsStream(resourceName);
}
if (stream != null) {

View File

@ -200,7 +200,8 @@ public class BootstrappedPeerFactory {
settableFuture.set(peerDHT);
persistence.write(ref, "lastSuccessfulBootstrap", "default");
} else {
}
else {
log.warn("Discover has failed. Reason: " + futureDiscover.failedReason());
log.warn("We are probably behind a NAT and not reachable to other peers. We try port forwarding " +
"as next step.");
@ -235,7 +236,8 @@ public class BootstrappedPeerFactory {
settableFuture.set(peerDHT);
persistence.write(ref, "lastSuccessfulBootstrap", "portForwarding");
} else {
}
else {
log.warn("Port forwarding has failed. Reason: " + futureNAT.failedReason());
log.warn("We try to use a relay as next step.");
@ -269,7 +271,8 @@ public class BootstrappedPeerFactory {
log.debug("Bootstrap was successful. bootstrapTo = " + futureBootstrap.bootstrapTo());
setupRelay(peerDHT, nodeBehindNat, getBootstrapAddress());
} else {
}
else {
log.error("Bootstrap failed. Reason:" + futureBootstrap.failedReason());
settableFuture.setException(new Exception(futureBootstrap.failedReason()));
}
@ -293,7 +296,8 @@ public class BootstrappedPeerFactory {
futureRelay.relays().forEach(e -> log.debug("remotePeer = " + e.remotePeer()));
findNeighbors2(peerDHT, nodeBehindNat, bootstrapAddress);
} else {
}
else {
log.error("setupRelay failed. Reason: " + futureRelay.failedReason());
log.error("Bootstrap failed. We give up...");
settableFuture.setException(new Exception(futureRelay.failedReason()));
@ -326,7 +330,8 @@ public class BootstrappedPeerFactory {
settableFuture.set(peerDHT);
persistence.write(ref, "lastSuccessfulBootstrap", "relay");
} else {
}
else {
log.error("Bootstrap 2 failed. Reason:" + futureBootstrap2.failedReason());
log.error("We give up...");
settableFuture.setException(new Exception(futureBootstrap2.failedReason()));

View File

@ -141,7 +141,8 @@ public class MessageFacade implements MessageBroker {
if (baseFuture.isSuccess() && futureGet.data() != null) {
final PeerAddress peerAddress = (PeerAddress) futureGet.data().object();
Platform.runLater(() -> listener.onResult(peerAddress));
} else {
}
else {
Platform.runLater(() -> listener.onFailed());
}
}
@ -180,7 +181,8 @@ public class MessageFacade implements MessageBroker {
log.trace("Add offer to DHT was successful. Stored data: [key: " + locationKey + ", " +
"value: " + data + "]");
});
} else {
}
else {
Platform.runLater(() -> {
addOfferListener.onFailed("Add offer to DHT failed.",
new Exception("Add offer to DHT failed. Reason: " + future.failedReason()));
@ -221,7 +223,8 @@ public class MessageFacade implements MessageBroker {
if (future.isSuccess()) {
log.trace("Remove offer from DHT was successful. Stored data: [key: " + locationKey + ", " +
"value: " + data + "]");
} else {
}
else {
log.error("Remove offer from DHT failed. Reason: " + future.failedReason());
}
}
@ -247,7 +250,8 @@ public class MessageFacade implements MessageBroker {
if (baseFuture.isSuccess()) {
//log.trace("Get offers from DHT was successful. Stored data: [key: " + locationKey + ",
// values: " + futureGet.dataMap() + "]");
} else {
}
else {
log.error("Get offers from DHT failed with reason:" + baseFuture.failedReason());
}
}
@ -267,7 +271,8 @@ public class MessageFacade implements MessageBroker {
public void operationComplete(BaseFuture future) throws Exception {
if (futureDirect.isSuccess()) {
Platform.runLater(() -> listener.onResult());
} else {
}
else {
Platform.runLater(() -> listener.onFailed());
}
}
@ -298,7 +303,8 @@ public class MessageFacade implements MessageBroker {
if (addFuture.isSuccess()) {
log.trace("Add arbitrator to DHT was successful. Stored data: [key: " + locationKey + ", " +
"values: " + arbitratorData + "]");
} else {
}
else {
log.error("Add arbitrator to DHT failed with reason:" + addFuture.failedReason());
}
}
@ -322,7 +328,8 @@ public class MessageFacade implements MessageBroker {
if (removeFuture.isSuccess()) {
log.trace("Remove arbitrator from DHT was successful. Stored data: [key: " + locationKey + ", " +
"values: " + arbitratorData + "]");
} else {
}
else {
log.error("Remove arbitrators from DHT failed with reason:" + removeFuture.failedReason());
}
}
@ -340,7 +347,8 @@ public class MessageFacade implements MessageBroker {
if (baseFuture.isSuccess()) {
log.trace("Get arbitrators from DHT was successful. Stored data: [key: " + locationKey + ", " +
"values: " + futureGet.dataMap() + "]");
} else {
}
else {
log.error("Get arbitrators from DHT failed with reason:" + baseFuture.failedReason());
}
}
@ -432,7 +440,8 @@ public class MessageFacade implements MessageBroker {
}
if (lastTimeStamp > 0) {
lastTimeStamp = timeStamp;
} else {
}
else {
lastTimeStamp++;
}
}

View File

@ -214,7 +214,8 @@ public class P2PNode {
public void operationComplete(BaseFuture future) throws Exception {
if (futureDirect.isSuccess()) {
log.debug("sendMessage completed");
} else {
}
else {
log.error("sendData failed with Reason " + futureDirect.failedReason());
}
}
@ -248,7 +249,8 @@ public class P2PNode {
if (future.isSuccess()) {
storedPeerAddress = peerDHT.peerAddress();
log.debug("storedPeerAddress = " + storedPeerAddress);
} else {
}
else {
log.error("");
}
}
@ -258,7 +260,8 @@ public class P2PNode {
log.error(t.toString());
}
});
} else {
}
else {
log.error("peerDHT is null");
}
} catch (IOException | ClassNotFoundException e) {
@ -325,7 +328,8 @@ public class P2PNode {
} catch (IOException e) {
e.printStackTrace();
}
} else {
}
else {
storage = new StorageMemory();
}
}

View File

@ -70,7 +70,8 @@ public class Persistence {
} finally {
lock.unlock();
}
} else {
}
else {
rootMap = map;
}
} finally {
@ -144,7 +145,8 @@ public class Persistence {
if (rootMap.containsKey(key)) {
// log.trace("Read object with key = " + key + " / value = " + rootMap.get(key));
return rootMap.get(key);
} else {
}
else {
final Map<String, Serializable> map = readRootMap();
if (map != null) {
rootMap = map;
@ -152,7 +154,8 @@ public class Persistence {
if (rootMap.containsKey(key)) {
// log.trace("Read object with key = " + key + " / value = " + rootMap.get(key));
return rootMap.get(key);
} else {
}
else {
log.info("Object with key = " + key + " not found.");
return null;
}
@ -174,11 +177,13 @@ public class Persistence {
if (object == null) {
log.error("readRootMap returned null object.");
return null;
} else {
}
else {
if (object instanceof Map) {
//noinspection unchecked
return (Map<String, Serializable>) object;
} else {
}
else {
log.error("Object is not type of Map<String, Serializable>");
return null;
}

View File

@ -97,14 +97,16 @@ public class TradeManager {
Object offersObject = persistence.read(this, "offers");
if (offersObject instanceof HashMap) {
offers = (Map<String, Offer>) offersObject;
} else {
}
else {
offers = new HashMap<>();
}
Object tradesObject = persistence.read(this, "trades");
if (tradesObject instanceof HashMap) {
trades = (Map<String, Trade>) tradesObject;
} else {
}
else {
trades = new HashMap<>();
}
@ -164,7 +166,8 @@ public class TradeManager {
if (createOfferCoordinatorMap.containsKey(offer.getId())) {
errorMessageHandler.onFault("A createOfferCoordinator for the offer with the id " + offer.getId() + " " +
"already exists.");
} else {
}
else {
CreateOfferCoordinator createOfferCoordinator = new CreateOfferCoordinator(persistence,
offer,
walletFacade,
@ -332,14 +335,16 @@ public class TradeManager {
if (!offererAsBuyerProtocolMap.containsKey(trade.getId())) {
offererAsBuyerProtocolMap.put(trade.getId(), protocolForOffererAsBuyer);
} else {
}
else {
// We don't store the protocol in case we have already a pending offer. The protocol is only
// temporary used to reply with a reject message.
log.trace("offererAsBuyerProtocol not stored as offer is already pending.");
}
protocolForOffererAsBuyer.start();
} else {
}
else {
log.warn("Incoming offer take request does not match with any saved offer. We ignore that request.");
}
}
@ -365,22 +370,29 @@ public class TradeManager {
if (tradeMessage instanceof RequestTakeOfferMessage) {
createOffererAsBuyerProtocol(tradeId, sender);
takeOfferRequestListeners.stream().forEach(e -> e.onTakeOfferRequested(tradeId, sender));
} else if (tradeMessage instanceof RespondToTakeOfferRequestMessage) {
}
else if (tradeMessage instanceof RespondToTakeOfferRequestMessage) {
takerAsSellerProtocolMap.get(tradeId).onRespondToTakeOfferRequestMessage(
(RespondToTakeOfferRequestMessage) tradeMessage);
} else if (tradeMessage instanceof TakeOfferFeePayedMessage) {
}
else if (tradeMessage instanceof TakeOfferFeePayedMessage) {
offererAsBuyerProtocolMap.get(tradeId).onTakeOfferFeePayedMessage((TakeOfferFeePayedMessage) tradeMessage);
} else if (tradeMessage instanceof RequestTakerDepositPaymentMessage) {
}
else if (tradeMessage instanceof RequestTakerDepositPaymentMessage) {
takerAsSellerProtocolMap.get(tradeId).onRequestTakerDepositPaymentMessage(
(RequestTakerDepositPaymentMessage) tradeMessage);
} else if (tradeMessage instanceof RequestOffererPublishDepositTxMessage) {
}
else if (tradeMessage instanceof RequestOffererPublishDepositTxMessage) {
offererAsBuyerProtocolMap.get(tradeId).onRequestOffererPublishDepositTxMessage(
(RequestOffererPublishDepositTxMessage) tradeMessage);
} else if (tradeMessage instanceof DepositTxPublishedMessage) {
}
else if (tradeMessage instanceof DepositTxPublishedMessage) {
takerAsSellerProtocolMap.get(tradeId).onDepositTxPublishedMessage((DepositTxPublishedMessage) tradeMessage);
} else if (tradeMessage instanceof BankTransferInitedMessage) {
}
else if (tradeMessage instanceof BankTransferInitedMessage) {
takerAsSellerProtocolMap.get(tradeId).onBankTransferInitedMessage((BankTransferInitedMessage) tradeMessage);
} else if (tradeMessage instanceof PayoutTxPublishedMessage) {
}
else if (tradeMessage instanceof PayoutTxPublishedMessage) {
offererAsBuyerProtocolMap.get(tradeId).onPayoutTxPublishedMessage((PayoutTxPublishedMessage) tradeMessage);
}
}
@ -436,7 +448,8 @@ public class TradeManager {
public Trade getTrade(String tradeId) {
if (trades.containsKey(tradeId)) {
return trades.get(trades);
} else {
}
else {
return null;
}
}

View File

@ -93,7 +93,8 @@ public class OrderBook implements OrderBookListener {
public void loadOffers() {
if (user.getCurrentBankAccount() != null) {
messageFacade.getOffers(user.getCurrentBankAccount().getCurrency().getCurrencyCode());
} else {
}
else {
messageFacade.getOffers(CurrencyUtil.getDefaultCurrency().getCurrencyCode());
}
}
@ -135,7 +136,8 @@ public class OrderBook implements OrderBookListener {
if (orderBookFilter.getPrice() > 0) {
if (offer.getDirection() == Direction.SELL) {
priceResult = orderBookFilter.getPrice() >= offer.getPrice();
} else {
}
else {
priceResult = orderBookFilter.getPrice() <= offer.getPrice();
}
}
@ -216,7 +218,8 @@ public class OrderBook implements OrderBookListener {
e.printStackTrace();
}
}
} else {
}
else {
allOffers.clear();
}
}
@ -233,7 +236,8 @@ public class OrderBook implements OrderBookListener {
} catch (ClassNotFoundException | IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
} else {
}
else {
log.warn("onOfferRemoved failed");
}
}

View File

@ -43,7 +43,8 @@ public class BroadCastOfferFeeTx {
} catch (Exception e) {
faultHandler.onFault("Offer fee payment failed.", e);
}
} else {
}
else {
faultHandler.onFault("Offer fee payment failed.",
new Exception("Offer fee payment failed. Transaction = null."));
}

View File

@ -170,7 +170,8 @@ public class ProtocolForOffererAsBuyer {
messageFacade.removeOffer(offer);
listener.onOfferAccepted(offer);
listener.onWaitingForPeerResponse(state);
} else {
}
else {
log.info("Finish here as we have already the offer accepted.");
}
}

View File

@ -34,10 +34,12 @@ public class VerifyPeerAccount {
if (blockChainFacade.isAccountBlackListed(peersAccountId, peersBankAccount)) {
log.error("Taker is blacklisted");
exceptionHandler.onError(new Exception("Taker is blacklisted"));
} else {
}
else {
resultHandler.onResult();
}
} else {
}
else {
log.error("Account registration validation for peer faultHandler.onFault.");
exceptionHandler.onError(new Exception("Account registration validation for peer faultHandler.onFault."));
}

View File

@ -185,7 +185,8 @@ public class ProtocolForTakerAsSeller {
if (message.isTakeOfferRequestAccepted()) {
state = State.PayTakeOfferFee;
PayTakeOfferFee.run(this::onResultPayTakeOfferFee, this::onFault, walletFacade, tradeId);
} else {
}
else {
listener.onTakeOfferRequestRejected(trade);
// exit case
}

View File

@ -107,7 +107,8 @@ public class Arbitrator implements Serializable {
public int hashCode() {
if (id != null) {
return Objects.hashCode(id);
} else {
}
else {
return 0;
}
}

View File

@ -64,7 +64,8 @@ public class User implements Serializable {
messageKeyPair = persistedUser.getMessageKeyPair();
accountID = persistedUser.getAccountId();
setCurrentBankAccount(persistedUser.getCurrentBankAccount());
} else {
}
else {
// First time
bankAccounts = new ArrayList<>();
messageKeyPair = DSAKeyUtil.generateKeyPair(); // DSAKeyUtil.getKeyPair() runs in same thread now

View File

@ -65,7 +65,8 @@ public class AWTSystemTray {
showGuiItem.setLabel("Open exchange window");
Platform.runLater(stage::hide);
isStageVisible = false;
} else {
}
else {
showGuiItem.setLabel("Close exchange window");
Platform.runLater(stage::show);
isStageVisible = true;
@ -82,7 +83,8 @@ public class AWTSystemTray {
} catch (AWTException e) {
log.error("TrayIcon could not be added.");
}
} else {
}
else {
log.error("SystemTray is not supported");
}
}

View File

@ -84,7 +84,8 @@ public class FileUtil {
if (!tempFile.renameTo(canonical)) {
throw new IOException("Failed to rename " + tempFile + " to " + canonical);
}
} else if (!tempFile.renameTo(file)) {
}
else if (!tempFile.renameTo(file)) {
throw new IOException("Failed to rename " + tempFile + " to " + file);
}

View File

@ -19,7 +19,7 @@ package io.bitsquare.gui.util;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
public class BitSquareConverterTest {

View File

@ -134,7 +134,8 @@ public class UtilsDHT2 {
.externalBindings(bindings).peerMap(peerMap).start().addAutomaticFuture(automaticFuture);
peers[0] = new PeerBuilderDHT(master).start();
} else {
}
else {
Number160 peerId = new Number160(rnd);
PeerMap peerMap = new PeerMap(new PeerMapConfiguration(peerId));
master = new PeerBuilder(peerId).enableMaintenance(maintenance).externalBindings(bindings)
@ -151,7 +152,8 @@ public class UtilsDHT2 {
.enableMaintenance(maintenance).enableMaintenance(maintenance).peerMap(peerMap)
.externalBindings(bindings).start().addAutomaticFuture(automaticFuture);
peers[i] = new PeerBuilderDHT(peer).start();
} else {
}
else {
Number160 peerId = new Number160(rnd);
PeerMap peerMap = new PeerMap(new PeerMapConfiguration(peerId).peerNoVerification());
Peer peer = new PeerBuilder(peerId).enableMaintenance(maintenance)
@ -239,7 +241,8 @@ public class UtilsDHT2 {
for (int i = 0; i < nr; i++) {
if (i == 0) {
peers[0] = new PeerBuilder(new Number160(rnd)).ports(port).start();
} else {
}
else {
peers[i] = new PeerBuilder(new Number160(rnd)).masterPeer(peers[0]).start();
}
}