geforkt von Mirrors/Paper
[Bleeding] Skip InvocationTargetException. Addresses BUKKIT-774
By: Wesley Wolfe <weswolf@aol.com>
Dieser Commit ist enthalten in:
Ursprung
cfccd9341c
Commit
91c8bbacc7
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren