diff --git a/pom.xml b/pom.xml
index 1e41627..6832e6a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,7 +40,7 @@
io.github.tronprotocol
zksnark-java-sdk
- 1.0.0
+ 1.0.1
bundle
@@ -48,7 +48,6 @@
zksnark-java-sdk
UTF-8
1.18
- 2.11.0
4.13.2
0.8.8
0xEF7F2D6C
@@ -106,11 +105,6 @@
hawtjni-runtime
${hawtjni-version}
-
- commons-io
- commons-io
- ${commons-io-version}
-
junit
junit
@@ -212,7 +206,6 @@
${project.groupId}.${project.artifactId}
org.tron.common.*;version=${project.version},
- org.apache.commons.*;version=${commons-io-version},
org.fusesource.hawtjni.*;version=${hawtjni-version},
diff --git a/src/main/java/org/tron/common/util/Utils.java b/src/main/java/org/tron/common/util/Utils.java
index 88acaf0..0879d98 100644
--- a/src/main/java/org/tron/common/util/Utils.java
+++ b/src/main/java/org/tron/common/util/Utils.java
@@ -16,22 +16,33 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import org.apache.commons.io.FileUtils;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+
import org.fusesource.hawtjni.runtime.Library;
public interface Utils {
Library LIBRARY = new Library("zksnarkjni", Utils.class);
static String getParamsFile(String fileName) {
- InputStream in = Utils.class.getClassLoader()
- .getResourceAsStream("params" + File.separator + fileName);
- File fileOut = new File(System.getProperty("java.io.tmpdir") + File.separator + fileName);
try {
- FileUtils.copyToFile(in, fileOut);
+ File target = Paths.get(System.getProperty("java.io.tmpdir"),
+ fileName + "." + System.currentTimeMillis()).toFile();
+ try (InputStream in = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream("params" + File.separator + fileName);
+ ){
+ if (in != null) {
+ Files.copy(in, target.toPath(), StandardCopyOption.REPLACE_EXISTING);
+ target.deleteOnExit();
+ return target.getAbsolutePath();
+ } else {
+ throw new IOException("Resource not found: " + fileName);
+ }
+ }
} catch (IOException e) {
throw new RuntimeException(e);
}
- return fileOut.getAbsolutePath();
}
}