Don't ignore critical exceptions - print them.

This commit is contained in:
Kristian S. Stangeland 2012-12-19 23:10:50 +01:00
parent 1509f5cd8b
commit 3b142db569
2 changed files with 13 additions and 1 deletions

View File

@ -65,7 +65,7 @@ public class ProtocolLibrary extends JavaPlugin {
private static PacketFilterManager protocolManager;
// Error reporter
private ErrorReporter reporter;
private static ErrorReporter reporter;
// Metrics and statistisc
private Statistics statistisc;
@ -353,6 +353,7 @@ public class ProtocolLibrary extends JavaPlugin {
protocolManager.close();
protocolManager = null;
statistisc = null;
reporter = null;
// Leaky ClassLoader begone!
CleanupStaticMembers cleanup = new CleanupStaticMembers(getClassLoader(), reporter);
@ -373,6 +374,14 @@ public class ProtocolLibrary extends JavaPlugin {
return log;
}
/**
* Retrieve the current error reporter.
* @return Current error reporter.
*/
public static ErrorReporter getErrorReporter() {
return reporter;
}
/**
* Retrieves the packet protocol manager.
* @return Packet protocol manager, or NULL if it has been disabled.

View File

@ -23,6 +23,7 @@ import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.injector.PacketConstructor.Unwrapper;
import com.comphenix.protocol.reflect.instances.DefaultInstances;
@ -107,8 +108,10 @@ public class BukkitUnwrapper implements Unwrapper {
return find;
} catch (SecurityException e) {
ProtocolLibrary.getErrorReporter().reportDetailed(this, "Security limitation.", e, type);
return null;
} catch (NoSuchMethodException e) {
ProtocolLibrary.getErrorReporter().reportDetailed(this, "Cannot unwrap object.", e, type);
return null;
}
}