You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2015/08/18 12:32:55 UTC
logging-log4j2 git commit: Refactor a duplicate expression.
Repository: logging-log4j2
Updated Branches:
refs/heads/master 1a88e44a9 -> a2fb4c2be
Refactor a duplicate 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/a2fb4c2b
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/a2fb4c2b
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/a2fb4c2b
Branch: refs/heads/master
Commit: a2fb4c2be7165687a3276778f4ee6ef250318b46
Parents: 1a88e44
Author: ggregory <gg...@apache.org>
Authored: Tue Aug 18 03:32:52 2015 -0700
Committer: ggregory <gg...@apache.org>
Committed: Tue Aug 18 03:32:52 2015 -0700
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/core/lookup/MapLookup.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a2fb4c2b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java
index ef8a776..db5efd9 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java
@@ -118,7 +118,8 @@ public class MapLookup implements StrLookup {
@Override
public String lookup(final LogEvent event, final String key) {
- if (map == null && !(event.getMessage() instanceof MapMessage)) {
+ final boolean isMapMessage = event.getMessage() instanceof MapMessage;
+ if (map == null && !isMapMessage) {
return null;
}
if (map != null && map.containsKey(key)) {
@@ -127,7 +128,7 @@ public class MapLookup implements StrLookup {
return obj;
}
}
- if (event.getMessage() instanceof MapMessage) {
+ if (isMapMessage) {
return ((MapMessage) event.getMessage()).get(key);
}
return null;