From c1bd31aec58ea7c4cdfed8efc8bd035107e766f0 Mon Sep 17 00:00:00 2001 From: Szum123321 Date: Thu, 8 Jun 2023 22:23:00 +0200 Subject: [PATCH 1/4] repaired windows crash --- gradle.properties | 2 +- .../szum123321/textile_backup/core/CompressionStatus.java | 6 +++--- .../textile_backup/core/create/BrokenFileHandler.java | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0bbd976..2bd7a38 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,6 +20,6 @@ databreaker_version=0.2.10 pgzip_commit_hash=af5f5c297e735f3f2df7aa4eb0e19a5810b8aff6 # Mod Properties -mod_version = 3.0.0 +mod_version = 3.0.1 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/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; } } From 8d3dd3f012f622e71564e32df1686a564a9c29f7 Mon Sep 17 00:00:00 2001 From: Szum123321 Date: Thu, 8 Jun 2023 22:56:22 +0200 Subject: [PATCH 2/4] added filename to Exceptions thrown by HashingInputStream --- .../core/digest/HashingInputStream.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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++; From d32b3e8f0ca4790bad2a2731c3a650d5f11a4394 Mon Sep 17 00:00:00 2001 From: Szum123321 Date: Thu, 8 Jun 2023 22:57:18 +0200 Subject: [PATCH 3/4] repaired if condition causing crashes on windows --- .../java/net/szum123321/textile_backup/core/Utilities.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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..7f26456 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,11 @@ public class Utilities { } public static boolean isBlacklisted(Path path) { - if (path.getFileName().equals("session.lock")) return true; + log.info(path.getFileName().toString()); + if (path.getFileName().equals(Path.of("session.lock"))) return true; + log.info(path.getFileName().toString()); - 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); } From 3e1fe9f65538efa33dd81e808e0118e57987d71e Mon Sep 17 00:00:00 2001 From: Szum123321 Date: Thu, 8 Jun 2023 23:02:19 +0200 Subject: [PATCH 4/4] forgot to remove debug, 1.20 final toolchain update --- gradle.properties | 6 +++--- .../java/net/szum123321/textile_backup/core/Utilities.java | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 2bd7a38..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.1 +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/Utilities.java b/src/main/java/net/szum123321/textile_backup/core/Utilities.java index 7f26456..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,7 @@ public class Utilities { } public static boolean isBlacklisted(Path path) { - log.info(path.getFileName().toString()); if (path.getFileName().equals(Path.of("session.lock"))) return true; - log.info(path.getFileName().toString()); if(path.getFileName().equals(Path.of(CompressionStatus.DATA_FILENAME))) return true;