diff --git a/src/main/java/net/szum123321/textile_backup/core/create/MakeBackupRunnable.java b/src/main/java/net/szum123321/textile_backup/core/create/MakeBackupRunnable.java index e550a0a..917c68b 100644 --- a/src/main/java/net/szum123321/textile_backup/core/create/MakeBackupRunnable.java +++ b/src/main/java/net/szum123321/textile_backup/core/create/MakeBackupRunnable.java @@ -102,14 +102,13 @@ public class MakeBackupRunnable implements Callable { case TAR -> new AbstractTarArchiver().createArchive(world, outFile, context, coreCount); } - Globals.INSTANCE.getQueueExecutor().submit(new Cleanup(context.commandSource(), Utilities.getLevelName(context.server()))); + if(!Globals.INSTANCE.getQueueExecutor().isShutdown()) + Globals.INSTANCE.getQueueExecutor().submit(new Cleanup(context.commandSource(), Utilities.getLevelName(context.server()))); - if (config.get().broadcastBackupDone) { - Utilities.notifyPlayers(context.server(), "Done!"); - } else { - log.sendInfoAL(context, "Done!"); - } - } catch (InterruptedException | ExecutionException | IOException e) { + if (config.get().broadcastBackupDone) Utilities.notifyPlayers(context.server(), "Done!"); + else log.sendInfoAL(context, "Done!"); + + } catch (Throwable e) { //ExecutorService swallows exception, so I need to catch everything log.error("An exception occurred when trying to create new backup file!", e); diff --git a/src/main/java/net/szum123321/textile_backup/core/digest/FileTreeHashBuilder.java b/src/main/java/net/szum123321/textile_backup/core/digest/FileTreeHashBuilder.java index 90ce907..ec657ec 100644 --- a/src/main/java/net/szum123321/textile_backup/core/digest/FileTreeHashBuilder.java +++ b/src/main/java/net/szum123321/textile_backup/core/digest/FileTreeHashBuilder.java @@ -19,6 +19,7 @@ package net.szum123321.textile_backup.core.digest; import net.szum123321.textile_backup.Globals; +import net.szum123321.textile_backup.core.CompressionStatus; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -29,11 +30,13 @@ public class FileTreeHashBuilder { private long hash = 0, filesProcessed = 0, filesTotalSize = 0; public void update(Path path, long newHash) throws IOException { + if(path.getFileName().toString().equals(CompressionStatus.DATA_FILENAME)) return; + var hasher = Globals.CHECKSUM_SUPPLIER.get(); long size = Files.size(path); - hasher.update(path.toString().getBytes(StandardCharsets.UTF_8)); + hasher.update(path.getFileName().toString().getBytes(StandardCharsets.UTF_8)); hasher.update(newHash); synchronized (lock) { diff --git a/src/main/java/net/szum123321/textile_backup/core/digest/HashingOutputStream.java b/src/main/java/net/szum123321/textile_backup/core/digest/HashingOutputStream.java index 33545ec..f4ea178 100644 --- a/src/main/java/net/szum123321/textile_backup/core/digest/HashingOutputStream.java +++ b/src/main/java/net/szum123321/textile_backup/core/digest/HashingOutputStream.java @@ -19,8 +19,6 @@ package net.szum123321.textile_backup.core.digest; import net.szum123321.textile_backup.Globals; -import net.szum123321.textile_backup.core.FileTreeHashBuilder; -import net.szum123321.textile_backup.core.Hash; import org.jetbrains.annotations.NotNull; import java.io.FilterOutputStream; @@ -41,14 +39,14 @@ public class HashingOutputStream extends FilterOutputStream { @Override public void write(int b) throws IOException { - super.write(b); hasher.update(b); + super.write(b); } @Override public void write(byte @NotNull [] b, int off, int len) throws IOException { - super.write(b, off, len); hasher.update(b, off, len); + super.write(b, off, len); } @Override