What's actually amusing about this change is that the method is
@PerformanceSensitive which to me means we should have cached the result of
getFilter() anyways. ;)

---------- Forwarded message ----------
From: <[email protected]>
Date: 22 August 2016 at 19:24
Subject: logging-log4j2 git commit: [LOG4J2-1538] Dynamic removal of filter
may cause NPE.
To: [email protected]


Repository: logging-log4j2
Updated Branches:
  refs/heads/master 3a4d9a65f -> 9bea362a0


[LOG4J2-1538] Dynamic removal of filter may cause NPE.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
commit/9bea362a
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/9bea362a
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/9bea362a

Branch: refs/heads/master
Commit: 9bea362a0440cfed0e12eb503e95e1c8eadbe827
Parents: 3a4d9a6
Author: Gary Gregory <[email protected]>
Authored: Mon Aug 22 17:24:36 2016 -0700
Committer: Gary Gregory <[email protected]>
Committed: Mon Aug 22 17:24:36 2016 -0700

----------------------------------------------------------------------
 .../org/apache/logging/log4j/core/config/AppenderControl.java     | 3 ++-
 src/changes/changes.xml                                           | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
9bea362a/log4j-core/src/main/java/org/apache/logging/log4j/
core/config/AppenderControl.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AppenderControl.java
b/log4j-core/src/main/java/org/apache/logging/log4j/core/
config/AppenderControl.java
index 68d4db1..de0a777 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/
config/AppenderControl.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/
config/AppenderControl.java
@@ -90,7 +90,8 @@ public class AppenderControl extends AbstractFilterable {

     @PerformanceSensitive
     private boolean isFilteredByAppenderControl(final LogEvent event) {
-        return getFilter() != null && Filter.Result.DENY ==
getFilter().filter(event);
+        final Filter filter = getFilter();
+        return filter != null && Filter.Result.DENY ==
filter.filter(event);
     }

     @PerformanceSensitive

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
9bea362a/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 98c0aee..93eeef0 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
   </properties>
   <body>
     <release version="2.7" date="2016-MM-DD" description="GA Release 2.7">
+      <action issue="LOG4J2-1538" dev="ggregory" type="fix" due-to="Igor
Karpov">
+        Dynamic removal of filter may cause NPE.
+      </action>
       <action issue="LOG4J2-1532" dev="ggregory" type="fix" due-to="Gary
Gregory">
         Attributes are not merged properly in composite configurations.
       </action>




-- 
Matt Sicker <[email protected]>

Reply via email to