Statement unnecessarily nested.

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

Branch: refs/heads/LOG4J2-1365
Commit: b119e19d0713c7a2cc7fd4c85b94e2164b57872d
Parents: 8f1e0b2
Author: ggregory <[email protected]>
Authored: Sun Apr 17 16:47:35 2016 -0700
Committer: ggregory <[email protected]>
Committed: Sun Apr 17 16:47:35 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/lookup/CustomLookup.java     | 3 +--
 .../java/org/apache/logging/log4j/lookup/MapMessageLookup.java | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b119e19d/log4j-samples/loggerProperties/src/main/java/org/apache/logging/log4j/lookup/CustomLookup.java
----------------------------------------------------------------------
diff --git 
a/log4j-samples/loggerProperties/src/main/java/org/apache/logging/log4j/lookup/CustomLookup.java
 
b/log4j-samples/loggerProperties/src/main/java/org/apache/logging/log4j/lookup/CustomLookup.java
index 471d2ba..fcd2c5c 100644
--- 
a/log4j-samples/loggerProperties/src/main/java/org/apache/logging/log4j/lookup/CustomLookup.java
+++ 
b/log4j-samples/loggerProperties/src/main/java/org/apache/logging/log4j/lookup/CustomLookup.java
@@ -67,9 +67,8 @@ public class CustomLookup extends AbstractLookup {
                 }
                 sb.append("}");
                 return sb.toString();
-            } else {
-                return properties.get(key);
             }
+            return properties.get(key);
         } catch (final Exception ex) {
             LOGGER.warn(LOOKUP, "Error while getting property [{}].", key, ex);
             return null;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b119e19d/log4j-samples/loggerProperties/src/main/java/org/apache/logging/log4j/lookup/MapMessageLookup.java
----------------------------------------------------------------------
diff --git 
a/log4j-samples/loggerProperties/src/main/java/org/apache/logging/log4j/lookup/MapMessageLookup.java
 
b/log4j-samples/loggerProperties/src/main/java/org/apache/logging/log4j/lookup/MapMessageLookup.java
index 1ed1868..7a1faaa 100644
--- 
a/log4j-samples/loggerProperties/src/main/java/org/apache/logging/log4j/lookup/MapMessageLookup.java
+++ 
b/log4j-samples/loggerProperties/src/main/java/org/apache/logging/log4j/lookup/MapMessageLookup.java
@@ -70,16 +70,14 @@ public class MapMessageLookup extends AbstractLookup {
                     }
                     sb.append("}");
                     return sb.toString();
-                } else {
-                    return properties.get(key);
                 }
+                return properties.get(key);
             } catch (final Exception ex) {
                 LOGGER.warn(LOOKUP, "Error while getting property [{}].", key, 
ex);
                 return null;
             }
-        } else {
-            return null;
         }
+        return null;
     }
 
     public static void setLoggerProperties(String loggerName, Map<String, 
String> properties) {

Reply via email to