Archiviert
13
0

Fix potential errors when plugins log with a null message

Dieser Commit ist enthalten in:
md_5 2013-06-26 16:59:37 +10:00
Ursprung 26ed947128
Commit a87b0db033

Datei anzeigen

@ -1,4 +1,4 @@
From 12842ce0abe79fc49a1c054dbd3cd04a4959d0c1 Mon Sep 17 00:00:00 2001 From 819926c72091eb14d928f7832e53293d0d27e0b2 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sat, 22 Jun 2013 16:40:11 +1000 Date: Sat, 22 Jun 2013 16:40:11 +1000
Subject: [PATCH] Add Log Filtering Subject: [PATCH] Add Log Filtering
@ -6,10 +6,10 @@ Subject: [PATCH] Add Log Filtering
diff --git a/src/main/java/org/spigotmc/LogFilter.java b/src/main/java/org/spigotmc/LogFilter.java diff --git a/src/main/java/org/spigotmc/LogFilter.java b/src/main/java/org/spigotmc/LogFilter.java
new file mode 100644 new file mode 100644
index 0000000..fd26480 index 0000000..aa7e9ab
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/LogFilter.java +++ b/src/main/java/org/spigotmc/LogFilter.java
@@ -0,0 +1,21 @@ @@ -0,0 +1,24 @@
+package org.spigotmc; +package org.spigotmc;
+ +
+import java.util.logging.Filter; +import java.util.logging.Filter;
@ -21,6 +21,8 @@ index 0000000..fd26480
+ +
+ public boolean isLoggable(LogRecord record) + public boolean isLoggable(LogRecord record)
+ { + {
+ if ( record.getMessage() != null )
+ {
+ for ( Pattern pattern : SpigotConfig.logFilters ) + for ( Pattern pattern : SpigotConfig.logFilters )
+ { + {
+ if ( pattern.matcher( record.getMessage() ).matches() ) + if ( pattern.matcher( record.getMessage() ).matches() )
@ -28,11 +30,12 @@ index 0000000..fd26480
+ return false; + return false;
+ } + }
+ } + }
+ }
+ return true; + return true;
+ } + }
+} +}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 0d53a5b..cc3b9d8 100644 index 2998109..6528321 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -13,6 +13,8 @@ import java.util.HashMap; @@ -13,6 +13,8 @@ import java.util.HashMap;