From 88c998f4a25c9210de4d0290d230263d35d51a9e Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 5 Jan 2011 22:56:12 +0000 Subject: [PATCH] Tweaked some more exceptions, get messages passed By: Dinnerbone --- .../org/bukkit/plugin/InvalidDescriptionException.java | 2 +- .../main/java/org/bukkit/plugin/PluginDescriptionFile.java | 4 ---- .../src/main/java/org/bukkit/plugin/PluginManager.java | 3 ++- .../main/java/org/bukkit/plugin/SimplePluginManager.java | 7 +++++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/plugin/InvalidDescriptionException.java b/paper-api/src/main/java/org/bukkit/plugin/InvalidDescriptionException.java index 17f36851ce..a1a7551a35 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/InvalidDescriptionException.java +++ b/paper-api/src/main/java/org/bukkit/plugin/InvalidDescriptionException.java @@ -57,6 +57,6 @@ public class InvalidDescriptionException extends Exception { @Override public String getMessage() { - return super.getMessage(); + return message; } } diff --git a/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java index 44dddbfa6c..72a26304a5 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java +++ b/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java @@ -81,10 +81,6 @@ public final class PluginDescriptionFile { } private void loadMap(Map map) throws InvalidDescriptionException { - if (name == null) { - throw new InvalidDescriptionException("Name is not defined"); - } - try { name = map.get("name").toString(); } catch (NullPointerException ex) { diff --git a/paper-api/src/main/java/org/bukkit/plugin/PluginManager.java b/paper-api/src/main/java/org/bukkit/plugin/PluginManager.java index 0b6d7a308d..a2d35e394c 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/PluginManager.java +++ b/paper-api/src/main/java/org/bukkit/plugin/PluginManager.java @@ -56,8 +56,9 @@ public interface PluginManager { * @param file File containing the plugin to load * @return The Plugin loaded, or null if it was invalid * @throws InvalidPluginException Thrown when the specified file is not a valid plugin + * @throws InvalidDescriptionException Thrown when the specified file contains an invalid description */ - public Plugin loadPlugin(File file) throws InvalidPluginException; + public Plugin loadPlugin(File file) throws InvalidPluginException, InvalidDescriptionException; /** * Loads the plugins contained within the specified directory diff --git a/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java index 44cc0eb9df..d9f25afa1d 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -79,7 +79,9 @@ public final class SimplePluginManager implements PluginManager { try { plugin = loadPlugin(file); } catch (InvalidPluginException ex) { - Logger.getLogger(SimplePluginManager.class.getName()).log(Level.SEVERE, "Could not load " + file.getPath() + " in " + directory.getPath(), ex); + Logger.getLogger(SimplePluginManager.class.getName()).log(Level.SEVERE, "Could not load " + file.getPath() + " in " + directory.getPath() + ": " + ex.getMessage(), ex); + } catch (InvalidDescriptionException ex) { + Logger.getLogger(SimplePluginManager.class.getName()).log(Level.SEVERE, "Could not load " + file.getPath() + " in " + directory.getPath() + ": " + ex.getMessage(), ex); } if (plugin != null) { @@ -98,8 +100,9 @@ public final class SimplePluginManager implements PluginManager { * @param file File containing the plugin to load * @return The Plugin loaded, or null if it was invalid * @throws InvalidPluginException Thrown when the specified file is not a valid plugin + * @throws InvalidDescriptionException Thrown when the specified file contains an invalid description */ - public Plugin loadPlugin(File file) throws InvalidPluginException { + public Plugin loadPlugin(File file) throws InvalidPluginException, InvalidDescriptionException { Set filters = fileAssociations.keySet(); Plugin result = null;