From 4392eb9ea0752275a478d4eb664810d4670e4c02 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Thu, 5 Sep 2013 04:07:05 +0200 Subject: [PATCH] Don't choke on exceptions during error filtering. Pointless. --- .../comphenix/protocol/ProtocolLibrary.java | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java b/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java index 6b8628f9..178892d5 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java @@ -228,20 +228,26 @@ public class ProtocolLibrary extends JavaPlugin { @Override protected Report filterReport(Object sender, Report report, boolean detailed) { - String canonicalName = ReportType.getReportName(sender, report.getType()); - String reportName = Iterables.getLast(Splitter.on("#").split(canonicalName)).toUpperCase(); - - if (config != null && config.getModificationCount() != lastModCount) { - // Update our cached set again - reports = Sets.newHashSet(config.getSuppressedReports()); - lastModCount = config.getModificationCount(); + try { + String canonicalName = ReportType.getReportName(sender, report.getType()); + String reportName = Iterables.getLast(Splitter.on("#").split(canonicalName)).toUpperCase(); + + if (config != null && config.getModificationCount() != lastModCount) { + // Update our cached set again + reports = Sets.newHashSet(config.getSuppressedReports()); + lastModCount = config.getModificationCount(); + } + + // Cancel reports either on the full canonical name, or just the report name + if (reports.contains(canonicalName) || reports.contains(reportName)) + return null; + + } catch (Exception e) { + // Only report this with a minor message + logger.warning("Error filtering reports: " + e.toString()); } - - // Cancel reports either on the full canonical name, or just the report name - if (reports.contains(canonicalName) || reports.contains(reportName)) - return null; - else - return report; + // Don't filter anything + return report; } }; }