From f8adaaed6229d8b3ef56eeb8d04dd1ce0aff4666 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Wed, 11 Nov 2015 18:25:07 +0100 Subject: [PATCH] Cleanup dependencies --- common/pom.xml | 2 - core/pom.xml | 32 ----------- .../textsecuregcm/metrics/CpuUsageGauge.java | 32 ----------- .../metrics/FreeMemoryGauge.java | 34 ------------ .../textsecuregcm/metrics/NetworkGauge.java | 53 ------------------ .../metrics/NetworkReceivedGauge.java | 54 ------------------- .../metrics/NetworkSentGauge.java | 53 ------------------ .../textsecuregcm/util/Pair.java | 47 ---------------- gui/pom.xml | 6 +++ .../java/io/bitsquare/app/BitsquareApp.java | 13 ++--- jsocks/pom.xml | 8 --- jtorproxy/pom.xml | 13 ----- network/pom.xml | 2 +- pom.xml | 50 +++++++---------- 14 files changed, 30 insertions(+), 369 deletions(-) delete mode 100644 core/src/main/java/org/whispersystems/textsecuregcm/metrics/CpuUsageGauge.java delete mode 100644 core/src/main/java/org/whispersystems/textsecuregcm/metrics/FreeMemoryGauge.java delete mode 100644 core/src/main/java/org/whispersystems/textsecuregcm/metrics/NetworkGauge.java delete mode 100644 core/src/main/java/org/whispersystems/textsecuregcm/metrics/NetworkReceivedGauge.java delete mode 100644 core/src/main/java/org/whispersystems/textsecuregcm/metrics/NetworkSentGauge.java delete mode 100644 core/src/main/java/org/whispersystems/textsecuregcm/util/Pair.java diff --git a/common/pom.xml b/common/pom.xml index 82a4d7df32..0dfc01c0c1 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -17,12 +17,10 @@ gson 2.2.4 - org.springframework spring-core 4.1.1.RELEASE - \ No newline at end of file diff --git a/core/pom.xml b/core/pom.xml index ca2122a6eb..227898bd0b 100755 --- a/core/pom.xml +++ b/core/pom.xml @@ -12,9 +12,7 @@ core - - - @@ -49,40 +46,11 @@ ${project.parent.version} - - org.bitcoinj - bitcoinj-core - 0.13.2 - - net.sf.jopt-simple jopt-simple 4.8 - - net.glxn - qrgen - 1.3 - - - - com.codahale.metrics - metrics-graphite - 3.0.2 - - - - - diff --git a/core/src/main/java/org/whispersystems/textsecuregcm/metrics/CpuUsageGauge.java b/core/src/main/java/org/whispersystems/textsecuregcm/metrics/CpuUsageGauge.java deleted file mode 100644 index 1a03d8ca9c..0000000000 --- a/core/src/main/java/org/whispersystems/textsecuregcm/metrics/CpuUsageGauge.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (C) 2014 Open WhisperSystems - *

- * This program 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. - *

- * This program 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 this program. If not, see . - */ -package org.whispersystems.textsecuregcm.metrics; - -import com.codahale.metrics.Gauge; -import com.sun.management.OperatingSystemMXBean; - -import java.lang.management.ManagementFactory; - -public class CpuUsageGauge implements Gauge { - @Override - public Integer getValue() { - OperatingSystemMXBean mbean = (OperatingSystemMXBean) - ManagementFactory.getOperatingSystemMXBean(); - - return (int) Math.ceil(mbean.getSystemCpuLoad() * 100); - } -} diff --git a/core/src/main/java/org/whispersystems/textsecuregcm/metrics/FreeMemoryGauge.java b/core/src/main/java/org/whispersystems/textsecuregcm/metrics/FreeMemoryGauge.java deleted file mode 100644 index a77246afce..0000000000 --- a/core/src/main/java/org/whispersystems/textsecuregcm/metrics/FreeMemoryGauge.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (C) 2014 Open WhisperSystems - *

- * This program 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. - *

- * This program 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 this program. If not, see . - */ - -package org.whispersystems.textsecuregcm.metrics; - -import com.codahale.metrics.Gauge; -import com.sun.management.OperatingSystemMXBean; - -import java.lang.management.ManagementFactory; - -public class FreeMemoryGauge implements Gauge { - - @Override - public Long getValue() { - OperatingSystemMXBean mbean = (OperatingSystemMXBean) - ManagementFactory.getOperatingSystemMXBean(); - - return mbean.getFreePhysicalMemorySize(); - } -} \ No newline at end of file diff --git a/core/src/main/java/org/whispersystems/textsecuregcm/metrics/NetworkGauge.java b/core/src/main/java/org/whispersystems/textsecuregcm/metrics/NetworkGauge.java deleted file mode 100644 index e2bb788f14..0000000000 --- a/core/src/main/java/org/whispersystems/textsecuregcm/metrics/NetworkGauge.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (C) 2014 Open WhisperSystems - *

