logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpo...@apache.org
Subject svn commit: r1553262 - /logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java
Date Tue, 24 Dec 2013 10:35:39 GMT
Author: rpopma
Date: Tue Dec 24 10:35:38 2013
New Revision: 1553262

URL: http://svn.apache.org/r1553262
Log:
Improvement on earlier fix for LOG4J2-477

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

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java?rev=1553262&r1=1553261&r2=1553262&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java
Tue Dec 24 10:35:38 2013
@@ -28,7 +28,6 @@ import java.util.concurrent.ConcurrentMa
 import java.util.concurrent.atomic.AtomicReference;
 
 import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.helpers.Loader;
 import org.apache.logging.log4j.core.impl.ContextAnchor;
 import org.apache.logging.log4j.core.impl.ReflectiveCallerClassUtility;
@@ -178,9 +177,10 @@ public class ClassLoaderContextSelector 
         return Collections.unmodifiableList(list);
     }
 
-    private LoggerContext locateContext(final ClassLoader loader, final URI configLocation)
{
+    private LoggerContext locateContext(final ClassLoader loaderOrNull, final URI configLocation)
{
         // LOG4J2-477: class loader may be null
-        final String name = loader != null ? loader.toString() : ClassLoader.getSystemClassLoader().toString();
+        final ClassLoader loader = loaderOrNull != null ? loaderOrNull : ClassLoader.getSystemClassLoader();
+        final String name = loader.toString();
         AtomicReference<WeakReference<LoggerContext>> ref = CONTEXT_MAP.get(name);
         if (ref == null) {
             if (configLocation == null) {
@@ -219,7 +219,7 @@ public class ClassLoaderContextSelector 
             final AtomicReference<WeakReference<LoggerContext>> r =
                 new AtomicReference<WeakReference<LoggerContext>>();
             r.set(new WeakReference<LoggerContext>(ctx));
-            CONTEXT_MAP.putIfAbsent(loader.toString(), r);
+            CONTEXT_MAP.putIfAbsent(name, r);
             ctx = CONTEXT_MAP.get(name).get().get();
             return ctx;
         }



Mime
View raw message