because of that return, the finally block would never run

This commit is contained in:
Szum123321 2022-08-31 22:36:50 +02:00
parent c7fd6d3f8e
commit 8cede17568

View File

@ -67,17 +67,8 @@ public class MakeBackupRunnable implements Runnable {
log.trace("Outfile is: {}", outFile); log.trace("Outfile is: {}", outFile);
try {
Files.createDirectories(outFile.getParent()); Files.createDirectories(outFile.getParent());
Files.createFile(outFile); 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;
}
int coreCount; int coreCount;
@ -119,6 +110,11 @@ public class MakeBackupRunnable implements Runnable {
} else { } else {
log.sendInfoAL(context, "Done!"); 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 { } finally {
Utilities.enableWorldSaving(context.server()); Utilities.enableWorldSaving(context.server());
Globals.INSTANCE.disableWatchdog = false; Globals.INSTANCE.disableWatchdog = false;