From 8cede1756834ac479499d65eb18baea4ad9371f9 Mon Sep 17 00:00:00 2001 From: Szum123321 Date: Wed, 31 Aug 2022 22:36:50 +0200 Subject: [PATCH] because of that return, the finally block would never run --- .../core/create/MakeBackupRunnable.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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 05e8c3a..8bfa995 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 @@ -67,17 +67,8 @@ public class MakeBackupRunnable implements Runnable { log.trace("Outfile is: {}", outFile); - try { - Files.createDirectories(outFile.getParent()); - Files.createFile(outFile); - } catch (IOException e) { - log.error("An exception occurred when trying to create new backup file!", e); - - if(context.initiator() == ActionInitiator.Player) - log.sendError(context, "An exception occurred when trying to create new backup file!"); - - return; - } + Files.createDirectories(outFile.getParent()); + Files.createFile(outFile); int coreCount; @@ -119,6 +110,11 @@ public class MakeBackupRunnable implements Runnable { } else { log.sendInfoAL(context, "Done!"); } + } catch (IOException e) { + log.error("An exception occurred when trying to create new backup file!", e); + + if(context.initiator() == ActionInitiator.Player) + log.sendError(context, "An exception occurred when trying to create new backup file!"); } finally { Utilities.enableWorldSaving(context.server()); Globals.INSTANCE.disableWatchdog = false;