diff --git a/gradle.properties b/gradle.properties index 0bbd976..c422a14 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G -minecraft_version=1.20-rc1 -yarn_mappings=1.20-rc1+build.2 +minecraft_version=1.20 +yarn_mappings=1.20+build.1 loader_version=0.14.21 #Fabric api @@ -20,6 +20,6 @@ databreaker_version=0.2.10 pgzip_commit_hash=af5f5c297e735f3f2df7aa4eb0e19a5810b8aff6 # Mod Properties -mod_version = 3.0.0 +mod_version = 3.1.0 maven_group = net.szum123321 archives_base_name = textile_backup \ No newline at end of file diff --git a/src/main/java/net/szum123321/textile_backup/core/CompressionStatus.java b/src/main/java/net/szum123321/textile_backup/core/CompressionStatus.java index de5a2b3..11673fc 100644 --- a/src/main/java/net/szum123321/textile_backup/core/CompressionStatus.java +++ b/src/main/java/net/szum123321/textile_backup/core/CompressionStatus.java @@ -28,7 +28,7 @@ import java.time.format.DateTimeFormatter; import java.util.Map; import java.util.Optional; -public record CompressionStatus(long treeHash, Map brokenFiles, LocalDateTime date, long startTimestamp, long finishTimestamp, String version) implements Serializable { +public record CompressionStatus(long treeHash, Map brokenFiles, LocalDateTime date, long startTimestamp, long finishTimestamp, String version) implements Serializable { public static final String DATA_FILENAME = "textile_status.data"; public Optional validate(long hash, RestoreContext ctx) throws RuntimeException { @@ -80,8 +80,8 @@ public record CompressionStatus(long treeHash, Map brokenFiles, if(brokenFiles.isEmpty()) builder.append("[]"); else { builder.append("[\n"); - for(Path i: brokenFiles.keySet()) { - builder.append(i.toString()) + for(String i: brokenFiles.keySet()) { + builder.append(i) .append(":"); ByteArrayOutputStream o = new ByteArrayOutputStream(); diff --git a/src/main/java/net/szum123321/textile_backup/core/Utilities.java b/src/main/java/net/szum123321/textile_backup/core/Utilities.java index 7d82400..b4e8022 100644 --- a/src/main/java/net/szum123321/textile_backup/core/Utilities.java +++ b/src/main/java/net/szum123321/textile_backup/core/Utilities.java @@ -115,9 +115,9 @@ public class Utilities { } public static boolean isBlacklisted(Path path) { - if (path.getFileName().equals("session.lock")) return true; + if (path.getFileName().equals(Path.of("session.lock"))) return true; - if(path.getFileName().endsWith(CompressionStatus.DATA_FILENAME)) return true; + if(path.getFileName().equals(Path.of(CompressionStatus.DATA_FILENAME))) return true; return config.get().fileBlacklist.stream().anyMatch(path::startsWith); } diff --git a/src/main/java/net/szum123321/textile_backup/core/create/BrokenFileHandler.java b/src/main/java/net/szum123321/textile_backup/core/create/BrokenFileHandler.java index 8e06585..218a85f 100644 --- a/src/main/java/net/szum123321/textile_backup/core/create/BrokenFileHandler.java +++ b/src/main/java/net/szum123321/textile_backup/core/create/BrokenFileHandler.java @@ -23,12 +23,12 @@ import java.util.HashMap; import java.util.Map; public class BrokenFileHandler { - private final Map store = new HashMap<>(); - public void handle(Path file, Exception e) { store.put(file, e); } + private final Map store = new HashMap<>(); + public void handle(Path file, Exception e) { store.put(file.toString(), e); } public boolean valid() { return store.isEmpty(); } - public Map get() { + public Map get() { return store; } } diff --git a/src/main/java/net/szum123321/textile_backup/core/digest/HashingInputStream.java b/src/main/java/net/szum123321/textile_backup/core/digest/HashingInputStream.java index a288b25..ca88205 100644 --- a/src/main/java/net/szum123321/textile_backup/core/digest/HashingInputStream.java +++ b/src/main/java/net/szum123321/textile_backup/core/digest/HashingInputStream.java @@ -52,7 +52,12 @@ public class HashingInputStream extends FilterInputStream { @Override public int read(byte @NotNull [] b, int off, int len) throws IOException { - int i = in.read(b, off, len); + int i; + try { + i = in.read(b, off, len); + } catch(IOException e) { + throw new IOException("An exception occurred while trying to access: [" + path.toString() + "]", e); + } if(i != -1) { hash.update(b, off, i); bytesWritten += i; @@ -62,7 +67,12 @@ public class HashingInputStream extends FilterInputStream { @Override public int read() throws IOException { - int i = in.read(); + int i; + try { + i = in.read(); + } catch(IOException e) { + throw new IOException("An exception occurred while trying to access: [" + path.toString() + "]", e); + } if(i != -1) { hash.update(i); bytesWritten++;