- * This program 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. - *

- * This program 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 this program. If not, see . - */ - -package org.whispersystems.textsecuregcm.metrics; - - -import com.codahale.metrics.Gauge; -import org.whispersystems.textsecuregcm.util.Pair; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; - -public abstract class NetworkGauge implements Gauge { - - protected Pair getSentReceived() throws IOException { - File proc = new File("/proc/net/dev"); - BufferedReader reader = new BufferedReader(new FileReader(proc)); - String header = reader.readLine(); - String header2 = reader.readLine(); - - long bytesSent = 0; - long bytesReceived = 0; - - String interfaceStats; - - while ((interfaceStats = reader.readLine()) != null) { - String[] stats = interfaceStats.split("\\s+"); - - if (!stats[1].equals("lo:")) { - bytesReceived += Long.parseLong(stats[2]); - bytesSent += Long.parseLong(stats[10]); - } - } - - return new Pair<>(bytesSent, bytesReceived); - } -} diff --git a/core/src/main/java/org/whispersystems/textsecuregcm/metrics/NetworkReceivedGauge.java b/core/src/main/java/org/whispersystems/textsecuregcm/metrics/NetworkReceivedGauge.java deleted file mode 100644 index bc7d474689..0000000000 --- a/core/src/main/java/org/whispersystems/textsecuregcm/metrics/NetworkReceivedGauge.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (C) 2014 Open WhisperSystems - *

- * This program 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. - *

- * This program 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 this program. If not, see . - */ -package org.whispersystems.textsecuregcm.metrics; - - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.whispersystems.textsecuregcm.util.Pair; - -import java.io.IOException; - - -public class NetworkReceivedGauge extends NetworkGauge { - - private final Logger logger = LoggerFactory.getLogger(NetworkSentGauge.class); - - private long lastTimestamp; - private long lastReceived; - - @Override - public Long getValue() { - try { - long timestamp = System.currentTimeMillis(); - Pair sentAndReceived = getSentReceived(); - long result = 0; - - if (lastTimestamp != 0) { - result = sentAndReceived.second() - lastReceived; - lastReceived = sentAndReceived.second(); - } - - lastTimestamp = timestamp; - return result; - } catch (IOException e) { - logger.warn("NetworkReceivedGauge", e); - return -1L; - } - } - -} diff --git a/core/src/main/java/org/whispersystems/textsecuregcm/metrics/NetworkSentGauge.java b/core/src/main/java/org/whispersystems/textsecuregcm/metrics/NetworkSentGauge.java deleted file mode 100644 index 9f4e0823e9..0000000000 --- a/core/src/main/java/org/whispersystems/textsecuregcm/metrics/NetworkSentGauge.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (C) 2014 Open WhisperSystems - *

- * This program 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. - *

- * This program 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 this program. If not, see . - */ -package org.whispersystems.textsecuregcm.metrics; - - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.whispersystems.textsecuregcm.util.Pair; - -import java.io.IOException; - - -public class NetworkSentGauge extends NetworkGauge { - - private final Logger logger = LoggerFactory.getLogger(NetworkSentGauge.class); - - private long lastTimestamp; - private long lastSent; - - @Override - public Long getValue() { - try { - long timestamp = System.currentTimeMillis(); - Pair sentAndReceived = getSentReceived(); - long result = 0; - - if (lastTimestamp != 0) { - result = sentAndReceived.first() - lastSent; - lastSent = sentAndReceived.first(); - } - - lastTimestamp = timestamp; - return result; - } catch (IOException e) { - logger.warn("NetworkSentGauge", e); - return -1L; - } - } -} diff --git a/core/src/main/java/org/whispersystems/textsecuregcm/util/Pair.java b/core/src/main/java/org/whispersystems/textsecuregcm/util/Pair.java deleted file mode 100644 index 77dbbd326b..0000000000 --- a/core/src/main/java/org/whispersystems/textsecuregcm/util/Pair.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (C) 2014 Open WhisperSystems - *

- * This program 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. - *

