From 855b5f8ae37130895457a22041a30a537a1488b2 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 21 Jan 2014 10:47:18 -0800 Subject: [PATCH] [Bleeding] Instantiate logger earlier in CraftServer. Fixes BUKKIT-4253. Previously, if an error occurred during CraftServer initialization before the logger was instantiated, it would cause an NPE and the server would never finish loading properly. By instantiating the logger before attempting to load anything else in CraftServer, we ensure that a logger will always be available in the case of any errors. --- src/main/java/org/bukkit/craftbukkit/CraftServer.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index f3e5200747..d27ab8c132 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -148,6 +148,7 @@ public final class CraftServer implements Server { private final String serverName = "CraftBukkit"; private final String serverVersion; private final String bukkitVersion = Versioning.getBukkitVersion(); + private final Logger logger = Logger.getLogger("Minecraft"); private final ServicesManager servicesManager = new SimpleServicesManager(); private final CraftScheduler scheduler = new CraftScheduler(); private final SimpleCommandMap commandMap = new SimpleCommandMap(this); @@ -176,7 +177,6 @@ public final class CraftServer implements Server { public CraftScoreboardManager scoreboardManager; public boolean playerCommandState; private boolean printSaveWarning; - private Logger logger; private CraftIconCache icon; private final class BooleanWrapper { @@ -189,7 +189,6 @@ public final class CraftServer implements Server { } public CraftServer(MinecraftServer console, PlayerList playerList) { - this.logger = Logger.getLogger("Minecraft"); this.console = console; this.playerList = (DedicatedPlayerList) playerList; this.serverVersion = CraftServer.class.getPackage().getImplementationVersion();