diff options
-rw-r--r-- | src/main/java/org/bukkit/configuration/serialization/ConfigurationSerialization.java | 11 | ||||
-rw-r--r-- | src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java | 5 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/configuration/serialization/ConfigurationSerialization.java b/src/main/java/org/bukkit/configuration/serialization/ConfigurationSerialization.java index 3b2b67b9..6f630880 100644 --- a/src/main/java/org/bukkit/configuration/serialization/ConfigurationSerialization.java +++ b/src/main/java/org/bukkit/configuration/serialization/ConfigurationSerialization.java @@ -1,6 +1,7 @@ package org.bukkit.configuration.serialization; import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.HashMap; @@ -68,7 +69,10 @@ public class ConfigurationSerialization { return result; } } catch (Throwable ex) { - Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, "Could not call method '" + method.toString() + "' of " + clazz + " for deserialization", ex); + Logger.getLogger(ConfigurationSerialization.class.getName()).log( + Level.SEVERE, + "Could not call method '" + method.toString() + "' of " + clazz + " for deserialization", + ex instanceof InvocationTargetException ? ex.getCause() : ex); } return null; @@ -78,7 +82,10 @@ public class ConfigurationSerialization { try { return ctor.newInstance(args); } catch (Throwable ex) { - Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, "Could not call constructor '" + ctor.toString() + "' of " + clazz + " for deserialization", ex); + Logger.getLogger(ConfigurationSerialization.class.getName()).log( + Level.SEVERE, + "Could not call constructor '" + ctor.toString() + "' of " + clazz + " for deserialization", + ex instanceof InvocationTargetException ? ex.getCause() : ex); } return null; diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index b11439b7..b31457dd 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -5,6 +5,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.util.ArrayList; @@ -143,6 +144,8 @@ public class JavaPluginLoader implements PluginLoader { result = constructor.newInstance(); result.initialize(this, server, description, dataFolder, file, loader); + } catch (InvocationTargetException ex) { + throw new InvalidPluginException(ex.getCause()); } catch (Throwable ex) { throw new InvalidPluginException(ex); } @@ -298,6 +301,8 @@ public class JavaPluginLoader implements PluginLoader { return; } method.invoke(listener, event); + } catch (InvocationTargetException ex) { + throw new EventException(ex.getCause()); } catch (Throwable t) { throw new EventException(t); } |