You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (JIRA)" <ji...@apache.org> on 2017/11/07 04:23:00 UTC

[jira] [Commented] (LOG4J2-2104) LoaderUtil getClassLoaders() method and while loops

    [ https://issues.apache.org/jira/browse/LOG4J2-2104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16241463#comment-16241463 ] 

Ralph Goers commented on LOG4J2-2104:
-------------------------------------

First, why is this a Jira issue? Simple questions like this should be on the dev list.

Yes. This method returns all the ClassLoaders to search for a Log4j implementation. Although the ThreadContextClassLoader shouldn't be there twice it won't really hurt anything.

> LoaderUtil getClassLoaders() method and while loops
> ---------------------------------------------------
>
>                 Key: LOG4J2-2104
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2104
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.9.1
>            Reporter: Andrejus Chaliapinas
>            Priority: Minor
>
> For v2.9.1 inside org.apache.logging.log4j.util.LoaderUtil and getClassLoaders() method we have lines 120-123 as such:
> ClassLoader parent = tcl;
> while (parent != null && !classLoaders.contains(parent)) {
>     classLoaders.add(parent);
> }
> where it looks like some getParent() call is either missing or otherwise "while" loop is not needed.
> In line 111 tcl classloader already added into list of clasloaders:
> classLoaders.add(tcl);
> Was it an attempt to add all classloaders hierarchy or just some immediate parents?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)