From f009434530b32be2b7a5858551669f711eee8ea7 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Wed, 18 Nov 2015 22:58:41 +0100 Subject: [PATCH] Small fixes for v 0.3.2.1 --- .../main/java/io/bitsquare/app/Version.java | 7 +-- .../arbitration/ArbitratorService.java | 8 ++- .../java/io/bitsquare/app/BitsquareApp.java | 5 +- .../io/bitsquare/gui/popups/WebViewPopup.java | 3 +- .../io/bitsquare/p2p/peers/PeerGroup.java | 7 --- package/mac/Info.plist | 2 +- package/mac/Info.template.plist | 58 ------------------- package/mac/create_app.sh | 28 ++------- seednode/pom.xml | 2 +- .../io/bitsquare/p2p/seed/SeedNodeMain.java | 28 ++------- 10 files changed, 22 insertions(+), 126 deletions(-) delete mode 100644 package/mac/Info.template.plist diff --git a/common/src/main/java/io/bitsquare/app/Version.java b/common/src/main/java/io/bitsquare/app/Version.java index f4ba0e66a2..6f78a5d27d 100644 --- a/common/src/main/java/io/bitsquare/app/Version.java +++ b/common/src/main/java/io/bitsquare/app/Version.java @@ -24,12 +24,7 @@ public class Version { private static final Logger log = LoggerFactory.getLogger(Version.class); // The application versions - private static final int MAJOR_VERSION = 0; - private static final int MINOR_VERSION = 3; - // used as updateFX index - public static final int PATCH_VERSION = 2; - - public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION + "." + PATCH_VERSION; + public static final String VERSION = "0.3.2.1"; // The version nr. for the objects sent over the network. A change will break the serialization of old objects. // If objects are used for both network and database the network version is applied. diff --git a/core/src/main/java/io/bitsquare/arbitration/ArbitratorService.java b/core/src/main/java/io/bitsquare/arbitration/ArbitratorService.java index 7c780adb32..c5311a5458 100644 --- a/core/src/main/java/io/bitsquare/arbitration/ArbitratorService.java +++ b/core/src/main/java/io/bitsquare/arbitration/ArbitratorService.java @@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory; import javax.inject.Inject; import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; /** @@ -82,11 +83,12 @@ public class ArbitratorService { public Map getArbitrators() { // TODO java.lang.IllegalStateException: Duplicate key - final Map arbitratorsMap = p2PService.getDataMap().values().stream() + Set set = p2PService.getDataMap().values().stream() .filter(e -> e.expirablePayload instanceof Arbitrator) .map(e -> (Arbitrator) e.expirablePayload) - .collect(Collectors.toMap(e -> e.getArbitratorAddress(), e -> e)); + .collect(Collectors.toSet()); - return arbitratorsMap; + return set.stream() + .collect(Collectors.toMap(e -> e.getArbitratorAddress(), e -> e)); } } diff --git a/gui/src/main/java/io/bitsquare/app/BitsquareApp.java b/gui/src/main/java/io/bitsquare/app/BitsquareApp.java index d2cd75d03e..01f4045227 100644 --- a/gui/src/main/java/io/bitsquare/app/BitsquareApp.java +++ b/gui/src/main/java/io/bitsquare/app/BitsquareApp.java @@ -160,12 +160,13 @@ public class BitsquareApp extends Application { stop(); }); scene.setOnKeyReleased(keyEvent -> { - if (new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN).match(keyEvent) || - new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN).match(keyEvent)) { + if (new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN).match(keyEvent)) { if (BitsquareApp.IS_RELEASE_VERSION) systemTray.hideStage(); else stop(); + } else if (new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN).match(keyEvent)) { + stop(); } else if (new KeyCodeCombination(KeyCode.E, KeyCombination.SHORTCUT_DOWN).match(keyEvent)) { showEmptyWalletPopup(); } else if (new KeyCodeCombination(KeyCode.M, KeyCombination.SHORTCUT_DOWN).match(keyEvent)) { diff --git a/gui/src/main/java/io/bitsquare/gui/popups/WebViewPopup.java b/gui/src/main/java/io/bitsquare/gui/popups/WebViewPopup.java index 0579a922ae..21b43be740 100644 --- a/gui/src/main/java/io/bitsquare/gui/popups/WebViewPopup.java +++ b/gui/src/main/java/io/bitsquare/gui/popups/WebViewPopup.java @@ -17,6 +17,7 @@ package io.bitsquare.gui.popups; +import io.bitsquare.app.BitsquareApp; import io.bitsquare.common.util.Utilities; import javafx.geometry.HPos; import javafx.geometry.Insets; @@ -52,7 +53,7 @@ public class WebViewPopup extends Popup { webView.getEngine().documentProperty().addListener((observable, oldValue, newValue) -> { String heightInPx = webView.getEngine() .executeScript("window.getComputedStyle(document.body, null).getPropertyValue('height')").toString(); - double height = Double.valueOf(heightInPx.replace("px", "")) * 1.2; + double height = Math.min(Double.valueOf(heightInPx.replace("px", "")) * 1.2, BitsquareApp.getPrimaryStage().getHeight()); webView.setPrefHeight(height); stage.setMinHeight(height + gridPane.getHeight()); centerPopup(); diff --git a/network/src/main/java/io/bitsquare/p2p/peers/PeerGroup.java b/network/src/main/java/io/bitsquare/p2p/peers/PeerGroup.java index 659915dc76..3e7ad6e73c 100644 --- a/network/src/main/java/io/bitsquare/p2p/peers/PeerGroup.java +++ b/network/src/main/java/io/bitsquare/p2p/peers/PeerGroup.java @@ -166,9 +166,6 @@ public class PeerGroup implements MessageListener, ConnectionListener { Log.traceCall(message.toString()); Address peerAddress = message.address; - checkArgument(!authenticatedPeers.containsKey(peerAddress), - "We have that peer already authenticated. That must never happen."); - AuthenticationHandshake authenticationHandshake; if (!authenticationHandshakes.containsKey(peerAddress)) { // We protect that connection from getting closed by maintenance cleanup... @@ -224,8 +221,6 @@ public class PeerGroup implements MessageListener, ConnectionListener { // reached our max connection size. private void authenticateToSeedNode(Set
remainingAddresses, Address peerAddress, boolean connectToReportedAfterSuccess) { Log.traceCall(peerAddress.getFullAddress()); - checkArgument(!authenticatedPeers.containsKey(peerAddress), - "We have that peer already authenticated. That must never happen."); if (!authenticationHandshakes.containsKey(peerAddress)) { AuthenticationHandshake authenticationHandshake = new AuthenticationHandshake(networkNode, this, getMyAddress(), peerAddress); authenticationHandshakes.put(peerAddress, authenticationHandshake); @@ -338,8 +333,6 @@ public class PeerGroup implements MessageListener, ConnectionListener { private void authenticateToReportedPeer(ReportedPeer reportedPeer) { Log.traceCall(reportedPeer.toString()); final Address reportedPeerAddress = reportedPeer.address; - checkArgument(!authenticatedPeers.containsKey(reportedPeerAddress), - "We have that peer already authenticated. That must never happen."); if (!authenticationHandshakes.containsKey(reportedPeerAddress)) { AuthenticationHandshake authenticationHandshake = new AuthenticationHandshake(networkNode, this, getMyAddress(), reportedPeerAddress); authenticationHandshakes.put(reportedPeerAddress, authenticationHandshake); diff --git a/package/mac/Info.plist b/package/mac/Info.plist index e7e20d6ea3..3b9923133b 100644 --- a/package/mac/Info.plist +++ b/package/mac/Info.plist @@ -44,7 +44,7 @@ JVMAppClasspath JVMMainJarName - 2.jar + shaded.jar JVMPreferencesID bitsquare JVMOptions diff --git a/package/mac/Info.template.plist b/package/mac/Info.template.plist deleted file mode 100644 index c8dc32ca34..0000000000 --- a/package/mac/Info.template.plist +++ /dev/null @@ -1,58 +0,0 @@ - - - - - LSMinimumSystemVersion - 10.7.4 - CFBundleDevelopmentRegion - English - CFBundleAllowMixedLocalizations - - CFBundleExecutable - Bitsquare - CFBundleIconFile - package/mac/Bitsquare.icns - CFBundleIdentifier - io.bitsquare.Bitsquare - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Bitsquare - CFBundlePackageType - APPL - CFBundleShortVersionString - 1 - - - CFBundleSignature - ???? - - LSApplicationCategoryType - public.app-category.finance - CFBundleVersion - 1 - NSHumanReadableCopyright - Copyright (C) 2015 - - NSHighResolutionCapable - true - - JVMRuntime - .. - JVMMainClassName - io.bitsquare.app.core.BitsquareAppMain - JVMAppClasspath - - JVMMainJarName - JAR_NAME_STRING_GOES_HERE - JVMPreferencesID - bitsquare - JVMOptions - - - JVMUserOptions - - - - - diff --git a/package/mac/create_app.sh b/package/mac/create_app.sh index d2167e8c61..cbd61537ff 100644 --- a/package/mac/create_app.sh +++ b/package/mac/create_app.sh @@ -5,28 +5,7 @@ mkdir -p gui/deploy set -e -# Extract the version numbers. -majorVersion=$( sed -n 's/^.*final int MAJOR_VERSION = //p' common/src/main/java/io/bitsquare/app/Version.java ) -minorVersion=$( sed -n 's/^.*final int MINOR_VERSION = //p' common/src/main/java/io/bitsquare/app/Version.java ) -patchVersion=$( sed -n 's/^.*final int PATCH_VERSION = //p' common/src/main/java/io/bitsquare/app/Version.java ) - -# remove trailing; -majorVersion="${majorVersion:0:${#majorVersion}-1}" -minorVersion="${minorVersion:0:${#minorVersion}-1}" -patchVersion="${patchVersion:0:${#patchVersion}-1}" - -fullVersion=$( sed -n 's/^.*final String VERSION = "//p' common/src/main/java/io/bitsquare/app/Version.java ) -# remove trailing "; -fullVersion=$majorVersion.$minorVersion.$patchVersion - -echo majorVersion = $majorVersion -echo minorVersion = $minorVersion -echo patchVersion = $patchVersion -echo fullVersion = $fullVersion - -# Generate the plist from the template -sed "s|JAR_NAME_STRING_GOES_HERE|$patchVersion.jar|" package/mac/Info.template.plist >package/mac/Info.plist - +fullVersion="0.3.2.1" mvn clean package -DskipTests -Dmaven.javadoc.skip=true cp gui/target/shaded.jar gui/deploy/Bitsquare.jar @@ -43,9 +22,12 @@ $JAVA_HOME/bin/javapackager \ -title Bitsquare \ -vendor Bitsquare \ -outdir gui/deploy \ - -srcfiles gui/target/shaded.jar \ + -srcfiles gui/deploy/Bitsquare.jar \ -appclass io.bitsquare.app.BitsquareAppMain \ -outfile Bitsquare \ -BjvmProperties=-Djava.net.preferIPv4Stack=true +cp gui/deploy/Bitsquare.jar /Users/mk/vm_shared_ubuntu/Bitsquare.jar +cp gui/deploy/Bitsquare.jar /Users/mk/vm_shared_windows/Bitsquare.jar + cd package/mac \ No newline at end of file diff --git a/seednode/pom.xml b/seednode/pom.xml index 36e0ff18d7..5500bb52be 100644 --- a/seednode/pom.xml +++ b/seednode/pom.xml @@ -65,7 +65,7 @@ true bundled - SeedNodeMain + SeedNode diff --git a/seednode/src/main/java/io/bitsquare/p2p/seed/SeedNodeMain.java b/seednode/src/main/java/io/bitsquare/p2p/seed/SeedNodeMain.java index 6179d9ada7..f7c433a995 100644 --- a/seednode/src/main/java/io/bitsquare/p2p/seed/SeedNodeMain.java +++ b/seednode/src/main/java/io/bitsquare/p2p/seed/SeedNodeMain.java @@ -10,8 +10,6 @@ import org.slf4j.LoggerFactory; import java.security.NoSuchAlgorithmException; import java.security.Security; -import java.util.Scanner; -import java.util.Timer; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; @@ -62,29 +60,11 @@ public class SeedNodeMain { t.printStackTrace(); } }); - listenForExitCommand(); - } - public void listenForExitCommand() { - Scanner scan = new Scanner(System.in); - String line; - while (!stopped && !Thread.currentThread().isInterrupted() && ((line = scan.nextLine()) != null)) { - if (line.equals("q")) { - if (!stopped) { - stopped = true; - Timer timeout = UserThread.runAfter(() -> { - log.error("Timeout occurred at shutDown request"); - System.exit(1); - }, 5); - - if (seedNode != null) { - UserThread.execute(() -> seedNode.shutDown(() -> { - timeout.cancel(); - log.debug("Shutdown seed node complete."); - System.exit(0); - })); - } - } + while (true) { + try { + Thread.sleep(Long.MAX_VALUE); + } catch (InterruptedException e) { } } }