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 2013/06/06 07:59:08 UTC

svn commit: r1490159 - /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java

Author: ggregory
Date: Thu Jun  6 05:59:08 2013
New Revision: 1490159

URL: http://svn.apache.org/r1490159
Log:
Statement unnecessarily nested within else clause. The corresponding then clause does not complete normally.

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java?rev=1490159&r1=1490158&r2=1490159&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java Thu Jun  6 05:59:08 2013
@@ -208,16 +208,15 @@ public class ClassLoaderContextSelector 
             CONTEXT_MAP.putIfAbsent(loader.toString(), r);
             ctx = CONTEXT_MAP.get(name).get().get();
             return ctx;
-        } else {
-            final WeakReference<LoggerContext> r = ref.get();
-            LoggerContext ctx = r.get();
-            if (ctx != null) {
-                return ctx;
-            }
-            ctx = new LoggerContext(name, null, configLocation);
-            ref.compareAndSet(r, new WeakReference<LoggerContext>(ctx));
+        }
+        final WeakReference<LoggerContext> r = ref.get();
+        LoggerContext ctx = r.get();
+        if (ctx != null) {
             return ctx;
         }
+        ctx = new LoggerContext(name, null, configLocation);
+        ref.compareAndSet(r, new WeakReference<LoggerContext>(ctx));
+        return ctx;
     }
 
     private static void setupCallerCheck() {