From 39e1026400928780cdbefdc86fc4def6b0559f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Wed, 11 Mar 2020 13:34:11 +0800 Subject: [PATCH] use try-with-resources --- .../java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 302bc27f9..164ec18c5 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -439,9 +439,10 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter File actual = new File(getDataFolder(), name); if (!actual.exists()) { try { - InputStream stream = getResource("defaults/" + name); - if (stream == null) throw new FileNotFoundException(); - copyDefaultConfig(stream, actual, name); + try (InputStream stream = getResource("defaults/" + name)) { + if (stream == null) throw new FileNotFoundException(); + copyDefaultConfig(stream, actual, name); + } } catch (IOException e) { getLogger().severe("Unable to read default configuration: " + name); }