You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2019/12/31 20:12:33 UTC

[GitHub] [logging-log4j2] carterkozak commented on a change in pull request #328: LOG4J2-2754: LoaderUtil.getClassLoaders may discover additional loaders

carterkozak commented on a change in pull request #328: LOG4J2-2754: LoaderUtil.getClassLoaders may discover additional loaders
URL: https://github.com/apache/logging-log4j2/pull/328#discussion_r362274587
 
 

 ##########
 File path: log4j-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java
 ##########
 @@ -106,30 +104,31 @@ public ClassLoader run() {
     }
 
     public static ClassLoader[] getClassLoaders() {
-        final List<ClassLoader> classLoaders = new ArrayList<>();
+        final Collection<ClassLoader> classLoaders = new LinkedHashSet<>();
         final ClassLoader tcl = getThreadContextClassLoader();
-        classLoaders.add(tcl);
-        // Some implementations may use null to represent the bootstrap class loader.
-        final ClassLoader current = LoaderUtil.class.getClassLoader();
-        if (current != null && current != tcl) {
-            classLoaders.add(current);
-            final ClassLoader parent = current.getParent();
-            while (parent != null && !classLoaders.contains(parent)) {
-                classLoaders.add(parent);
 
 Review comment:
   This loop failed to modify the condition

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services