diff options
author | Nathan Adams <dinnerbone@dinnerbone.com> | 2012-02-18 14:06:21 +0000 |
---|---|---|
committer | Nathan Adams <dinnerbone@dinnerbone.com> | 2012-02-18 14:06:21 +0000 |
commit | 3b634b14f669dccd6051660c80e36caf62123713 (patch) | |
tree | cf0f093eefa28f363de68dfd1271178c70ea49b6 /src | |
parent | d057ee1e07987bd98c6bd3f6443aec9bff276f1c (diff) | |
download | craftbukkit-3b634b14f669dccd6051660c80e36caf62123713.tar craftbukkit-3b634b14f669dccd6051660c80e36caf62123713.tar.gz craftbukkit-3b634b14f669dccd6051660c80e36caf62123713.tar.lz craftbukkit-3b634b14f669dccd6051660c80e36caf62123713.tar.xz craftbukkit-3b634b14f669dccd6051660c80e36caf62123713.zip |
Fixed NPE when running a custom build of CraftBukkit. This fixes issue #BUKKIT-765
Diffstat (limited to 'src')
3 files changed, 6 insertions, 10 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 763d26aa..8634c865 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1024,7 +1024,7 @@ public final class CraftServer implements Server { } public void onPlayerJoin(Player player) { - if ((updater.isEnabled()) && (player.hasPermission(Server.BROADCAST_CHANNEL_ADMINISTRATIVE))) { + if ((updater.isEnabled()) && (updater.getCurrent() != null) && (player.hasPermission(Server.BROADCAST_CHANNEL_ADMINISTRATIVE))) { if ((updater.getCurrent().isBroken()) && (updater.getOnBroken().contains(updater.WARN_OPERATORS))) { player.sendMessage(ChatColor.DARK_RED + "The version of CraftBukkit that this server is running is known to be broken. Please consider updating to the latest version at dl.bukkit.org."); } else if ((updater.isUpdateAvailable()) && (updater.getOnUpdate().contains(updater.WARN_OPERATORS))) { diff --git a/src/main/java/org/bukkit/craftbukkit/updater/AutoUpdater.java b/src/main/java/org/bukkit/craftbukkit/updater/AutoUpdater.java index ede432e6..52869645 100644 --- a/src/main/java/org/bukkit/craftbukkit/updater/AutoUpdater.java +++ b/src/main/java/org/bukkit/craftbukkit/updater/AutoUpdater.java @@ -65,8 +65,8 @@ public class AutoUpdater { new Thread() { @Override public void run() { - current = service.getArtifact(currentSlug); - latest = service.getArtifact("latest-" + channel); + current = service.getArtifact(currentSlug, "current artifact information; perhaps you are running a custom version?"); + latest = service.getArtifact("latest-" + channel, "latest artifact information"); if (isUpdateAvailable()) { if ((current.isBroken()) && (onBroken.contains(WARN_CONSOLE))) { diff --git a/src/main/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterService.java b/src/main/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterService.java index fdc6db57..3d94268d 100644 --- a/src/main/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterService.java +++ b/src/main/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterService.java @@ -1,15 +1,11 @@ package org.bukkit.craftbukkit.updater; import com.google.gson.*; -import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; -import java.net.MalformedURLException; import java.net.URL; -import java.net.URLEncoder; -import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; @@ -25,13 +21,13 @@ public class BukkitDLUpdaterService { this.host = host; } - public ArtifactDetails getArtifact(String slug) { + public ArtifactDetails getArtifact(String slug, String name) { try { return fetchArtifact(slug); } catch (UnsupportedEncodingException ex) { - Logger.getLogger(BukkitDLUpdaterService.class.getName()).log(Level.WARNING, "Could not get Artifact details for the auto-updater: " + ex.getClass().getSimpleName()); + Logger.getLogger(BukkitDLUpdaterService.class.getName()).log(Level.WARNING, "Could not get " + name + ": " + ex.getClass().getSimpleName()); } catch (IOException ex) { - Logger.getLogger(BukkitDLUpdaterService.class.getName()).log(Level.WARNING, "Could not get Artifact details for the auto-updater: " + ex.getClass().getSimpleName()); + Logger.getLogger(BukkitDLUpdaterService.class.getName()).log(Level.WARNING, "Could not get " + name + ": " + ex.getClass().getSimpleName()); } return null; |