Archiviert
13
0

Don't ignore critical exceptions - print them.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-12-19 23:10:50 +01:00
Ursprung 1509f5cd8b
Commit 3b142db569
2 geänderte Dateien mit 13 neuen und 1 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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