From 6337e1cf7d655ed2856f855788c7be5af9f3d3a6 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 21 Nov 2022 12:08:27 +0200 Subject: [PATCH] update dependencies for guava, simple-json-rpc and dependants --- build.gradle | 26 +++++++++---------- .../sparrow/io/db/DbPersistence.java | 13 +++++----- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index a2458e81..585e55c5 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ dependencies { exclude group: 'org.hamcrest' exclude group: 'junit' } - implementation('com.google.guava:guava:28.2-jre') + implementation('com.google.guava:guava:31.1-jre') implementation('com.google.code.gson:gson:2.8.6') implementation('com.h2database:h2:2.1.214') implementation('com.zaxxer:HikariCP:4.0.3') @@ -69,11 +69,11 @@ dependencies { exclude group: 'com.beust', module: 'jcommander' } implementation('com.beust:jcommander:1.81') - implementation('com.github.arteam:simple-json-rpc-core:1.0') - implementation('com.github.arteam:simple-json-rpc-client:1.0') { + implementation('com.github.arteam:simple-json-rpc-core:1.3') + implementation('com.github.arteam:simple-json-rpc-client:1.3') { exclude group: 'com.github.arteam', module: 'simple-json-rpc-core' } - implementation('com.github.arteam:simple-json-rpc-server:1.0') { + implementation('com.github.arteam:simple-json-rpc-server:1.3') { exclude group: 'org.slf4j' } implementation('com.sparrowwallet:hummingbird:1.6.4') @@ -103,7 +103,7 @@ dependencies { implementation('org.slf4j:jul-to-slf4j:1.7.30') { exclude group: 'org.slf4j' } - implementation('com.sparrowwallet.nightjar:nightjar:0.2.33') + implementation('com.sparrowwallet.nightjar:nightjar:0.2.34') implementation('io.reactivex.rxjava2:rxjava:2.2.15') implementation('io.reactivex.rxjava2:rxjavafx:2.2.2') implementation('org.apache.commons:commons-lang3:3.7') @@ -282,7 +282,7 @@ task packageTarDistribution(type: Tar) { } extraJavaModuleInfo { - module('jackson-core-2.10.1.jar', 'com.fasterxml.jackson.core', '2.10.1') { + module('jackson-core-2.13.2.jar', 'com.fasterxml.jackson.core', '2.13.2') { exports('com.fasterxml.jackson.core') exports('com.fasterxml.jackson.core.async') exports('com.fasterxml.jackson.core.base') @@ -297,11 +297,11 @@ extraJavaModuleInfo { exports('com.fasterxml.jackson.core.util') uses('com.fasterxml.jackson.core.ObjectCodec') } - module('jackson-annotations-2.10.1.jar', 'com.fasterxml.jackson.annotation', '2.10.1') { + module('jackson-annotations-2.13.2.jar', 'com.fasterxml.jackson.annotation', '2.13.2') { requires('com.fasterxml.jackson.core') exports('com.fasterxml.jackson.annotation') } - module('jackson-databind-2.10.1.jar', 'com.fasterxml.jackson.databind', '2.10.1') { + module('jackson-databind-2.13.2.jar', 'com.fasterxml.jackson.databind', '2.13.2') { requires('java.desktop') requires('java.logging') requires('com.fasterxml.jackson.annotation') @@ -335,7 +335,7 @@ extraJavaModuleInfo { exports('tornadofx.control') requires('javafx.controls') } - module('simple-json-rpc-core-1.0.jar', 'simple.json.rpc.core', '1.0') { + module('simple-json-rpc-core-1.3.jar', 'simple.json.rpc.core', '1.3') { exports('com.github.arteam.simplejsonrpc.core.annotation') exports('com.github.arteam.simplejsonrpc.core.domain') requires('com.fasterxml.jackson.core') @@ -343,7 +343,7 @@ extraJavaModuleInfo { requires('com.fasterxml.jackson.databind') requires('org.jetbrains.annotations') } - module('simple-json-rpc-client-1.0.jar', 'simple.json.rpc.client', '1.0') { + module('simple-json-rpc-client-1.3.jar', 'simple.json.rpc.client', '1.3') { exports('com.github.arteam.simplejsonrpc.client') exports('com.github.arteam.simplejsonrpc.client.builder') exports('com.github.arteam.simplejsonrpc.client.exception') @@ -351,7 +351,7 @@ extraJavaModuleInfo { requires('com.fasterxml.jackson.databind') requires('simple.json.rpc.core') } - module('simple-json-rpc-server-1.0.jar', 'simple.json.rpc.server', '1.0') { + module('simple-json-rpc-server-1.3.jar', 'simple.json.rpc.server', '1.3') { exports('com.github.arteam.simplejsonrpc.server') requires('simple.json.rpc.core') requires('com.google.common') @@ -407,7 +407,7 @@ extraJavaModuleInfo { exports('com.google.common.util.concurrent.internal') } module('listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar', 'com.google.guava.listenablefuture', '9999.0-empty-to-avoid-conflict-with-guava') - module('guava-28.2-jre.jar', 'com.google.common', '28.2-jre') { + module('guava-31.1-jre.jar', 'com.google.common', '31.1-jre') { exports('com.google.common.eventbus') exports('com.google.common.net') exports('com.google.common.base') @@ -493,7 +493,7 @@ extraJavaModuleInfo { module('cbor-0.9.jar', 'co.nstant.in.cbor', '0.9') { exports('co.nstant.in.cbor') } - module('nightjar-0.2.33.jar', 'com.sparrowwallet.nightjar', '0.2.33') { + module('nightjar-0.2.34.jar', 'com.sparrowwallet.nightjar', '0.2.34') { requires('com.google.common') requires('net.sourceforge.streamsupport') requires('org.slf4j') diff --git a/src/main/java/com/sparrowwallet/sparrow/io/db/DbPersistence.java b/src/main/java/com/sparrowwallet/sparrow/io/db/DbPersistence.java index 7e590199..1b36ba0b 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/db/DbPersistence.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/db/DbPersistence.java @@ -1,7 +1,6 @@ package com.sparrowwallet.sparrow.io.db; import com.google.common.eventbus.Subscribe; -import com.google.common.io.Files; import com.sparrowwallet.drongo.Utils; import com.sparrowwallet.drongo.crypto.Argon2KeyDeriver; import com.sparrowwallet.drongo.crypto.AsymmetricKeyDeriver; @@ -31,6 +30,7 @@ import java.io.*; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.security.SecureRandom; import java.util.*; @@ -625,25 +625,26 @@ public class DbPersistence implements Persistence { } //Flyway does not support JPMS yet, so the migration files are extracted to a temp dir in order to avoid classloader encapsulation issues - private File getMigrationDir() { - File migrationDir = Files.createTempDir(); + private File getMigrationDir() throws StorageException { try { + File migrationDir = Files.createTempDirectory("sparrowfly").toFile(); String[] files = IOUtils.getResourceListing(DbPersistence.class, MIGRATION_RESOURCES_DIR); for(String name : files) { File targetFile = new File(migrationDir, name); try(InputStream inputStream = DbPersistence.class.getResourceAsStream("/" + MIGRATION_RESOURCES_DIR + name)) { if(inputStream != null) { - java.nio.file.Files.copy(inputStream, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING); + Files.copy(inputStream, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } else { log.error("Could not load resource at /" + MIGRATION_RESOURCES_DIR + name); } } } + + return migrationDir; } catch(Exception e) { log.error("Could not extract migration resources", e); + throw new StorageException("Could not extract migration resources", e); } - - return migrationDir; } private HikariDataSource getDataSource(Storage storage, String password) throws StorageException {