From a79ddace71a0d716108a4be3366e46252fa52964 Mon Sep 17 00:00:00 2001 From: "Blue (Lukas Rieger)" Date: Sun, 30 Aug 2020 02:49:33 +0200 Subject: [PATCH] Actually throw the interrupted exception if interrupted while loading --- .../bluemap/core/resourcepack/ResourcePack.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resourcepack/ResourcePack.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resourcepack/ResourcePack.java index 23729aa9..672acde5 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resourcepack/ResourcePack.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resourcepack/ResourcePack.java @@ -135,6 +135,8 @@ public void load(Collection sources) throws IOException, InterruptedExcept public void load(File... sources) throws InterruptedException { try (CombinedFileAccess combinedSources = new CombinedFileAccess()){ for (int i = 0; i < sources.length; i++) { + if (Thread.interrupted()) throw new InterruptedException(); + File file = sources[i]; try { combinedSources.addFileAccess(FileAccess.of(file)); @@ -152,6 +154,8 @@ public void load(File... sources) throws InterruptedException { Collection namespaces = sourcesAccess.listFolders("assets"); int i = 0; for (String namespaceRoot : namespaces) { + if (Thread.interrupted()) throw new InterruptedException(); + i++; //load blockstates @@ -160,10 +164,7 @@ public void load(File... sources) throws InterruptedException { Collection blockstateFiles = sourcesAccess.listFiles(namespaceRoot + "/blockstates", true); for (String blockstateFile : blockstateFiles) { - if (Thread.interrupted()) { - Thread.currentThread().interrupt(); - return; - } + if (Thread.interrupted()) throw new InterruptedException(); String filename = FileAccess.getFileName(blockstateFile); if (!filename.endsWith(".json")) continue;