add link to wiki, handle classdefnotfounderror

This commit is contained in:
Manfred Karrer 2016-01-14 14:47:10 +01:00
parent 9653ff8437
commit 2a5dc9d2af
4 changed files with 46 additions and 8 deletions

View file

@ -30,6 +30,7 @@ import io.bitsquare.btc.AddressEntry;
import io.bitsquare.btc.TradeWalletService; import io.bitsquare.btc.TradeWalletService;
import io.bitsquare.btc.WalletService; import io.bitsquare.btc.WalletService;
import io.bitsquare.btc.listeners.BalanceListener; import io.bitsquare.btc.listeners.BalanceListener;
import io.bitsquare.common.UserThread;
import io.bitsquare.gui.common.model.ViewModel; import io.bitsquare.gui.common.model.ViewModel;
import io.bitsquare.gui.components.BalanceTextField; import io.bitsquare.gui.components.BalanceTextField;
import io.bitsquare.gui.components.BalanceWithConfirmationTextField; import io.bitsquare.gui.components.BalanceWithConfirmationTextField;
@ -113,6 +114,8 @@ public class MainViewModel implements ViewModel {
private int numBTCPeers = 0; private int numBTCPeers = 0;
private Timer checkForBtcSyncStateTimer; private Timer checkForBtcSyncStateTimer;
private ChangeListener<Number> numAuthenticatedPeersListener, btcNumPeersListener; private ChangeListener<Number> numAuthenticatedPeersListener, btcNumPeersListener;
private java.util.Timer numberofBtcPeersTimer;
private java.util.Timer numberofP2PNetworkPeersTimer;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -257,10 +260,19 @@ public class MainViewModel implements ViewModel {
EasyBind.subscribe(walletService.downloadPercentageProperty(), newValue -> setBitcoinNetworkSyncProgress((double) newValue)); EasyBind.subscribe(walletService.downloadPercentageProperty(), newValue -> setBitcoinNetworkSyncProgress((double) newValue));
btcNumPeersListener = (observable, oldValue, newValue) -> { btcNumPeersListener = (observable, oldValue, newValue) -> {
if ((int) oldValue > 0 && (int) newValue == 0) if ((int) oldValue > 0 && (int) newValue == 0) {
walletServiceErrorMsg.set("You lost the connection to all bitcoin peers."); // give a bit of tolerance
else if ((int) oldValue == 0 && (int) newValue > 0) if (numberofBtcPeersTimer != null)
numberofBtcPeersTimer.cancel();
numberofBtcPeersTimer = UserThread.runAfter(() -> {
if (walletService.numPeersProperty().get() == 0)
walletServiceErrorMsg.set("You lost the connection to all bitcoin peers.");
else
walletServiceErrorMsg.set(null);
}, 2);
} else if ((int) oldValue == 0 && (int) newValue > 0) {
walletServiceErrorMsg.set(null); walletServiceErrorMsg.set(null);
}
numBTCPeers = (int) newValue; numBTCPeers = (int) newValue;
setBitcoinNetworkSyncProgress(walletService.downloadPercentageProperty().get()); setBitcoinNetworkSyncProgress(walletService.downloadPercentageProperty().get());
@ -352,6 +364,7 @@ public class MainViewModel implements ViewModel {
// tac // tac
// TODO add link: https://bitsquare.io/arbitration_system.pdf
String text = "1. This software is experimental and provided \"as is\", without warranty of any kind, " + String text = "1. This software is experimental and provided \"as is\", without warranty of any kind, " +
"express or implied, including but not limited to the warranties of " + "express or implied, including but not limited to the warranties of " +
"merchantability, fitness for a particular purpose and non-infringement.\n" + "merchantability, fitness for a particular purpose and non-infringement.\n" +
@ -360,7 +373,8 @@ public class MainViewModel implements ViewModel {
"arising from, out of or in connection with the software or the use or other dealings in the software.\n\n" + "arising from, out of or in connection with the software or the use or other dealings in the software.\n\n" +
"2. The user is responsible to use the software in compliance with local laws.\n\n" + "2. The user is responsible to use the software in compliance with local laws.\n\n" +
"3. The user confirms that he has read and agreed to the rules defined in our " + "3. The user confirms that he has read and agreed to the rules defined in our " +
"Wiki regrading the dispute process."; "Wiki regrading the dispute process\n" +
"(https://github.com/bitsquare/bitsquare/wiki/Arbitration-system).";
if (!preferences.getTacAccepted() && !BitsquareApp.DEV_MODE) if (!preferences.getTacAccepted() && !BitsquareApp.DEV_MODE)
new Popup().headLine("USER AGREEMENT") new Popup().headLine("USER AGREEMENT")
.message(text) .message(text)
@ -372,6 +386,27 @@ public class MainViewModel implements ViewModel {
// update nr of peers in footer // update nr of peers in footer
numAuthenticatedPeersListener = (observable, oldValue, newValue) -> { numAuthenticatedPeersListener = (observable, oldValue, newValue) -> {
if ((int) oldValue > 0 && (int) newValue == 0) {
// give a bit of tolerance
if (numberofP2PNetworkPeersTimer != null)
numberofP2PNetworkPeersTimer.cancel();
numberofP2PNetworkPeersTimer = UserThread.runAfter(() -> {
if (p2PService.getNumAuthenticatedPeers().get() == 0) {
p2PNetworkWarnMsg.set("You lost the connection to all P2P network peers.\n" +
"Please check your internet connection or try to restart the application.");
p2PNetworkLabelId.set("splash-error-state-msg");
} else {
p2PNetworkWarnMsg.set(null);
p2PNetworkLabelId.set("footer-pane");
}
}, 2);
} else if ((int) oldValue == 0 && (int) newValue > 0) {
p2PNetworkWarnMsg.set(null);
p2PNetworkLabelId.set("footer-pane");
}
if ((int) oldValue > 0 && (int) newValue == 0) { if ((int) oldValue > 0 && (int) newValue == 0) {
p2PNetworkWarnMsg.set("You lost the connection to all P2P network peers.\n" + p2PNetworkWarnMsg.set("You lost the connection to all P2P network peers.\n" +
"Please check your internet connection or try to restart the application."); "Please check your internet connection or try to restart the application.");

View file

@ -361,8 +361,8 @@ public class Popup {
} }
protected void setTruncatedMessage() { protected void setTruncatedMessage() {
if (message != null && message.length() > 700) if (message != null && message.length() > 800)
truncatedMessage = message.substring(0, 700) + "..."; truncatedMessage = message.substring(0, 800) + "...";
else else
truncatedMessage = message; truncatedMessage = message;
} }

View file

@ -409,7 +409,7 @@ public class Connection implements MessageListener {
} }
} }
public void handleConnectionException(Exception e) { public void handleConnectionException(Throwable e) {
Log.traceCall(e.toString()); Log.traceCall(e.toString());
if (e instanceof SocketException) { if (e instanceof SocketException) {
if (socket.isClosed()) if (socket.isClosed())
@ -422,6 +422,8 @@ public class Connection implements MessageListener {
log.debug("connection={}" + this); log.debug("connection={}" + this);
} else if (e instanceof EOFException) { } else if (e instanceof EOFException) {
shutDownReason = ConnectionListener.Reason.PEER_DISCONNECTED; shutDownReason = ConnectionListener.Reason.PEER_DISCONNECTED;
} else if (e instanceof NoClassDefFoundError || e instanceof ClassNotFoundException) {
shutDownReason = ConnectionListener.Reason.INCOMPATIBLE_DATA;
} else { } else {
shutDownReason = ConnectionListener.Reason.UNKNOWN; shutDownReason = ConnectionListener.Reason.UNKNOWN;
log.warn("Exception at socket " + socket.toString()); log.warn("Exception at socket " + socket.toString());
@ -563,7 +565,7 @@ public class Connection implements MessageListener {
} else if (!stopped) { } else if (!stopped) {
messageListener.onMessage(message, null); messageListener.onMessage(message, null);
} }
} catch (IOException | ClassNotFoundException e) { } catch (IOException | ClassNotFoundException | NoClassDefFoundError e) {
stopped = true; stopped = true;
sharedSpace.handleConnectionException(e); sharedSpace.handleConnectionException(e);
} }

View file

@ -8,6 +8,7 @@ public interface ConnectionListener {
TIMEOUT, TIMEOUT,
SHUT_DOWN, SHUT_DOWN,
PEER_DISCONNECTED, PEER_DISCONNECTED,
INCOMPATIBLE_DATA,
UNKNOWN UNKNOWN
} }