diff --git a/common/src/main/java/bisq/common/util/InvalidVersionException.java b/common/src/main/java/bisq/common/util/InvalidVersionException.java
new file mode 100644
index 0000000000..d63bc31af0
--- /dev/null
+++ b/common/src/main/java/bisq/common/util/InvalidVersionException.java
@@ -0,0 +1,24 @@
+/*
+ * This file is part of Bisq.
+ *
+ * Bisq is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * Bisq is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Bisq. If not, see .
+ */
+
+package bisq.common.util;
+
+public class InvalidVersionException extends Exception {
+ public InvalidVersionException(String msg) {
+ super(msg);
+ }
+}
diff --git a/common/src/main/java/bisq/common/util/Utilities.java b/common/src/main/java/bisq/common/util/Utilities.java
index 6cdd3bf342..291baa6843 100644
--- a/common/src/main/java/bisq/common/util/Utilities.java
+++ b/common/src/main/java/bisq/common/util/Utilities.java
@@ -17,8 +17,6 @@
package bisq.common.util;
-import bisq.common.crypto.LimitedKeyStrengthException;
-
import org.bitcoinj.core.Utils;
import com.google.gson.ExclusionStrategy;
@@ -71,6 +69,7 @@ import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
+import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.awt.Desktop.Action;
import static java.awt.Desktop.getDesktop;
@@ -182,6 +181,34 @@ public class Utilities {
return System.getProperty("os.name").toLowerCase(Locale.US);
}
+ public static String getOSVersion() {
+ return System.getProperty("os.version").toLowerCase(Locale.US);
+ }
+
+ public static int getMinorVersion() throws InvalidVersionException {
+ String version = getOSVersion();
+ String[] tokens = version.split("\\.");
+ try {
+ checkArgument(tokens.length > 1);
+ return Integer.parseInt(tokens[1]);
+ } catch (IllegalArgumentException e) {
+ printSysInfo();
+ throw new InvalidVersionException("Version is not in expected format. Version=" + version);
+ }
+ }
+
+ public static int getMajorVersion() throws InvalidVersionException {
+ String version = getOSVersion();
+ String[] tokens = version.split("\\.");
+ try {
+ checkArgument(tokens.length > 0);
+ return Integer.parseInt(tokens[0]);
+ } catch (IllegalArgumentException e) {
+ printSysInfo();
+ throw new InvalidVersionException("Version is not in expected format. Version=" + version);
+ }
+ }
+
public static String getOSArchitecture() {
String osArch = System.getProperty("os.arch");
if (isWindows()) {
@@ -462,4 +489,5 @@ public class Utilities {
Map