logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1490159 - /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java
Date Thu, 06 Jun 2013 05:59:08 GMT
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() {



Mime
View raw message