diff --git a/pom.xml b/pom.xml index bbc044a2..4eaaa408 100644 --- a/pom.xml +++ b/pom.xml @@ -10,18 +10,17 @@ 7dc8c6f 0.15.10 1.69 - 3.5.0 ${maven.build.timestamp} 1.4.1 3.8.0 1.11.0 - 2.11.0 - 1.25.0 + 2.15.1 + 1.26.1 3.14.0 1.2.2 0.12.3 4.9.10 - 1.61.1 + 1.62.2 33.0.0-jre 2.2 1.2.1 @@ -33,28 +32,30 @@ 2.41 9.4.54.v20240208 1.1.1 - 20240205 + 20240303 1.17.2 5.10.0 1.0.0 - 2.22.1 + 2.23.0 1.5.0-b01 + 3.5.0 3.12.1 + 3.6.1 3.3.0 + 1.1.0 + 2.16.2 + 0.16 3.3.1 - 3.5.1 + 3.5.2 3.2.5 - 1.1.0 UTF-8 - 3.25.2 + 3.25.3 1.5.3 - 0.16 1.17 1.7.36 2.0.10 - 5.10.3 + 5.11.8 1.2 - 2.16.2 1.9 @@ -70,7 +71,7 @@ org.codehaus.mojo versions-maven-plugin - ${versions-maven-plugin.version} + ${maven-plugin.version} false @@ -238,7 +239,7 @@ com.github.bohnman package-info-maven-plugin - ${package-info-maven-plugin.version} + ${maven-package-info-plugin.version} @@ -268,7 +269,7 @@ org.codehaus.mojo build-helper-maven-plugin - ${build-helper-maven-plugin.version} + ${maven-build-helper-plugin.version} generate-sources @@ -353,7 +354,7 @@ io.github.zlika reproducible-build-maven-plugin - ${reproducible-build-maven-plugin.version} + ${maven-reproducible-build-plugin.version} package @@ -388,15 +389,9 @@ - - org.apache.maven.plugins - - - maven-dependency-plugin - - - [3.6.0,) - + org.apache.maven.plugins + maven-dependency-plugin + ${maven-dependency-plugin.version} unpack @@ -407,15 +402,9 @@ - - com.google.code.maven-replacer-plugin - - - replacer - - - [1.5.3,) - + com.google.code.maven-replacer-plugin + replacer + ${replacer.version} replace @@ -448,7 +437,7 @@ org.codehaus.mojo build-helper-maven-plugin - ${build-helper-maven-plugin.version} + ${maven-build-helper-plugin.version} provided @@ -456,7 +445,7 @@ com.github.bohnman package-info-maven-plugin - ${package-info-maven-plugin.version} + ${maven-package-info-plugin.version} provided diff --git a/src/main/java/org/qortal/arbitrary/ArbitraryDataFile.java b/src/main/java/org/qortal/arbitrary/ArbitraryDataFile.java index 71378461..1bba1a73 100644 --- a/src/main/java/org/qortal/arbitrary/ArbitraryDataFile.java +++ b/src/main/java/org/qortal/arbitrary/ArbitraryDataFile.java @@ -58,6 +58,9 @@ public class ArbitraryDataFile { public static int SHORT_DIGEST_LENGTH = 8; protected Path filePath; + protected byte[] fileContent; + private boolean useTemporaryFile; + protected String hash58; protected byte[] signature; private ArrayList chunks; @@ -90,8 +93,14 @@ public class ArbitraryDataFile { this.signature = signature; LOGGER.trace(String.format("File digest: %s, size: %d bytes", this.hash58, fileContent.length)); + this.fileContent = fileContent; + this.useTemporaryFile = useTemporaryFile; + } + + public void save() throws DataException { + Path outputFilePath; - if (useTemporaryFile) { + if (this.useTemporaryFile) { try { outputFilePath = Files.createTempFile("qortalRawData", null); outputFilePath.toFile().deleteOnExit(); @@ -149,6 +158,7 @@ public class ArbitraryDataFile { case RAW_DATA: arbitraryDataFile = ArbitraryDataFile.fromRawData(data, signature); + arbitraryDataFile.save(); break; } @@ -324,6 +334,7 @@ public class ArbitraryDataFile { out.flush(); ArbitraryDataFileChunk chunk = new ArbitraryDataFileChunk(out.toByteArray(), this.signature); + chunk.save(); ValidationResult validationResult = chunk.isValid(); if (validationResult == ValidationResult.OK) { this.chunks.add(chunk); @@ -406,6 +417,10 @@ public class ArbitraryDataFile { } public boolean delete(int attempts) { + if (this.filePath == null) { + return false; + } + // Keep trying to delete the data until it is deleted, or we reach 10 attempts for (int i=0; i