- * This program 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 this program. If not, see . - */ -package org.whispersystems.textsecuregcm.util; - -import static com.google.common.base.Objects.equal; - -public class Pair { - private final T1 v1; - private final T2 v2; - - public Pair(T1 v1, T2 v2) { - this.v1 = v1; - this.v2 = v2; - } - - public T1 first() { - return v1; - } - - public T2 second() { - return v2; - } - - public boolean equals(Object o) { - return o instanceof Pair && - equal(((Pair) o).first(), first()) && - equal(((Pair) o).second(), second()); - } - - public int hashCode() { - return first().hashCode() ^ second().hashCode(); - } -} diff --git a/gui/pom.xml b/gui/pom.xml index 0532bcc194..0326f6bdac 100644 --- a/gui/pom.xml +++ b/gui/pom.xml @@ -124,6 +124,12 @@ 8.0.6_20 + + net.glxn + qrgen + 1.3 + + de.jensd fontawesomefx diff --git a/gui/src/main/java/io/bitsquare/app/BitsquareApp.java b/gui/src/main/java/io/bitsquare/app/BitsquareApp.java index 5690264b1a..9bf84106e3 100644 --- a/gui/src/main/java/io/bitsquare/app/BitsquareApp.java +++ b/gui/src/main/java/io/bitsquare/app/BitsquareApp.java @@ -102,7 +102,7 @@ public class BitsquareApp extends Application { Log.setup(Paths.get(env.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY), "bitsquare").toString()); Log.PRINT_TRACE_METHOD = DEV_MODE; - + UserThread.setExecutor(Platform::runLater); shutDownHandler = this::stop; @@ -111,6 +111,9 @@ public class BitsquareApp extends Application { // setup UncaughtExceptionHandler Thread.UncaughtExceptionHandler handler = (thread, throwable) -> { // Might come from another thread + log.error("Uncaught Exception from thread " + Thread.currentThread().getName()); + log.error("Uncaught Exception throwableMessage= " + throwable.getMessage()); + throwable.printStackTrace(); UserThread.execute(() -> showErrorPopup(throwable, false)); }; Thread.setDefaultUncaughtExceptionHandler(handler); @@ -121,19 +124,13 @@ public class BitsquareApp extends Application { Security.addProvider(new BouncyCastleProvider()); try { - // Use CrashFX for report crash logs - /*CrashFX.setup("Bitsquare/" + Version.VERSION, - Paths.get(env.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY), "crashes"), - URI.create("http://188.226.179.109/crashfx/upload"));*/ - // Server not setup yet, so we use client side only support - // Guice bitsquareAppModule = new BitsquareAppModule(env, primaryStage); injector = Guice.createInjector(bitsquareAppModule); injector.getInstance(InjectorViewFactory.class).setInjector(injector); Version.NETWORK_ID = injector.getInstance(BitsquareEnvironment.class).getBitcoinNetwork().ordinal(); - + // load the main view and create the main scene CachingViewLoader viewLoader = injector.getInstance(CachingViewLoader.class); mainView = (MainView) viewLoader.load(MainView.class); diff --git a/jsocks/pom.xml b/jsocks/pom.xml index ae1ea1b19c..ab811aa608 100644 --- a/jsocks/pom.xml +++ b/jsocks/pom.xml @@ -11,12 +11,4 @@ jsocks - - - org.slf4j - slf4j-api - 1.5.11 - - - \ No newline at end of file diff --git a/jtorproxy/pom.xml b/jtorproxy/pom.xml index dde31413c8..470f01f413 100644 --- a/jtorproxy/pom.xml +++ b/jtorproxy/pom.xml @@ -24,17 +24,4 @@ - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - - \ No newline at end of file diff --git a/network/pom.xml b/network/pom.xml index 95eae7cebb..431057a09a 100644 --- a/network/pom.xml +++ b/network/pom.xml @@ -17,11 +17,11 @@ common ${project.parent.version} + io.bitsquare jtorproxy ${project.parent.version} - \ No newline at end of file diff --git a/pom.xml b/pom.xml index a769de5e3d..90b5543bb7 100755 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ parent pom 0.3.2-SNAPSHOT - The decentralized bitcoin exchange + Bitsquare - The decentralized bitcoin exchange https://bitsquare.io @@ -95,51 +95,43 @@ - - - org.bitcoinj - bitcoinj-core - 0.13.2 - - - - org.springframework - spring-test - 4.1.1.RELEASE - test - - + com.google.inject guice 3.0 - + - commons-io - commons-io - 2.4 + org.bitcoinj + bitcoinj-core + 0.13.2 + org.bouncycastle bcprov-jdk15on 1.53 + + + commons-io + commons-io + 2.4 + com.google.guava guava 18.0 - org.fxmisc.easybind easybind 1.0.3 - org.reactfx reactfx @@ -151,47 +143,41 @@ 13.0 - + org.slf4j slf4j-api 1.7.12 - ch.qos.logback logback-core 1.1.3 - ch.qos.logback logback-classic 1.1.3 - + junit junit 4.11 test - org.mockito mockito-core 1.10.19 test - - net.jodah - concurrentunit - 0.4.1 + org.springframework + spring-test + 4.1.1.RELEASE test - - \ No newline at end of file