Repository: logging-log4j2
Updated Branches:
  refs/heads/master 0d4248da7 -> c499b2009


replaced if-else clause with boolean expression


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

Branch: refs/heads/master
Commit: c499b20095f9d452d2ad2e942f6d44cbcfa46802
Parents: 0d4248d
Author: rpopma <rpo...@apache.org>
Authored: Fri Sep 23 00:00:43 2016 +0900
Committer: rpopma <rpo...@apache.org>
Committed: Fri Sep 23 00:00:43 2016 +0900

----------------------------------------------------------------------
 .../org/apache/logging/log4j/core/filter/MapFilter.java | 12 ++----------
 .../log4j/core/filter/ThreadContextMapFilter.java       |  6 +-----
 2 files changed, 3 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c499b200/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java
index 171fa79..e428d63 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java
@@ -77,11 +77,7 @@ public class MapFilter extends AbstractFilter {
         boolean match = false;
         for (final Map.Entry<String, List<String>> entry : map.entrySet()) {
             final String toMatch = data.get(entry.getKey());
-            if (toMatch != null) {
-                match = entry.getValue().contains(toMatch);
-            } else {
-                match = false;
-            }
+            match = toMatch != null && entry.getValue().contains(toMatch);
             if ((!isAnd && match) || (isAnd && !match)) {
                 break;
             }
@@ -93,11 +89,7 @@ public class MapFilter extends AbstractFilter {
         boolean match = false;
         for (final Map.Entry<String, List<String>> entry : map.entrySet()) {
             final String toMatch = data.getValue(entry.getKey());
-            if (toMatch != null) {
-                match = entry.getValue().contains(toMatch);
-            } else {
-                match = false;
-            }
+            match = toMatch != null && entry.getValue().contains(toMatch);
             if ((!isAnd && match) || (isAnd && !match)) {
                 break;
             }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c499b200/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
index d10ea12..602e474 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
@@ -101,11 +101,7 @@ public class ThreadContextMapFilter extends MapFilter {
                     currentContextData = currentContextData();
                 }
                 final String toMatch = 
currentContextData.getValue(entry.getKey());
-                if (toMatch != null) {
-                    match = entry.getValue().contains(toMatch);
-                } else {
-                    match = false;
-                }
+                match = toMatch != null && entry.getValue().contains(toMatch);
                 if ((!isAnd() && match) || (isAnd() && !match)) {
                     break;
                 }

Reply via email to