Modified: 
websites/production/commons/content/proper/commons-logging/jacoco/org.apache.commons.logging/LogFactory.java.html
==============================================================================
--- 
websites/production/commons/content/proper/commons-logging/jacoco/org.apache.commons.logging/LogFactory.java.html
 (original)
+++ 
websites/production/commons/content/proper/commons-logging/jacoco/org.apache.commons.logging/LogFactory.java.html
 Mon Aug 19 13:54:51 2024
@@ -34,6 +34,7 @@ import java.util.Objects;
 import java.util.Properties;
 import java.util.ServiceConfigurationError;
 import java.util.ServiceLoader;
+import java.util.function.Supplier;
 
 /**
  * Factory for creating {@link Log} instances, with discovery and
@@ -94,11 +95,10 @@ public abstract class LogFactory {
     public static final String FACTORY_PROPERTY = 
"org.apache.commons.logging.LogFactory";
 
     private static final String FACTORY_LOG4J_API = 
"org.apache.commons.logging.impl.Log4jApiLogFactory";
-    private static final String LOG4J_API_LOGGER = 
"org.apache.logging.log4j.Logger";
+
     private static final String LOG4J_TO_SLF4J_BRIDGE = 
"org.apache.logging.slf4j.SLF4JProvider";
 
     private static final String FACTORY_SLF4J = 
"org.apache.commons.logging.impl.Slf4jLogFactory";
-    private static final String SLF4J_API_LOGGER = 
"org.slf4j.Logger";
 
     /**
      * The fully qualified class name of the fallback {@code LogFactory}
@@ -115,8 +115,7 @@ public abstract class LogFactory {
      * JDK 1.3+ <a 
href="https://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider">
      * 'Service Provider' specification</a>.
      */
-    protected static final String SERVICE_ID =
-        "META-INF/services/org.apache.commons.logging.LogFactory";
+    protected static final String SERVICE_ID = 
"META-INF/services/org.apache.commons.logging.LogFactory";
 
     /**
      * The name ({@code org.apache.commons.logging.diagnostics.dest})
@@ -133,8 +132,7 @@ public abstract class LogFactory {
      * Diagnostic logging should be used only to debug problematic
      * configurations and should not be set in normal production use.
      */
-    public static final String DIAGNOSTICS_DEST_PROPERTY =
-        "org.apache.commons.logging.diagnostics.dest";
+    public static final String DIAGNOSTICS_DEST_PROPERTY = 
"org.apache.commons.logging.diagnostics.dest";
 
     /**
      * When null (the usual case), no diagnostic output will be
@@ -148,7 +146,7 @@ public abstract class LogFactory {
      * logDiagnostic method, so that users can clearly see which
      * LogFactory class is generating the output.
      */
-    private static final String diagnosticPrefix;
+    private static final String DIAGNOSTICS_PREFIX;
 
     /**
      * Setting this system property
@@ -159,7 +157,7 @@ public abstract class LogFactory {
      * <strong>Note:</strong> {@code LogFactory} will print:
      * </p>
      * <pre>
-     * [ERROR] LogFactory: Load of custom hashtable failed
+     * [ERROR] LogFactory: Load of custom hash table failed
      * </pre>
      * <p>
      * to system error and then continue using a standard Hashtable.
@@ -189,12 +187,10 @@ public abstract class LogFactory {
      * the need to release them (on 1.3+ JVMs only, of course ;).
      * </p>
      */
-    public static final String HASHTABLE_IMPLEMENTATION_PROPERTY =
-        "org.apache.commons.logging.LogFactory.HashtableImpl";
+    public static final String HASHTABLE_IMPLEMENTATION_PROPERTY = 
"org.apache.commons.logging.LogFactory.HashtableImpl";
 
-    /** Name used to load the weak hashtable implementation by names. */
-    private static final String WEAK_HASHTABLE_CLASSNAME =
-        "org.apache.commons.logging.impl.WeakHashtable";
+    /** Name used to load the weak hash table implementation by names. */
+    private static final String WEAK_HASHTABLE_CLASSNAME = 
"org.apache.commons.logging.impl.WeakHashtable";
 
     /**
      * A reference to the class loader that loaded this class. This is the
@@ -228,8 +224,8 @@ public abstract class LogFactory {
      * <li>using JDK1.2+ and the calling code is loaded via the boot
      *  class loader (only likely for embedded systems work).</li>
      * </ul>
-     * Note that {@code factories} is a <i>Hashtable</i> (not a 
HashMap),
-     * and hashtables don't allow null as a key.
+     * Note that {@code factories} is a <em>Hashtable</em> (not a 
HashMap),
+     * and hash tables don't allow null as a key.
      * @deprecated since 1.1.2
      */
     @Deprecated
@@ -238,8 +234,8 @@ public abstract class LogFactory {
     static {
         // note: it's safe to call methods before initDiagnostics (though
         // diagnostic output gets discarded).
-<span class="fc" id="L241">        final ClassLoader thisClassLoader = 
getClassLoader(LogFactory.class);</span>
-<span class="fc" id="L242">        thisClassLoaderRef = new 
WeakReference&lt;&gt;(thisClassLoader);</span>
+<span class="fc" id="L237">        final ClassLoader thisClassLoader = 
getClassLoader(LogFactory.class);</span>
+<span class="fc" id="L238">        thisClassLoaderRef = new 
WeakReference&lt;&gt;(thisClassLoader);</span>
         // In order to avoid confusion where multiple instances of JCL are
         // being used via different class loaders within the same app, we
         // ensure each logged message has a prefix of form
@@ -251,22 +247,16 @@ public abstract class LogFactory {
         // output diagnostics from this class are static.
         String classLoaderName;
         try {
-<span class="pc bpc" id="L254" title="1 of 2 branches missed.">            if 
(thisClassLoader == null) {</span>
-<span class="nc" id="L255">                classLoaderName = 
&quot;BOOTLOADER&quot;;</span>
-            } else {
-<span class="fc" id="L257">                classLoaderName = 
objectId(thisClassLoader);</span>
-            }
-<span class="nc" id="L259">        } catch (final SecurityException e) {</span>
-<span class="nc" id="L260">            classLoaderName = 
&quot;UNKNOWN&quot;;</span>
-<span class="fc" id="L261">        }</span>
-<span class="fc" id="L262">        diagnosticPrefix = &quot;[LogFactory from 
&quot; + classLoaderName + &quot;] &quot;;</span>
-<span class="fc" id="L263">        DIAGNOSTICS_STREAM = 
initDiagnostics();</span>
-<span class="fc" id="L264">        
logClassLoaderEnvironment(LogFactory.class);</span>
-<span class="fc" id="L265">        factories = createFactoryStore();</span>
-<span class="pc bpc" id="L266" title="1 of 2 branches missed.">        if 
(isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L267">            logDiagnostic(&quot;BOOTSTRAP 
COMPLETED&quot;);</span>
-        }
-<span class="fc" id="L269">    }</span>
+<span class="pc bpc" id="L250" title="1 of 2 branches missed.">            
classLoaderName = thisClassLoader != null ? objectId(thisClassLoader) : 
&quot;BOOTLOADER&quot;; </span>
+<span class="nc" id="L251">        } catch (final SecurityException e) {</span>
+<span class="nc" id="L252">            classLoaderName = 
&quot;UNKNOWN&quot;;</span>
+<span class="fc" id="L253">        }</span>
+<span class="fc" id="L254">        DIAGNOSTICS_PREFIX = &quot;[LogFactory from 
&quot; + classLoaderName + &quot;] &quot;;</span>
+<span class="fc" id="L255">        DIAGNOSTICS_STREAM = 
initDiagnostics();</span>
+<span class="fc" id="L256">        
logClassLoaderEnvironment(LogFactory.class);</span>
+<span class="fc" id="L257">        factories = createFactoryStore();</span>
+<span class="fc" id="L258">        logDiagnostic(&quot;BOOTSTRAP 
COMPLETED&quot;);</span>
+<span class="fc" id="L259">    }</span>
 
     /**
      * Remember this factory, so later calls to LogFactory.getCachedFactory
@@ -280,18 +270,17 @@ public abstract class LogFactory {
     private static void cacheFactory(final ClassLoader classLoader, final 
LogFactory factory) {
         // Ideally we would assert(factory != null) here. However reporting
         // errors from within a logging implementation is a little tricky!
-
-<span class="pc bpc" id="L284" title="1 of 2 branches missed.">        if 
(factory != null) {</span>
-<span class="fc bfc" id="L285" title="All 2 branches covered.">            if 
(classLoader == null) {</span>
-<span class="fc" id="L286">                nullClassLoaderFactory = 
factory;</span>
+<span class="pc bpc" id="L273" title="1 of 2 branches missed.">        if 
(factory != null) {</span>
+<span class="fc bfc" id="L274" title="All 2 branches covered.">            if 
(classLoader == null) {</span>
+<span class="fc" id="L275">                nullClassLoaderFactory = 
factory;</span>
             } else {
-<span class="fc" id="L288">                factories.put(classLoader, 
factory);</span>
+<span class="fc" id="L277">                factories.put(classLoader, 
factory);</span>
             }
         }
-<span class="fc" id="L291">    }</span>
+<span class="fc" id="L280">    }</span>
 
     /**
-     * Implements the operations described in the Javadoc for newFactory.
+     * Creates a LogFactory object or a LogConfigurationException object.
      *
      * @param factoryClassName Factory class.
      * @param classLoader      used to load the specified factory class. This 
is expected to be either the TCCL or the class loader which loaded this class.
@@ -302,18 +291,18 @@ public abstract class LogFactory {
     protected static Object createFactory(final String factoryClassName, final 
ClassLoader classLoader) {
         // This will be used to diagnose bad configurations
         // and allow a useful message to be sent to the user
-<span class="fc" id="L305">        Class&lt;?&gt; logFactoryClass = 
null;</span>
+<span class="fc" id="L294">        Class&lt;?&gt; logFactoryClass = 
null;</span>
         try {
-<span class="pc bpc" id="L307" title="1 of 2 branches missed.">            if 
(classLoader != null) {</span>
+<span class="pc bpc" id="L296" title="1 of 2 branches missed.">            if 
(classLoader != null) {</span>
                 try {
                     // First the given class loader param (thread class loader)
 
                     // Warning: must typecast here &amp; allow exception
                     // to be generated/caught &amp; recast properly.
-<span class="fc" id="L313">                    logFactoryClass = 
classLoader.loadClass(factoryClassName);</span>
-<span class="pc bpc" id="L314" title="1 of 2 branches missed.">                
    if (LogFactory.class.isAssignableFrom(logFactoryClass)) {</span>
-<span class="pc bpc" id="L315" title="1 of 2 branches missed.">                
        if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L316">                            
logDiagnostic(&quot;Loaded class &quot; + logFactoryClass.getName() + &quot; 
from class loader &quot; + objectId(classLoader));</span>
+<span class="fc" id="L302">                    logFactoryClass = 
classLoader.loadClass(factoryClassName);</span>
+<span class="pc bpc" id="L303" title="1 of 2 branches missed.">                
    if (LogFactory.class.isAssignableFrom(logFactoryClass)) {</span>
+<span class="pc bpc" id="L304" title="1 of 2 branches missed.">                
        if (isDiagnosticsEnabled()) {</span>
+<span class="nc" id="L305">                            
logDiagnostic(&quot;Loaded class &quot; + logFactoryClass.getName() + &quot; 
from class loader &quot; + objectId(classLoader));</span>
                         }
                     } else //
                     // This indicates a problem with the ClassLoader tree.
@@ -326,74 +315,63 @@ public abstract class LogFactory {
                     // problem is to remove the extra JCL jars from the
                     // ClassLoader hierarchy.
                     //
-<span class="nc bnc" id="L329" title="All 2 branches missed.">                 
   if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L330">                        logDiagnostic(&quot;Factory 
class &quot; + logFactoryClass.getName() + &quot; loaded from class loader 
&quot; + objectId(logFactoryClass.getClassLoader())</span>
-<span class="nc" id="L331">                                + &quot; does not 
extend '&quot; + LogFactory.class.getName() + &quot;' as loaded by this class 
loader.&quot;);</span>
-<span class="nc" id="L332">                        logHierarchy(&quot;[BAD CL 
TREE] &quot;, classLoader);</span>
+<span class="nc bnc" id="L318" title="All 2 branches missed.">                 
   if (isDiagnosticsEnabled()) {</span>
+<span class="nc" id="L319">                        logDiagnostic(&quot;Factory 
class &quot; + logFactoryClass.getName() + &quot; loaded from class loader 
&quot; + objectId(logFactoryClass.getClassLoader())</span>
+<span class="nc" id="L320">                                + &quot; does not 
extend '&quot; + LogFactory.class.getName() + &quot;' as loaded by this class 
loader.&quot;);</span>
+<span class="nc" id="L321">                        logHierarchy(&quot;[BAD CL 
TREE] &quot;, classLoader);</span>
                     }
+                    // Force a ClassCastException
+<span class="fc" id="L324">                    return 
LogFactory.class.cast(logFactoryClass.getConstructor().newInstance());</span>
 
-<span class="fc" id="L335">                    return 
logFactoryClass.getConstructor().newInstance();</span>
-
-<span class="fc" id="L337">                } catch (final 
ClassNotFoundException ex) {</span>
-<span class="pc bpc" id="L338" title="1 of 2 branches missed.">                
    if (classLoader == thisClassLoaderRef.get()) {</span>
+<span class="fc" id="L326">                } catch (final 
ClassNotFoundException ex) {</span>
+<span class="pc bpc" id="L327" title="1 of 2 branches missed.">                
    if (classLoader == thisClassLoaderRef.get()) {</span>
                         // Nothing more to try, onwards.
-<span class="pc bpc" id="L340" title="1 of 2 branches missed.">                
        if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L341">                            
logDiagnostic(&quot;Unable to locate any class called '&quot; + 
factoryClassName + &quot;' via class loader &quot; + 
objectId(classLoader));</span>
+<span class="pc bpc" id="L329" title="1 of 2 branches missed.">                
        if (isDiagnosticsEnabled()) {</span>
+<span class="nc" id="L330">                            
logDiagnostic(&quot;Unable to locate any class called '&quot; + 
factoryClassName + &quot;' via class loader &quot; + 
objectId(classLoader));</span>
                         }
-<span class="fc" id="L343">                        throw ex;</span>
+<span class="fc" id="L332">                        throw ex;</span>
                     }
                     // ignore exception, continue
-<span class="nc" id="L346">                } catch (final NoClassDefFoundError 
e) {</span>
-<span class="nc bnc" id="L347" title="All 2 branches missed.">                 
   if (classLoader == thisClassLoaderRef.get()) {</span>
+<span class="nc" id="L335">                } catch (final NoClassDefFoundError 
e) {</span>
+<span class="nc bnc" id="L336" title="All 2 branches missed.">                 
   if (classLoader == thisClassLoaderRef.get()) {</span>
                         // Nothing more to try, onwards.
-<span class="nc bnc" id="L349" title="All 2 branches missed.">                 
       if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L350">                            
logDiagnostic(&quot;Class '&quot; + factoryClassName + &quot;' cannot be 
loaded&quot; + &quot; via class loader &quot; + objectId(classLoader)</span>
+<span class="nc bnc" id="L338" title="All 2 branches missed.">                 
       if (isDiagnosticsEnabled()) {</span>
+<span class="nc" id="L339">                            
logDiagnostic(&quot;Class '&quot; + factoryClassName + &quot;' cannot be 
loaded&quot; + &quot; via class loader &quot; + objectId(classLoader)</span>
                                     + &quot; - it depends on some other class 
that cannot be found.&quot;);
                         }
-<span class="nc" id="L353">                        throw e;</span>
+<span class="nc" id="L342">                        throw e;</span>
                     }
                     // ignore exception, continue
-<span class="nc" id="L356">                } catch (final ClassCastException 
e) {</span>
-<span class="nc bnc" id="L357" title="All 2 branches missed.">                 
   if (classLoader == thisClassLoaderRef.get()) {</span>
+<span class="nc" id="L345">                } catch (final ClassCastException 
e) {</span>
+<span class="nc bnc" id="L346" title="All 2 branches missed.">                 
   if (classLoader == thisClassLoaderRef.get()) {</span>
                         // There's no point in falling through to the code 
below that
                         // tries again with thisClassLoaderRef, because we've 
just tried
                         // loading with that loader (not the TCCL). Just throw 
an
                         // appropriate exception here.
-
-<span class="nc" id="L363">                        final boolean 
implementsLogFactory = implementsLogFactory(logFactoryClass);</span>
-
+<span class="nc" id="L351">                        final boolean 
implementsLogFactory = implementsLogFactory(logFactoryClass);</span>
                         //
                         // Construct a good message: users may not actual 
expect that a custom implementation
                         // has been specified. Several well known containers 
use this mechanism to adapt JCL
                         // to their native logging system.
                         //
-<span class="nc" id="L370">                        final StringBuilder msg = 
new StringBuilder();</span>
-<span class="nc" id="L371">                        msg.append(&quot;The 
application has specified that a custom LogFactory implementation 
&quot;);</span>
-<span class="nc" id="L372">                        msg.append(&quot;should be 
used but Class '&quot;);</span>
-<span class="nc" id="L373">                        
msg.append(factoryClassName);</span>
-<span class="nc" id="L374">                        msg.append(&quot;' cannot 
be converted to '&quot;);</span>
-<span class="nc" id="L375">                        
msg.append(LogFactory.class.getName());</span>
-<span class="nc" id="L376">                        msg.append(&quot;'. 
&quot;);</span>
-<span class="nc bnc" id="L377" title="All 2 branches missed.">                 
       if (implementsLogFactory) {</span>
-<span class="nc" id="L378">                            msg.append(&quot;The 
conflict is caused by the presence of multiple LogFactory classes 
&quot;);</span>
-<span class="nc" id="L379">                            msg.append(&quot;in 
incompatible class loaders. &quot;);</span>
-<span class="nc" id="L380">                            
msg.append(&quot;Background can be found in 
https://commons.apache.org/logging/tech.html. &quot;);</span>
-<span class="nc" id="L381">                            msg.append(&quot;If you 
have not explicitly specified a custom LogFactory then it is likely 
&quot;);</span>
-<span class="nc" id="L382">                            msg.append(&quot;that 
the container has set one without your knowledge. &quot;);</span>
-<span class="nc" id="L383">                            msg.append(&quot;In 
this case, consider using the commons-logging-adapters.jar file or 
&quot;);</span>
-<span class="nc" id="L384">                            
msg.append(&quot;specifying the standard LogFactory from the command line. 
&quot;);</span>
+<span class="nc" id="L357">                        final StringBuilder msg = 
new StringBuilder();</span>
+<span class="nc" id="L358">                        msg.append(&quot;The 
application has specified that a custom LogFactory implementation should be 
used but Class '&quot;);</span>
+<span class="nc" id="L359">                        
msg.append(factoryClassName);</span>
+<span class="nc" id="L360">                        msg.append(&quot;' cannot 
be converted to '&quot;);</span>
+<span class="nc" id="L361">                        
msg.append(LogFactory.class.getName());</span>
+<span class="nc" id="L362">                        msg.append(&quot;'. 
&quot;);</span>
+<span class="nc bnc" id="L363" title="All 2 branches missed.">                 
       if (implementsLogFactory) {</span>
+<span class="nc" id="L364">                            msg.append(&quot;The 
conflict is caused by the presence of multiple LogFactory classes in 
incompatible class loaders. Background can&quot;);</span>
+<span class="nc" id="L365">                            msg.append(&quot; be 
found in https://commons.apache.org/logging/tech.html. If you have not 
explicitly specified a custom LogFactory&quot;);</span>
+<span class="nc" id="L366">                            msg.append(&quot; then 
it is likely that the container has set one without your knowledge. In this 
case, consider using the &quot;);</span>
+<span class="nc" id="L367">                            
msg.append(&quot;commons-logging-adapters.jar file or specifying the standard 
LogFactory from the command line. &quot;);</span>
                         } else {
-<span class="nc" id="L386">                            msg.append(&quot;Please 
check the custom implementation. &quot;);</span>
-                        }
-<span class="nc" id="L388">                        msg.append(&quot;Help can 
be found at 
https://commons.apache.org/logging/troubleshooting.html.&quot;);</span>
-
-<span class="nc bnc" id="L390" title="All 2 branches missed.">                 
       if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L391">                            
logDiagnostic(msg.toString());</span>
+<span class="nc" id="L369">                            msg.append(&quot;Please 
check the custom implementation. &quot;);</span>
                         }
-
-<span class="nc" id="L394">                        throw new 
ClassCastException(msg.toString());</span>
+<span class="nc" id="L371">                        msg.append(&quot;Help can 
be found at 
https://commons.apache.org/logging/troubleshooting.html.&quot;);</span>
+<span class="nc" id="L372">                        
logDiagnostic(msg.toString());</span>
+<span class="nc" id="L373">                        throw new 
ClassCastException(msg.toString());</span>
                     }
-
                     // Ignore exception, continue. Presumably the class loader 
was the
                     // TCCL; the code below will try to load the class via 
thisClassLoaderRef.
                     // This will handle the case where the original calling 
class is in
@@ -406,7 +384,7 @@ public abstract class LogFactory {
                     // in a shared classpath. In that case:
                     // (a) the class really does implement LogFactory (bad log 
msg above)
                     // (b) the fallback code will result in exactly the same 
problem.
-<span class="nc" id="L409">                }</span>
+<span class="nc" id="L387">                }</span>
             }
 
             /*
@@ -420,27 +398,27 @@ public abstract class LogFactory {
              */
             // Warning: must typecast here &amp; allow exception
             // to be generated/caught &amp; recast properly.
-<span class="nc bnc" id="L423" title="All 2 branches missed.">            if 
(isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L424">                logDiagnostic(</span>
-<span class="nc" id="L425">                        &quot;Unable to load 
factory class via class loader &quot; + objectId(classLoader) + &quot; - trying 
the class loader associated with this LogFactory.&quot;);</span>
-            }
-<span class="nc" id="L427">            logFactoryClass = 
Class.forName(factoryClassName);</span>
-<span class="nc" id="L428">            return 
logFactoryClass.newInstance();</span>
-<span class="fc" id="L429">        } catch (final Exception e) {</span>
+<span class="nc bnc" id="L401" title="All 2 branches missed.">            if 
(isDiagnosticsEnabled()) {</span>
+<span class="nc" id="L402">                logDiagnostic(</span>
+<span class="nc" id="L403">                        &quot;Unable to load 
factory class via class loader &quot; + objectId(classLoader) + &quot; - trying 
the class loader associated with this LogFactory.&quot;);</span>
+            }
+<span class="nc" id="L405">            logFactoryClass = 
Class.forName(factoryClassName);</span>
+            // Force a ClassCastException
+<span class="nc" id="L407">            return 
LogFactory.class.cast(logFactoryClass.getConstructor().newInstance());</span>
+<span class="fc" id="L408">        } catch (final Exception e) {</span>
             // Check to see if we've got a bad configuration
-<span class="pc bpc" id="L431" title="1 of 2 branches missed.">            if 
(isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L432">                logDiagnostic(&quot;Unable to 
create LogFactory instance.&quot;);</span>
+<span class="pc bpc" id="L410" title="1 of 2 branches missed.">            if 
(isDiagnosticsEnabled()) {</span>
+<span class="nc" id="L411">                logDiagnostic(&quot;Unable to 
create LogFactory instance.&quot;);</span>
             }
-<span class="pc bpc" id="L434" title="3 of 4 branches missed.">            if 
(logFactoryClass != null &amp;&amp; 
!LogFactory.class.isAssignableFrom(logFactoryClass)) {</span>
-<span class="nc" id="L435">                return new 
LogConfigurationException(&quot;The chosen LogFactory implementation does not 
extend LogFactory.&quot; + &quot; Please check your configuration.&quot;,</span>
-                        e);
+<span class="pc bpc" id="L413" title="3 of 4 branches missed.">            if 
(logFactoryClass != null &amp;&amp; 
!LogFactory.class.isAssignableFrom(logFactoryClass)) {</span>
+<span class="nc" id="L414">                return new 
LogConfigurationException(&quot;The chosen LogFactory implementation does not 
extend LogFactory. Please check your configuration.&quot;, e);</span>
             }
-<span class="fc" id="L438">            return new 
LogConfigurationException(e);</span>
+<span class="fc" id="L416">            return new 
LogConfigurationException(e);</span>
         }
     }
 
     /**
-     * Create the hashtable which will be used to store a map of
+     * Creates the hash table which will be used to store a map of
      * (context class loader -&gt; logfactory-object). Version 1.2+ of Java
      * supports &quot;weak references&quot;, allowing a custom Hashtable class
      * to be used which uses only weak references to its keys. Using weak
@@ -456,43 +434,41 @@ public abstract class LogFactory {
      * &lt;/p&gt;
      */
     private static Hashtable&lt;ClassLoader, LogFactory&gt; 
createFactoryStore() {
-<span class="fc" id="L459">        Hashtable&lt;ClassLoader, LogFactory&gt; 
result = null;</span>
+<span class="fc" id="L437">        Hashtable&lt;ClassLoader, LogFactory&gt; 
result = null;</span>
         String storeImplementationClass;
         try {
-<span class="fc" id="L462">            storeImplementationClass = 
getSystemProperty(HASHTABLE_IMPLEMENTATION_PROPERTY, null);</span>
-<span class="fc" id="L463">        } catch (final SecurityException ex) 
{</span>
+<span class="fc" id="L440">            storeImplementationClass = 
getSystemProperty(HASHTABLE_IMPLEMENTATION_PROPERTY, null);</span>
+<span class="fc" id="L441">        } catch (final SecurityException ex) 
{</span>
             // Permissions don't allow this to be accessed. Default to the 
&quot;modern&quot;
-            // weak hashtable implementation if it is available.
-<span class="fc" id="L466">            storeImplementationClass = null;</span>
-<span class="fc" id="L467">        }</span>
-
-<span class="fc bfc" id="L469" title="All 2 branches covered.">        if 
(storeImplementationClass == null) {</span>
-<span class="fc" id="L470">            storeImplementationClass = 
WEAK_HASHTABLE_CLASSNAME;</span>
+            // weak hash table implementation if it is available.
+<span class="fc" id="L444">            storeImplementationClass = null;</span>
+<span class="fc" id="L445">        }</span>
+<span class="fc bfc" id="L446" title="All 2 branches covered.">        if 
(storeImplementationClass == null) {</span>
+<span class="fc" id="L447">            storeImplementationClass = 
WEAK_HASHTABLE_CLASSNAME;</span>
         }
         try {
-<span class="fc" id="L473">            final 
Class&lt;Hashtable&lt;ClassLoader, LogFactory&gt;&gt; implementationClass = 
(Class&lt;Hashtable&lt;ClassLoader, LogFactory&gt;&gt;) Class</span>
-<span class="fc" id="L474">                    
.forName(storeImplementationClass);</span>
-<span class="fc" id="L475">            result = 
implementationClass.getConstructor().newInstance();</span>
-<span class="nc" id="L476">        } catch (final Throwable t) {</span>
-<span class="nc" id="L477">            handleThrowable(t); // may re-throw 
t</span>
-
+<span class="fc" id="L450">            final 
Class&lt;Hashtable&lt;ClassLoader, LogFactory&gt;&gt; implementationClass = 
(Class&lt;Hashtable&lt;ClassLoader, LogFactory&gt;&gt;) Class</span>
+<span class="fc" id="L451">                    
.forName(storeImplementationClass);</span>
+<span class="fc" id="L452">            result = 
implementationClass.getConstructor().newInstance();</span>
+<span class="nc" id="L453">        } catch (final Throwable t) {</span>
+<span class="nc" id="L454">            handleThrowable(t); // may re-throw 
t</span>
             // ignore
-<span class="nc bnc" id="L480" title="All 2 branches missed.">            if 
(!WEAK_HASHTABLE_CLASSNAME.equals(storeImplementationClass)) {</span>
+<span class="nc bnc" id="L456" title="All 2 branches missed.">            if 
(!WEAK_HASHTABLE_CLASSNAME.equals(storeImplementationClass)) {</span>
                 // if the user's trying to set up a custom implementation, 
give a clue
-<span class="nc bnc" id="L482" title="All 2 branches missed.">                
if (isDiagnosticsEnabled()) {</span>
+<span class="nc bnc" id="L458" title="All 2 branches missed.">                
if (isDiagnosticsEnabled()) {</span>
                     // use internal logging to issue the warning
-<span class="nc" id="L484">                    logDiagnostic(&quot;[ERROR] 
LogFactory: Load of custom Hashtable failed&quot;);</span>
+<span class="nc" id="L460">                    logDiagnostic(&quot;[ERROR] 
LogFactory: Load of custom Hashtable failed&quot;);</span>
                 } else {
                     // we *really* want this output, even if diagnostics 
weren't
                     // explicitly enabled by the user.
-<span class="nc" id="L488">                    
System.err.println(&quot;[ERROR] LogFactory: Load of custom Hashtable 
failed&quot;);</span>
+<span class="nc" id="L464">                    
System.err.println(&quot;[ERROR] LogFactory: Load of custom Hashtable 
failed&quot;);</span>
                 }
             }
-<span class="fc" id="L491">        }</span>
-<span class="pc bpc" id="L492" title="1 of 2 branches missed.">        if 
(result == null) {</span>
-<span class="nc" id="L493">            result = new Hashtable&lt;&gt;();</span>
+<span class="fc" id="L467">        }</span>
+<span class="pc bpc" id="L468" title="1 of 2 branches missed.">        if 
(result == null) {</span>
+<span class="nc" id="L469">            result = new Hashtable&lt;&gt;();</span>
         }
-<span class="fc" id="L495">        return result;</span>
+<span class="fc" id="L471">        return result;</span>
     }
 
     /**
@@ -519,10 +495,10 @@ public abstract class LogFactory {
      * @since 1.1
      */
     protected static ClassLoader directGetContextClassLoader() throws 
LogConfigurationException {
-<span class="fc" id="L522">        ClassLoader classLoader = null;</span>
+<span class="fc" id="L498">        ClassLoader classLoader = null;</span>
         try {
-<span class="fc" id="L524">            classLoader = 
Thread.currentThread().getContextClassLoader();</span>
-<span class="fc" id="L525">        } catch (final SecurityException ignore) 
{</span>
+<span class="fc" id="L500">            classLoader = 
Thread.currentThread().getContextClassLoader();</span>
+<span class="fc" id="L501">        } catch (final SecurityException ignore) 
{</span>
             // getContextClassLoader() throws SecurityException when
             // the context class loader isn't an ancestor of the
             // calling class's class loader, or if security
@@ -530,13 +506,13 @@ public abstract class LogFactory {
             //
             // We ignore this exception to be consistent with the previous
             // behavior (e.g. 1.1.3 and earlier).
-<span class="fc" id="L533">        }</span>
+<span class="fc" id="L509">        }</span>
         // Return the selected class loader
-<span class="fc" id="L535">        return classLoader;</span>
+<span class="fc" id="L511">        return classLoader;</span>
     }
 
     /**
-     * Check cached factories (keyed by contextClassLoader)
+     * Gets a cached log factory (keyed by contextClassLoader)
      *
      * @param contextClassLoader is the context class loader associated
      * with the current thread. This allows separate LogFactory objects
@@ -550,14 +526,14 @@ public abstract class LogFactory {
      *  we have seen this particular class loader.
      */
     private static LogFactory getCachedFactory(final ClassLoader 
contextClassLoader) {
-<span class="fc bfc" id="L553" title="All 2 branches covered.">        if 
(contextClassLoader == null) {</span>
+<span class="fc bfc" id="L529" title="All 2 branches covered.">        if 
(contextClassLoader == null) {</span>
             // We have to handle this specially, as factories is a Hashtable
             // and those don't accept null as a key value.
             //
             // nb: nullClassLoaderFactory might be null. That's ok.
-<span class="fc" id="L558">            return nullClassLoaderFactory;</span>
+<span class="fc" id="L534">            return nullClassLoaderFactory;</span>
         }
-<span class="fc" id="L560">        return 
factories.get(contextClassLoader);</span>
+<span class="fc" id="L536">        return 
factories.get(contextClassLoader);</span>
     }
 
     /**
@@ -595,17 +571,15 @@ public abstract class LogFactory {
      */
     protected static ClassLoader getClassLoader(final Class&lt;?&gt; clazz) {
         try {
-<span class="fc" id="L598">            return clazz.getClassLoader();</span>
-<span class="nc" id="L599">        } catch (final SecurityException ex) 
{</span>
-<span class="nc bnc" id="L600" title="All 2 branches missed.">            if 
(isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L601">                logDiagnostic(&quot;Unable to get 
class loader for class '&quot; + clazz + &quot;' due to security restrictions - 
&quot; + ex.getMessage());</span>
-            }
-<span class="nc" id="L603">            throw ex;</span>
+<span class="fc" id="L574">            return clazz.getClassLoader();</span>
+<span class="nc" id="L575">        } catch (final SecurityException ex) 
{</span>
+<span class="nc" id="L576">            logDiagnostic(() -&gt; &quot;Unable to 
get class loader for class '&quot; + clazz + &quot;' due to security 
restrictions - &quot; + ex.getMessage());</span>
+<span class="nc" id="L577">            throw ex;</span>
         }
     }
 
     /**
-     * Locate a user-provided configuration file.
+     * Gets a user-provided configuration file.
      * &lt;p&gt;
      * The classpath of the specified classLoader (usually the context class 
loader)
      * is searched for properties files of the specified name. If none is 
found,
@@ -627,76 +601,66 @@ public abstract class LogFactory {
      * &lt;/p&gt;
      */
     private static Properties getConfigurationFile(final ClassLoader 
classLoader, final String fileName) {
-<span class="fc" id="L630">        Properties props = null;</span>
-<span class="fc" id="L631">        double priority = 0.0;</span>
-<span class="fc" id="L632">        URL propsUrl = null;</span>
+<span class="fc" id="L604">        Properties props = null;</span>
+<span class="fc" id="L605">        double priority = 0.0;</span>
+<span class="fc" id="L606">        URL propsUrl = null;</span>
         try {
-<span class="fc" id="L634">            final Enumeration&lt;URL&gt; urls = 
getResources(classLoader, fileName);</span>
-
-<span class="pc bpc" id="L636" title="1 of 2 branches missed.">            if 
(urls == null) {</span>
-<span class="nc" id="L637">                return null;</span>
-            }
-
-<span class="fc bfc" id="L640" title="All 2 branches covered.">            
while (urls.hasMoreElements()) {</span>
-<span class="fc" id="L641">                final URL url = 
urls.nextElement();</span>
-
-<span class="fc" id="L643">                final Properties newProps = 
getProperties(url);</span>
-<span class="pc bpc" id="L644" title="1 of 2 branches missed.">                
if (newProps != null) {</span>
-<span class="fc bfc" id="L645" title="All 2 branches covered.">                
    if (props == null) {</span>
-<span class="fc" id="L646">                        propsUrl = url;</span>
-<span class="fc" id="L647">                        props = newProps;</span>
-<span class="fc" id="L648">                        final String priorityStr = 
props.getProperty(PRIORITY_KEY);</span>
-<span class="fc" id="L649">                        priority = 0.0;</span>
-<span class="fc bfc" id="L650" title="All 2 branches covered.">                
        if (priorityStr != null) {</span>
-<span class="fc" id="L651">                            priority = 
Double.parseDouble(priorityStr);</span>
+<span class="fc" id="L608">            final Enumeration&lt;URL&gt; urls = 
getResources(classLoader, fileName);</span>
+<span class="pc bpc" id="L609" title="1 of 2 branches missed.">            if 
(urls == null) {</span>
+<span class="nc" id="L610">                return null;</span>
+            }
+<span class="fc bfc" id="L612" title="All 2 branches covered.">            
while (urls.hasMoreElements()) {</span>
+<span class="fc" id="L613">                final URL url = 
urls.nextElement();</span>
+<span class="fc" id="L614">                final Properties newProps = 
getProperties(url);</span>
+<span class="pc bpc" id="L615" title="1 of 2 branches missed.">                
if (newProps != null) {</span>
+<span class="fc bfc" id="L616" title="All 2 branches covered.">                
    if (props == null) {</span>
+<span class="fc" id="L617">                        propsUrl = url;</span>
+<span class="fc" id="L618">                        props = newProps;</span>
+<span class="fc" id="L619">                        final String priorityStr = 
props.getProperty(PRIORITY_KEY);</span>
+<span class="fc" id="L620">                        priority = 0.0;</span>
+<span class="fc bfc" id="L621" title="All 2 branches covered.">                
        if (priorityStr != null) {</span>
+<span class="fc" id="L622">                            priority = 
Double.parseDouble(priorityStr);</span>
                         }
-
-<span class="pc bpc" id="L654" title="1 of 2 branches missed.">                
        if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L655">                            
logDiagnostic(&quot;[LOOKUP] Properties file found at '&quot; + url + 
&quot;'&quot; + &quot; with priority &quot; + priority);</span>
+<span class="pc bpc" id="L624" title="1 of 2 branches missed.">                
        if (isDiagnosticsEnabled()) {</span>
+<span class="nc" id="L625">                            
logDiagnostic(&quot;[LOOKUP] Properties file found at '&quot; + url + 
&quot;'&quot; + &quot; with priority &quot; + priority);</span>
                         }
-<span class="fc" id="L657">                    } else {</span>
-<span class="fc" id="L658">                        final String newPriorityStr 
= newProps.getProperty(PRIORITY_KEY);</span>
-<span class="fc" id="L659">                        double newPriority = 
0.0;</span>
-<span class="fc bfc" id="L660" title="All 2 branches covered.">                
        if (newPriorityStr != null) {</span>
-<span class="fc" id="L661">                            newPriority = 
Double.parseDouble(newPriorityStr);</span>
+<span class="fc" id="L627">                    } else {</span>
+<span class="fc" id="L628">                        final String newPriorityStr 
= newProps.getProperty(PRIORITY_KEY);</span>
+<span class="fc" id="L629">                        double newPriority = 
0.0;</span>
+<span class="fc bfc" id="L630" title="All 2 branches covered.">                
        if (newPriorityStr != null) {</span>
+<span class="fc" id="L631">                            newPriority = 
Double.parseDouble(newPriorityStr);</span>
                         }
-
-<span class="fc bfc" id="L664" title="All 2 branches covered.">                
        if (newPriority &gt; priority) {</span>
-<span class="pc bpc" id="L665" title="1 of 2 branches missed.">                
            if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L666">                                
logDiagnostic(&quot;[LOOKUP] Properties file at '&quot; + url + &quot;'&quot; + 
&quot; with priority &quot; + newPriority + &quot; overrides file at '&quot; + 
propsUrl</span>
+<span class="fc bfc" id="L633" title="All 2 branches covered.">                
        if (newPriority &gt; priority) {</span>
+<span class="pc bpc" id="L634" title="1 of 2 branches missed.">                
            if (isDiagnosticsEnabled()) {</span>
+<span class="nc" id="L635">                                
logDiagnostic(&quot;[LOOKUP] Properties file at '&quot; + url + &quot;'&quot; + 
&quot; with priority &quot; + newPriority + &quot; overrides file at '&quot; + 
propsUrl</span>
                                         + &quot;'&quot; + &quot; with priority 
&quot; + priority);
                             }
-
-<span class="fc" id="L670">                            propsUrl = url;</span>
-<span class="fc" id="L671">                            props = newProps;</span>
-<span class="fc" id="L672">                            priority = 
newPriority;</span>
-<span class="pc bpc" id="L673" title="1 of 2 branches missed.">                
        } else if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L674">                            
logDiagnostic(&quot;[LOOKUP] Properties file at '&quot; + url + &quot;'&quot; + 
&quot; with priority &quot; + newPriority + &quot; does not override file at 
'&quot;</span>
+<span class="fc" id="L638">                            propsUrl = url;</span>
+<span class="fc" id="L639">                            props = newProps;</span>
+<span class="fc" id="L640">                            priority = 
newPriority;</span>
+<span class="pc bpc" id="L641" title="1 of 2 branches missed.">                
        } else if (isDiagnosticsEnabled()) {</span>
+<span class="nc" id="L642">                            
logDiagnostic(&quot;[LOOKUP] Properties file at '&quot; + url + &quot;'&quot; + 
&quot; with priority &quot; + newPriority + &quot; does not override file at 
'&quot;</span>
                                     + propsUrl + &quot;'&quot; + &quot; with 
priority &quot; + priority);
                         }
                     }
 
                 }
-<span class="fc" id="L680">            }</span>
-<span class="nc" id="L681">        } catch (final SecurityException e) {</span>
-<span class="nc bnc" id="L682" title="All 2 branches missed.">            if 
(isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L683">                
logDiagnostic(&quot;SecurityException thrown while trying to find/read config 
files.&quot;);</span>
-            }
-<span class="fc" id="L685">        }</span>
-
-<span class="pc bpc" id="L687" title="1 of 2 branches missed.">        if 
(isDiagnosticsEnabled()) {</span>
-<span class="nc bnc" id="L688" title="All 2 branches missed.">            if 
(props == null) {</span>
-<span class="nc" id="L689">                logDiagnostic(&quot;[LOOKUP] No 
properties file of name '&quot; + fileName + &quot;' found.&quot;);</span>
+<span class="fc" id="L648">            }</span>
+<span class="nc" id="L649">        } catch (final SecurityException e) {</span>
+<span class="nc" id="L650">            logDiagnostic(&quot;SecurityException 
thrown while trying to find/read config files.&quot;);</span>
+<span class="fc" id="L651">        }</span>
+<span class="pc bpc" id="L652" title="1 of 2 branches missed.">        if 
(isDiagnosticsEnabled()) {</span>
+<span class="nc bnc" id="L653" title="All 2 branches missed.">            if 
(props == null) {</span>
+<span class="nc" id="L654">                logDiagnostic(&quot;[LOOKUP] No 
properties file of name '&quot; + fileName + &quot;' found.&quot;);</span>
             } else {
-<span class="nc" id="L691">                logDiagnostic(&quot;[LOOKUP] 
Properties file of name '&quot; + fileName + &quot;' found at '&quot; + 
propsUrl + '&quot;');</span>
+<span class="nc" id="L656">                logDiagnostic(&quot;[LOOKUP] 
Properties file of name '&quot; + fileName + &quot;' found at '&quot; + 
propsUrl + '&quot;');</span>
             }
         }
-
-<span class="fc" id="L695">        return props;</span>
+<span class="fc" id="L659">        return props;</span>
     }
 
     /**
-     * Returns the current context class loader.
+     * Gets the current context class loader.
      * &lt;p&gt;
      * In versions prior to 1.1, this method did not use an AccessController.
      * In version 1.1, an AccessController wrapper was incorrectly added to
@@ -715,11 +679,11 @@ public abstract class LogFactory {
      *  attempting to get the context class loader.
      */
     protected static ClassLoader getContextClassLoader() throws 
LogConfigurationException {
-<span class="nc" id="L718">        return directGetContextClassLoader();</span>
+<span class="nc" id="L682">        return directGetContextClassLoader();</span>
     }
 
     /**
-     * Calls LogFactory.directGetContextClassLoader under the control of an
+     * Calls {@link LogFactory#directGetContextClassLoader()} under the 
control of an
      * AccessController class. This means that Java code running under a
      * security manager that forbids access to ClassLoaders will still work
      * if this class is given appropriate privileges, even when the caller
@@ -733,7 +697,7 @@ public abstract class LogFactory {
      *  attempting to get the context class loader.
      */
     private static ClassLoader getContextClassLoaderInternal() throws 
LogConfigurationException {
-<span class="fc" id="L736">        return 
AccessController.doPrivileged((PrivilegedAction&lt;ClassLoader&gt;) 
LogFactory::directGetContextClassLoader);</span>
+<span class="fc" id="L700">        return 
AccessController.doPrivileged((PrivilegedAction&lt;ClassLoader&gt;) 
LogFactory::directGetContextClassLoader);</span>
     }
 
     /**
@@ -760,26 +724,26 @@ public abstract class LogFactory {
      */
     public static LogFactory getFactory() throws LogConfigurationException {
         // Identify the class loader we will be using
-<span class="fc" id="L763">        final ClassLoader contextClassLoader = 
getContextClassLoaderInternal();</span>
+<span class="fc" id="L727">        final ClassLoader contextClassLoader = 
getContextClassLoaderInternal();</span>
 
         // This is an odd enough situation to report about. This
         // output will be a nuisance on JDK1.1, as the system
         // class loader is null in that environment.
-<span class="pc bpc" id="L768" title="1 of 4 branches missed.">        if 
(contextClassLoader == null &amp;&amp; isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L769">            logDiagnostic(&quot;Context class 
loader is null.&quot;);</span>
+<span class="fc bfc" id="L732" title="All 2 branches covered.">        if 
(contextClassLoader == null) {</span>
+<span class="fc" id="L733">            logDiagnostic(&quot;Context class 
loader is null.&quot;);</span>
         }
 
         // Return any previously registered factory for this class loader
-<span class="fc" id="L773">        LogFactory factory = 
getCachedFactory(contextClassLoader);</span>
-<span class="fc bfc" id="L774" title="All 2 branches covered.">        if 
(factory != null) {</span>
-<span class="fc" id="L775">            return factory;</span>
+<span class="fc" id="L737">        LogFactory factory = 
getCachedFactory(contextClassLoader);</span>
+<span class="fc bfc" id="L738" title="All 2 branches covered.">        if 
(factory != null) {</span>
+<span class="fc" id="L739">            return factory;</span>
         }
 
-<span class="pc bpc" id="L778" title="1 of 2 branches missed.">        if 
(isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L779">            logDiagnostic(</span>
+<span class="pc bpc" id="L742" title="1 of 2 branches missed.">        if 
(isDiagnosticsEnabled()) {</span>
+<span class="nc" id="L743">            logDiagnostic(</span>
                     &quot;[LOOKUP] LogFactory implementation requested for the 
first time for context class loader &quot; +
-<span class="nc" id="L781">                    
objectId(contextClassLoader));</span>
-<span class="nc" id="L782">            logHierarchy(&quot;[LOOKUP] &quot;, 
contextClassLoader);</span>
+<span class="nc" id="L745">                    
objectId(contextClassLoader));</span>
+<span class="nc" id="L746">            logHierarchy(&quot;[LOOKUP] &quot;, 
contextClassLoader);</span>
         }
 
         // Load properties file.
@@ -792,169 +756,132 @@ public abstract class LogFactory {
         // As the properties file (if it exists) will be used one way or
         // another in the end we may as well look for it first.
 
-<span class="fc" id="L795">        final Properties props = 
getConfigurationFile(contextClassLoader, FACTORY_PROPERTIES);</span>
+<span class="fc" id="L759">        final Properties props = 
getConfigurationFile(contextClassLoader, FACTORY_PROPERTIES);</span>
 
         // Determine whether we will be using the thread context class loader 
to
         // load logging classes or not by checking the loaded properties file 
(if any).
-<span class="fc" id="L799">        ClassLoader baseClassLoader = 
contextClassLoader;</span>
-<span class="fc bfc" id="L800" title="All 2 branches covered.">        if 
(props != null) {</span>
-<span class="fc" id="L801">            final String useTCCLStr = 
props.getProperty(TCCL_KEY);</span>
-            // The Boolean.valueOf(useTCCLStr).booleanValue() formulation
-            // is required for Java 1.2 compatibility.
-<span class="pc bpc" id="L804" title="1 of 4 branches missed.">            if 
(useTCCLStr != null &amp;&amp; !Boolean.parseBoolean(useTCCLStr)) {</span>
-                // Don't use current context class loader when locating any
-                // LogFactory or Log classes, just use the class that loaded
-                // this abstract class. When this class is deployed in a shared
-                // classpath of a container, it means webapps cannot deploy 
their
-                // own logging implementations. It also means that it is up to 
the
-                // implementation whether to load library-specific config files
-                // from the TCCL or not.
-<span class="fc" id="L812">                baseClassLoader = 
thisClassLoaderRef.get();</span>
-            }
+<span class="fc bfc" id="L763" title="All 2 branches covered.">        boolean 
useTccl = contextClassLoader != null;</span>
+<span class="fc bfc" id="L764" title="All 2 branches covered.">        if 
(props != null) {</span>
+<span class="fc" id="L765">            final String useTCCLStr = 
props.getProperty(TCCL_KEY);</span>
+<span class="pc bpc" id="L766" title="1 of 4 branches missed.">            
useTccl &amp;= useTCCLStr == null || Boolean.parseBoolean(useTCCLStr);</span>
+        }
+        // If TCCL is still enabled at this point, we check if it resolves 
this class
+<span class="fc bfc" id="L769" title="All 2 branches covered.">        if 
(useTccl) {</span>
+            try {
+<span class="pc bpc" id="L771" title="1 of 2 branches missed.">                
if (!LogFactory.class.equals(Class.forName(LogFactory.class.getName(), false, 
contextClassLoader))) {</span>
+<span class="nc" id="L772">                    logDiagnostic(() -&gt; 
&quot;The class &quot; + LogFactory.class.getName() + &quot; loaded by the 
context class loader &quot; + objectId(contextClassLoader)</span>
+                            + &quot; and this class differ. Disabling the 
usage of the context class loader.&quot;
+                            + &quot;Background can be found in 
https://commons.apache.org/logging/tech.html. &quot;);
+<span class="nc" id="L775">                    logHierarchy(&quot;[BAD CL 
TREE] &quot;, contextClassLoader);</span>
+<span class="nc" id="L776">                    useTccl = false;</span>
+                }
+<span class="fc" id="L778">            } catch (final ClassNotFoundException 
ignored) {</span>
+<span class="pc" id="L779">                logDiagnostic(() -&gt; &quot;The 
class &quot; + LogFactory.class.getName() + &quot; is not present in the the 
context class loader &quot;</span>
+<span class="nc" id="L780">                        + 
objectId(contextClassLoader) + &quot;. Disabling the usage of the context class 
loader.&quot;</span>
+                        + &quot;Background can be found in 
https://commons.apache.org/logging/tech.html. &quot;);
+<span class="fc" id="L782">                logHierarchy(&quot;[BAD CL TREE] 
&quot;, contextClassLoader);</span>
+<span class="fc" id="L783">                useTccl = false;</span>
+<span class="fc" id="L784">            }</span>
         }
+<span class="fc bfc" id="L786" title="All 2 branches covered.">        final 
ClassLoader baseClassLoader = useTccl ? contextClassLoader : 
thisClassLoaderRef.get();</span>
 
         // Determine which concrete LogFactory subclass to use.
         // First, try a global system property
-<span class="pc bpc" id="L818" title="1 of 2 branches missed.">        if 
(isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L819">            logDiagnostic(&quot;[LOOKUP] Looking 
for system property [&quot; + FACTORY_PROPERTY +</span>
-                          &quot;] to define the LogFactory subclass to 
use...&quot;);
-        }
+<span class="pc" id="L790">        logDiagnostic(() -&gt; &quot;[LOOKUP] 
Looking for system property [&quot; + FACTORY_PROPERTY +</span>
+                      &quot;] to define the LogFactory subclass to 
use...&quot;);
 
         try {
-<span class="fc" id="L824">            final String factoryClass = 
getSystemProperty(FACTORY_PROPERTY, null);</span>
-<span class="fc bfc" id="L825" title="All 2 branches covered.">            if 
(factoryClass != null) {</span>
-<span class="pc bpc" id="L826" title="1 of 2 branches missed.">                
if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L827">                    logDiagnostic(&quot;[LOOKUP] 
Creating an instance of LogFactory class '&quot; + factoryClass +</span>
-                                  &quot;' as specified by system property 
&quot; + FACTORY_PROPERTY);
-                }
-<span class="fc" id="L830">                factory = newFactory(factoryClass, 
baseClassLoader, contextClassLoader);</span>
-<span class="pc bpc" id="L831" title="1 of 2 branches missed.">            } 
else if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L832">                logDiagnostic(&quot;[LOOKUP] No 
system property [&quot; + FACTORY_PROPERTY + &quot;] defined.&quot;);</span>
-            }
-<span class="fc" id="L834">        } catch (final SecurityException e) {</span>
-<span class="pc bpc" id="L835" title="1 of 2 branches missed.">            if 
(isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L836">                logDiagnostic(&quot;[LOOKUP] A 
security exception occurred while trying to create an&quot; +</span>
-<span class="nc" id="L837">                              &quot; instance of 
the custom factory class&quot; + &quot;: [&quot; + trim(e.getMessage()) +</span>
-                              &quot;]. Trying alternative 
implementations...&quot;);
+<span class="fc" id="L794">            final String factoryClass = 
getSystemProperty(FACTORY_PROPERTY, null);</span>
+<span class="fc bfc" id="L795" title="All 2 branches covered.">            if 
(factoryClass != null) {</span>
+<span class="pc" id="L796">                logDiagnostic(() -&gt; 
&quot;[LOOKUP] Creating an instance of LogFactory class '&quot; + factoryClass 
+</span>
+                              &quot;' as specified by system property &quot; + 
FACTORY_PROPERTY);
+<span class="fc" id="L798">                factory = newFactory(factoryClass, 
baseClassLoader, contextClassLoader);</span>
+            } else {
+<span class="pc" id="L800">                logDiagnostic(() -&gt; 
&quot;[LOOKUP] No system property [&quot; + FACTORY_PROPERTY + &quot;] 
defined.&quot;);</span>
             }
+<span class="fc" id="L802">        } catch (final SecurityException e) {</span>
+<span class="pc" id="L803">            logDiagnostic(() -&gt; &quot;[LOOKUP] A 
security exception occurred while trying to create an instance of the custom 
factory class&quot; + &quot;: [&quot;</span>
+<span class="nc" id="L804">                    + trim(e.getMessage()) + 
&quot;]. Trying alternative implementations...&quot;);</span>
             // ignore
-<span class="nc" id="L841">        } catch (final RuntimeException e) {</span>
+<span class="nc" id="L806">        } catch (final RuntimeException e) {</span>
             // This is not consistent with the behavior when a bad LogFactory 
class is
             // specified in a services file.
             //
             // One possible exception that can occur here is a 
ClassCastException when
             // the specified class wasn't castable to this LogFactory type.
-<span class="nc bnc" id="L847" title="All 2 branches missed.">            if 
(isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L848">                logDiagnostic(&quot;[LOOKUP] An 
exception occurred while trying to create an&quot; +</span>
-                              &quot; instance of the custom factory 
class&quot; + &quot;: [&quot; +
-<span class="nc" id="L850">                              trim(e.getMessage()) 
+</span>
-                              &quot;] as specified by a system 
property.&quot;);
-            }
-<span class="nc" id="L853">            throw e;</span>
-<span class="fc" id="L854">        }</span>
-
+<span class="nc" id="L812">            logDiagnostic(() -&gt; &quot;[LOOKUP] 
An exception occurred while trying to create an instance of the custom factory 
class: [&quot; + trim(e.getMessage())</span>
+                    + &quot;] as specified by a system property.&quot;);
+<span class="nc" id="L814">            throw e;</span>
+<span class="fc" id="L815">        }</span>
+        //
         // Second, try to find a service by using the JDK 1.3 class
         // discovery mechanism, which involves putting a file with the name
         // of an interface class in the META-INF/services directory, where the
         // contents of the file is a single line specifying a concrete class
         // that implements the desired interface.
-
-<span class="fc bfc" id="L862" title="All 2 branches covered.">        if 
(factory == null) {</span>
-<span class="pc bpc" id="L863" title="1 of 2 branches missed.">            if 
(isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L864">                logDiagnostic(&quot;[LOOKUP] Using 
ServiceLoader  to define the LogFactory subclass to use...&quot;);</span>
-            }
+<span class="fc bfc" id="L822" title="All 2 branches covered.">        if 
(factory == null) {</span>
+<span class="fc" id="L823">            logDiagnostic(&quot;[LOOKUP] Using 
ServiceLoader  to define the LogFactory subclass to use...&quot;);</span>
             try {
-<span class="fc" id="L867">                final 
ServiceLoader&lt;LogFactory&gt; serviceLoader = 
ServiceLoader.load(LogFactory.class);</span>
-<span class="fc" id="L868">                final Iterator&lt;LogFactory&gt; 
iterator = serviceLoader.iterator();</span>
+<span class="fc" id="L825">                final 
ServiceLoader&lt;LogFactory&gt; serviceLoader = 
ServiceLoader.load(LogFactory.class, baseClassLoader);</span>
+<span class="fc" id="L826">                final Iterator&lt;LogFactory&gt; 
iterator = serviceLoader.iterator();</span>
 
-<span class="fc" id="L870">                int i = MAX_BROKEN_SERVICES;</span>
-<span class="fc bfc" id="L871" title="All 4 branches covered.">                
while (factory == null &amp;&amp; i-- &gt; 0) {</span>
+<span class="fc" id="L828">                int i = MAX_BROKEN_SERVICES;</span>
+<span class="fc bfc" id="L829" title="All 4 branches covered.">                
while (factory == null &amp;&amp; i-- &gt; 0) {</span>
                     try {
-<span class="fc bfc" id="L873" title="All 2 branches covered.">                
        if (iterator.hasNext()) {</span>
-<span class="fc" id="L874">                            factory = 
iterator.next();</span>
-                        }
-<span class="fc" id="L876">                    } catch (final 
ServiceConfigurationError | LinkageError ex) {</span>
-<span class="pc bpc" id="L877" title="1 of 2 branches missed.">                
        if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L878">                            
logDiagnostic(&quot;[LOOKUP] An exception occurred while trying to find 
an&quot; +</span>
-                                    &quot; instance of LogFactory&quot; +
-<span class="nc" id="L880">                                    &quot;: [&quot; 
+ trim(ex.getMessage()) +</span>
-                                    &quot;]. Trying alternative 
implementations...&quot;);
+<span class="fc bfc" id="L831" title="All 2 branches covered.">                
        if (iterator.hasNext()) {</span>
+<span class="fc" id="L832">                            factory = 
iterator.next();</span>
                         }
-<span class="fc" id="L883">                    }</span>
+<span class="fc" id="L834">                    } catch (final 
ServiceConfigurationError | LinkageError ex) {</span>
+<span class="pc" id="L835">                        logDiagnostic(() -&gt; 
&quot;[LOOKUP] An exception occurred while trying to find an instance of 
LogFactory: [&quot; + trim(ex.getMessage())</span>
+                                + &quot;]. Trying alternative 
implementations...&quot;);
+<span class="fc" id="L837">                    }</span>
                 }
-<span class="nc" id="L885">            } catch (final Exception ex) {</span>
+<span class="nc" id="L839">            } catch (final Exception ex) {</span>
                 // note: if the specified LogFactory class wasn't compatible 
with LogFactory
                 // for some reason, a ClassCastException will be caught here, 
and attempts will
                 // continue to find a compatible class.
-<span class="nc bnc" id="L889" title="All 2 branches missed.">                
if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L890">                    logDiagnostic(</span>
-                        &quot;[LOOKUP] A security exception occurred while 
trying to create an&quot; +
-                        &quot; instance of the custom factory class&quot; +
-<span class="nc" id="L893">                        &quot;: [&quot; + 
trim(ex.getMessage()) +</span>
-                        &quot;]. Trying alternative implementations...&quot;);
-                }
+<span class="nc" id="L843">                logDiagnostic(() -&gt; 
&quot;[LOOKUP] A security exception occurred while trying to create an instance 
of the custom factory class: [&quot;</span>
+<span class="nc" id="L844">                        + trim(ex.getMessage()) + 
&quot;]. Trying alternative implementations...&quot;);</span>
                 // ignore
-<span class="fc" id="L897">            }</span>
+<span class="fc" id="L846">            }</span>
         }
-
+        //
         // Third try looking into the properties file read earlier (if found)
-
-<span class="fc bfc" id="L902" title="All 2 branches covered.">        if 
(factory == null) {</span>
-<span class="fc bfc" id="L903" title="All 2 branches covered.">            if 
(props != null) {</span>
-<span class="pc bpc" id="L904" title="1 of 2 branches missed.">                
if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L905">                    logDiagnostic(</span>
-                        &quot;[LOOKUP] Looking in properties file for entry 
with key '&quot; + FACTORY_PROPERTY +
-                        &quot;' to define the LogFactory subclass to 
use...&quot;);
-                }
-<span class="fc" id="L909">                final String factoryClass = 
props.getProperty(FACTORY_PROPERTY);</span>
-<span class="fc bfc" id="L910" title="All 2 branches covered.">                
if (factoryClass != null) {</span>
-<span class="pc bpc" id="L911" title="1 of 2 branches missed.">                
    if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L912">                        logDiagnostic(</span>
-                            &quot;[LOOKUP] Properties file specifies 
LogFactory subclass '&quot; + factoryClass + &quot;'&quot;);
-                    }
-<span class="fc" id="L915">                    factory = 
newFactory(factoryClass, baseClassLoader, contextClassLoader);</span>
-
+<span class="fc bfc" id="L850" title="All 2 branches covered.">        if 
(factory == null) {</span>
+<span class="fc bfc" id="L851" title="All 2 branches covered.">            if 
(props != null) {</span>
+<span class="fc" id="L852">                logDiagnostic(() -&gt; </span>
+<span class="nc" id="L853">                    &quot;[LOOKUP] Looking in 
properties file for entry with key '&quot; + FACTORY_PROPERTY +</span>
+                    &quot;' to define the LogFactory subclass to use...&quot;);
+<span class="fc" id="L855">                final String factoryClass = 
props.getProperty(FACTORY_PROPERTY);</span>
+<span class="fc bfc" id="L856" title="All 2 branches covered.">                
if (factoryClass != null) {</span>
+<span class="fc" id="L857">                    logDiagnostic(() -&gt; </span>
+<span class="nc" id="L858">                        &quot;[LOOKUP] Properties 
file specifies LogFactory subclass '&quot; + factoryClass + 
&quot;'&quot;);</span>
+<span class="fc" id="L859">                    factory = 
newFactory(factoryClass, baseClassLoader, contextClassLoader);</span>
                     // TODO: think about whether we need to handle exceptions 
from newFactory
-<span class="pc bpc" id="L918" title="1 of 2 branches missed.">                
} else if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L919">                    logDiagnostic(&quot;[LOOKUP] 
Properties file has no entry specifying LogFactory subclass.&quot;);</span>
-                }
-<span class="pc bpc" id="L921" title="1 of 2 branches missed.">            } 
else if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L922">                logDiagnostic(&quot;[LOOKUP] No 
properties file available to determine&quot; + &quot; LogFactory subclass 
from..&quot;);</span>
-            }
-        }
-
-        // Fourth, try one of the 3 provided factories
-
-        try {
-            // We prefer Log4j API, since it does not stringify objects.
-<span class="fc bfc" id="L930" title="All 4 branches covered.">            if 
(factory == null &amp;&amp; isClassAvailable(LOG4J_API_LOGGER, 
baseClassLoader)) {</span>
-                // If the Log4j API is redirected to SLF4J, we use SLF4J 
directly.
-<span class="fc bfc" id="L932" title="All 2 branches covered.">                
if (isClassAvailable(LOG4J_TO_SLF4J_BRIDGE, baseClassLoader)) {</span>
-<span class="fc" id="L933">                    logDiagnostic(</span>
-                            &quot;[LOOKUP] Log4j API to SLF4J redirection 
detected. Loading the SLF4J LogFactory implementation '&quot; + FACTORY_SLF4J + 
&quot;'.&quot;);
-<span class="fc" id="L935">                    factory = 
newFactory(FACTORY_SLF4J, baseClassLoader, contextClassLoader);</span>
                 } else {
-<span class="fc" id="L937">                    logDiagnostic(&quot;[LOOKUP] 
Log4j API detected. Loading the Log4j API LogFactory implementation '&quot; + 
FACTORY_LOG4J_API + &quot;'.&quot;);</span>
-<span class="fc" id="L938">                    factory = 
newFactory(FACTORY_LOG4J_API, baseClassLoader, contextClassLoader);</span>
+<span class="fc" id="L862">                    logDiagnostic(&quot;[LOOKUP] 
Properties file has no entry specifying LogFactory subclass.&quot;);</span>
                 }
+<span class="fc" id="L864">            } else {</span>
+<span class="fc" id="L865">                logDiagnostic(&quot;[LOOKUP] No 
properties file available to determine LogFactory subclass from..&quot;);</span>
             }
-
-<span class="fc bfc" id="L942" title="All 4 branches covered.">            if 
(factory == null &amp;&amp; isClassAvailable(SLF4J_API_LOGGER, 
baseClassLoader)) {</span>
-<span class="fc" id="L943">                logDiagnostic(&quot;[LOOKUP] SLF4J 
detected. Loading the SLF4J LogFactory implementation '&quot; + FACTORY_SLF4J + 
&quot;'.&quot;);</span>
-<span class="fc" id="L944">                factory = newFactory(FACTORY_SLF4J, 
baseClassLoader, contextClassLoader);</span>
-            }
-<span class="fc" id="L946">        } catch (final Exception e) {</span>
-<span class="fc" id="L947">            logDiagnostic(&quot;[LOOKUP] An 
exception occurred while creating LogFactory: &quot; + e.getMessage());</span>
-<span class="fc" id="L948">        }</span>
-
-<span class="fc bfc" id="L950" title="All 2 branches covered.">        if 
(factory == null) {</span>
-<span class="pc bpc" id="L951" title="1 of 2 branches missed.">            if 
(isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L952">                logDiagnostic(</span>
-                    &quot;[LOOKUP] Loading the default LogFactory 
implementation '&quot; + FACTORY_DEFAULT +
-                    &quot;' via the same class loader that loaded this 
LogFactory&quot; +
-                    &quot; class (ie not looking in the context class 
loader).&quot;);
-            }
-
+        }
+        //
+        // Fourth, try one of the three provided factories first from the 
specified classloader
+        // and then from the current one.
+<span class="fc bfc" id="L871" title="All 2 branches covered.">        if 
(factory == null) {</span>
+<span class="fc" id="L872">            factory = 
newStandardFactory(baseClassLoader);</span>
+        }
+<span class="pc bpc" id="L874" title="3 of 4 branches missed.">        if 
(factory == null &amp;&amp; baseClassLoader != thisClassLoaderRef.get()) 
{</span>
+<span class="nc" id="L875">            factory = 
newStandardFactory(thisClassLoaderRef.get());</span>
+        }
+<span class="pc bpc" id="L877" title="1 of 2 branches missed.">        if 
(factory != null) {</span>
+<span class="pc bpc" id="L878" title="1 of 2 branches missed.">            if 
(isDiagnosticsEnabled()) {</span>
+<span class="nc" id="L879">                logDiagnostic(&quot;Created object 
&quot; + objectId(factory) + &quot; to manage class loader &quot; + 
objectId(contextClassLoader));</span>
+            }
+        } else {
+<span class="nc" id="L882">            logDiagnostic(() -&gt; </span>
+<span class="nc" id="L883">                &quot;[LOOKUP] Loading the default 
LogFactory implementation '&quot; + FACTORY_DEFAULT +</span>
+                &quot;' via the same class loader that loaded this LogFactory 
class (ie not looking in the context class loader).&quot;);
             // Note: unlike the above code which can try to load custom 
LogFactory
             // implementations via the TCCL, we don't try to load the default 
LogFactory
             // implementation via the context class loader because:
@@ -964,41 +891,38 @@ public abstract class LogFactory {
             // version of the LogFactoryImpl class and have it used dynamically
             // by an old LogFactory class in the parent, but that isn't
             // necessarily a good idea anyway.
-<span class="fc" id="L967">            factory = newFactory(FACTORY_DEFAULT, 
thisClassLoaderRef.get(), contextClassLoader);</span>
+<span class="nc" id="L894">            factory = newFactory(FACTORY_DEFAULT, 
thisClassLoaderRef.get(), contextClassLoader);</span>
         }
-
-<span class="pc bpc" id="L970" title="1 of 2 branches missed.">        if 
(factory != null) {</span>
+<span class="pc bpc" id="L896" title="1 of 2 branches missed.">        if 
(factory != null) {</span>
             /**
              * Always cache using context class loader.
              */
-<span class="fc" id="L974">            cacheFactory(contextClassLoader, 
factory);</span>
-
-<span class="fc bfc" id="L976" title="All 2 branches covered.">            if 
(props != null) {</span>
-<span class="fc" id="L977">                final Enumeration&lt;?&gt; names = 
props.propertyNames();</span>
-<span class="fc bfc" id="L978" title="All 2 branches covered.">                
while (names.hasMoreElements()) {</span>
-<span class="fc" id="L979">                    final String name = 
Objects.toString(names.nextElement(), null);</span>
-<span class="fc" id="L980">                    final String value = 
props.getProperty(name);</span>
-<span class="fc" id="L981">                    factory.setAttribute(name, 
value);</span>
-<span class="fc" id="L982">                }</span>
+<span class="fc" id="L900">            cacheFactory(contextClassLoader, 
factory);</span>
+<span class="fc bfc" id="L901" title="All 2 branches covered.">            if 
(props != null) {</span>
+<span class="fc" id="L902">                final Enumeration&lt;?&gt; names = 
props.propertyNames();</span>
+<span class="fc bfc" id="L903" title="All 2 branches covered.">                
while (names.hasMoreElements()) {</span>
+<span class="fc" id="L904">                    final String name = 
Objects.toString(names.nextElement(), null);</span>
+<span class="fc" id="L905">                    final String value = 
props.getProperty(name);</span>
+<span class="fc" id="L906">                    factory.setAttribute(name, 
value);</span>
+<span class="fc" id="L907">                }</span>
             }
         }
-
-<span class="fc" id="L986">        return factory;</span>
+<span class="fc" id="L910">        return factory;</span>
     }
 
     /**
-     * Convenience method to return a named logger, without the application 
having to care about factories.
+     * Gets a named logger, without the application having to care about 
factories.
      *
      * @param clazz Class from which a log name will be derived
      * @return a named logger.
      * @throws LogConfigurationException if a suitable {@code Log} instance 
cannot be returned
      */
     public static Log getLog(final Class&lt;?&gt; clazz) throws 
LogConfigurationException {
-<span class="fc" id="L997">        return 
getFactory().getInstance(clazz);</span>
+<span class="fc" id="L921">        return 
getFactory().getInstance(clazz);</span>
     }
 
     /**
-     * Convenience method to return a named logger, without the application 
having to care about factories.
+     * Gets a named logger, without the application having to care about 
factories.
      *
      * @param name Logical name of the {@code Log} instance to be returned 
(the meaning of this name is only known to the underlying logging 
implementation that
      *             is being wrapped)
@@ -1006,7 +930,7 @@ public abstract class LogFactory {
      * @throws LogConfigurationException if a suitable {@code Log} instance 
cannot be returned
      */
     public static Log getLog(final String name) throws 
LogConfigurationException {
-<span class="fc" id="L1009">        return 
getFactory().getInstance(name);</span>
+<span class="fc" id="L933">        return 
getFactory().getInstance(name);</span>
     }
 
     /**
@@ -1019,31 +943,27 @@ public abstract class LogFactory {
      * &lt;/p&gt;
      */
     private static Properties getProperties(final URL url) {
-<span class="fc" id="L1022">        return 
AccessController.doPrivileged((PrivilegedAction&lt;Properties&gt;) () -&gt; 
{</span>
+<span class="fc" id="L946">        return 
AccessController.doPrivileged((PrivilegedAction&lt;Properties&gt;) () -&gt; 
{</span>
             // We must ensure that useCaches is set to false, as the
             // default behavior of java is to cache file handles, and
             // this &quot;locks&quot; files, preventing hot-redeploy on 
windows.
             try {
-<span class="fc" id="L1027">                final URLConnection connection = 
url.openConnection();</span>
-<span class="fc" id="L1028">                
connection.setUseCaches(false);</span>
-<span class="fc" id="L1029">                try (InputStream stream = 
connection.getInputStream()) {</span>
-<span class="pc bpc" id="L1030" title="1 of 2 branches missed.">               
     if (stream != null) {</span>
-<span class="fc" id="L1031">                        final Properties props = 
new Properties();</span>
-<span class="fc" id="L1032">                        props.load(stream);</span>
-<span class="fc" id="L1033">                        return props;</span>
-                    }
-<span class="pc bpc" id="L1035" title="1 of 2 branches missed.">               
 } catch (final IOException e) {</span>
-<span class="nc bnc" id="L1036" title="All 2 branches missed.">                
    if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L1037">                        logDiagnostic(&quot;Unable 
to close stream for URL &quot; + url);</span>
+<span class="fc" id="L951">                final URLConnection connection = 
url.openConnection();</span>
+<span class="fc" id="L952">                
connection.setUseCaches(false);</span>
+<span class="fc" id="L953">                try (InputStream stream = 
connection.getInputStream()) {</span>
+<span class="pc bpc" id="L954" title="1 of 2 branches missed.">                
    if (stream != null) {</span>
+<span class="fc" id="L955">                        final Properties props = 
new Properties();</span>
+<span class="fc" id="L956">                        props.load(stream);</span>
+<span class="fc" id="L957">                        return props;</span>
                     }
-<span class="nc" id="L1039">                }</span>
-<span class="nc" id="L1040">            } catch (final IOException e) {</span>
-<span class="nc bnc" id="L1041" title="All 2 branches missed.">                
if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L1042">                    logDiagnostic(&quot;Unable to 
read URL &quot; + url);</span>
-                }
-<span class="nc" id="L1044">            }</span>
+<span class="pc bpc" id="L959" title="1 of 2 branches missed.">                
} catch (final IOException e) {</span>
+<span class="nc" id="L960">                    logDiagnostic(() -&gt; 
&quot;Unable to close stream for URL &quot; + url);</span>
+<span class="nc" id="L961">                }</span>
+<span class="nc" id="L962">            } catch (final IOException e) {</span>
+<span class="nc" id="L963">                logDiagnostic(() -&gt; &quot;Unable 
to read URL &quot; + url);</span>
+<span class="nc" id="L964">            }</span>
 
-<span class="nc" id="L1046">            return null;</span>
+<span class="nc" id="L966">            return null;</span>
         });
     }
 
@@ -1063,22 +983,20 @@ public abstract class LogFactory {
      * &lt;/p&gt;
      */
     private static Enumeration&lt;URL&gt; getResources(final ClassLoader 
loader, final String name) {
-<span class="fc" id="L1066">        return 
AccessController.doPrivileged((PrivilegedAction&lt;Enumeration&lt;URL&gt;&gt;) 
() -&gt; {</span>
+<span class="fc" id="L986">        return 
AccessController.doPrivileged((PrivilegedAction&lt;Enumeration&lt;URL&gt;&gt;) 
() -&gt; {</span>
             try {
-<span class="fc bfc" id="L1068" title="All 2 branches covered.">               
 if (loader != null) {</span>
-<span class="fc" id="L1069">                    return 
loader.getResources(name);</span>
-                }
-<span class="fc" id="L1071">                return 
ClassLoader.getSystemResources(name);</span>
-<span class="nc" id="L1072">            } catch (final IOException e) {</span>
-<span class="nc bnc" id="L1073" title="All 2 branches missed.">                
if (isDiagnosticsEnabled()) {</span>
-<span class="nc" id="L1074">                    logDiagnostic(&quot;Exception 
while trying to find configuration file &quot; + name + &quot;:&quot; + 
e.getMessage());</span>
+<span class="fc bfc" id="L988" title="All 2 branches covered.">                
if (loader != null) {</span>
+<span class="fc" id="L989">                    return 
loader.getResources(name);</span>
                 }
-<span class="nc" id="L1076">                return null;</span>
-<span class="nc" id="L1077">            } catch (final NoSuchMethodError e) 
{</span>
+<span class="fc" id="L991">                return 
ClassLoader.getSystemResources(name);</span>
+<span class="nc" id="L992">            } catch (final IOException e) {</span>
+<span class="nc" id="L993">                logDiagnostic(() -&gt; 
&quot;Exception while trying to find configuration file &quot; + name + 
&quot;:&quot; + e.getMessage());</span>
+<span class="nc" id="L994">                return null;</span>
+<span class="nc" id="L995">            } catch (final NoSuchMethodError e) 
{</span>
                 // we must be running on a 1.1 JVM which doesn't support
                 // ClassLoader.getSystemResources; just return null in
                 // this case.
-<span class="nc" id="L1081">                return null;</span>
+<span class="nc" id="L999">                return null;</span>
             }
         });
     }
@@ -1095,7 +1013,7 @@ public abstract class LogFactory {
      */
     private static String getSystemProperty(final String key, final String def)
             throws SecurityException {
-<span class="fc" id="L1098">        return 
AccessController.doPrivileged((PrivilegedAction&lt;String&gt;) () -&gt; 
System.getProperty(key, def));</span>
+<span class="fc" id="L1016">        return 
AccessController.doPrivileged((PrivilegedAction&lt;String&gt;) () -&gt; 
System.getProperty(key, def));</span>
     }
 
     /**
@@ -1111,14 +1029,14 @@ public abstract class LogFactory {
      * @param t the Throwable to check
      */
     protected static void handleThrowable(final Throwable t) {
-<span class="pc bpc" id="L1114" title="1 of 2 branches missed.">        if (t 
instanceof ThreadDeath) {</span>
-<span class="nc" id="L1115">            throw (ThreadDeath) t;</span>
+<span class="pc bpc" id="L1032" title="1 of 2 branches missed.">        if (t 
instanceof ThreadDeath) {</span>
+<span class="nc" id="L1033">            throw (ThreadDeath) t;</span>
         }
-<span class="pc bpc" id="L1117" title="1 of 2 branches missed.">        if (t 
instanceof VirtualMachineError) {</span>
-<span class="nc" id="L1118">            throw (VirtualMachineError) t;</span>
+<span class="pc bpc" id="L1035" title="1 of 2 branches missed.">        if (t 
instanceof VirtualMachineError) {</span>
+<span class="nc" id="L1036">            throw (VirtualMachineError) t;</span>
         }
         // All other instances of Throwable will be silently ignored
-<span class="fc" id="L1121">    }</span>
+<span class="fc" id="L1039">    }</span>
 
     /**
      * Determines whether the given class actually implements {@code 
LogFactory}.
@@ -1134,41 +1052,43 @@ public abstract class LogFactory {
      * &lt;/p&gt;
      */
     private static boolean implementsLogFactory(final Class&lt;?&gt; 
logFactoryClass) {
-<span class="nc" id="L1137">        boolean implementsLogFactory = 
false;</span>
-<span class="nc bnc" id="L1138" title="All 2 branches missed.">        if 
(logFactoryClass != null) {</span>
+<span class="nc" id="L1055">        boolean implementsLogFactory = 
false;</span>
+<span class="nc bnc" id="L1056" title="All 2 branches missed.">        if 
(logFactoryClass != null) {</span>
             try {
-<span class="nc" id="L1140">                final ClassLoader 
logFactoryClassLoader = logFactoryClass.getClassLoader();</span>
-<span class="nc bnc" id="L1141" title="All 2 branches missed.">                
if (logFactoryClassLoader == null) {</span>
-<span class="nc" id="L1142">                    logDiagnostic(&quot;[CUSTOM 
LOG FACTORY] was loaded by the boot class loader&quot;);</span>
+<span class="nc" id="L1058">                final ClassLoader 
logFactoryClassLoader = logFactoryClass.getClassLoader();</span>
+<span class="nc bnc" id="L1059" title="All 2 branches missed.">                
if (logFactoryClassLoader == null) {</span>
+<span class="nc" id="L1060">                    logDiagnostic(&quot;[CUSTOM 
LOG FACTORY] was loaded by the boot class loader&quot;);</span>
                 } else {
-<span class="nc" id="L1144">                    logHierarchy(&quot;[CUSTOM LOG 
FACTORY] &quot;, logFactoryClassLoader);</span>
-<span class="nc" id="L1145">                    final Class&lt;?&gt; 
factoryFromCustomLoader = 
Class.forName(&quot;org.apache.commons.logging.LogFactory&quot;, false, 
logFactoryClassLoader);</span>
-<span class="nc" id="L1146">                    implementsLogFactory = 
factoryFromCustomLoader.isAssignableFrom(logFactoryClass);</span>
-<span class="nc" id="L1147">                    final String 
logFactoryClassName = logFactoryClass.getName();</span>
-<span class="nc bnc" id="L1148" title="All 2 branches missed.">                
    if (implementsLogFactory) {</span>
-<span class="nc" id="L1149">                        
logDiagnostic(&quot;[CUSTOM LOG FACTORY] &quot; + logFactoryClassName + &quot; 
implements LogFactory but was loaded by an incompatible class 
loader.&quot;);</span>
+<span class="nc" id="L1062">                    logHierarchy(&quot;[CUSTOM LOG 
FACTORY] &quot;, logFactoryClassLoader);</span>
+<span class="nc" id="L1063">                    final Class&lt;?&gt; 
factoryFromCustomLoader = 
Class.forName(&quot;org.apache.commons.logging.LogFactory&quot;, false, 
logFactoryClassLoader);</span>
+<span class="nc" id="L1064">                    implementsLogFactory = 
factoryFromCustomLoader.isAssignableFrom(logFactoryClass);</span>
+<span class="nc" id="L1065">                    final String 
logFactoryClassName = logFactoryClass.getName();</span>
+<span class="nc bnc" id="L1066" title="All 2 branches missed.">                
    if (implementsLogFactory) {</span>
+<span class="nc" id="L1067">                        logDiagnostic(() -&gt; 
&quot;[CUSTOM LOG FACTORY] &quot; + logFactoryClassName + &quot; implements 
LogFactory but was loaded by an incompatible class loader.&quot;);</span>
                     } else {
-<span class="nc" id="L1151">                        
logDiagnostic(&quot;[CUSTOM LOG FACTORY] &quot; + logFactoryClassName + &quot; 
does not implement LogFactory.&quot;);</span>
+<span class="nc" id="L1069">                        logDiagnostic(() -&gt; 
&quot;[CUSTOM LOG FACTORY] &quot; + logFactoryClassName + &quot; does not 
implement LogFactory.&quot;);</span>
                     }
                 }
-<span class="nc" id="L1154">            } catch (final SecurityException e) 
{</span>
+<span class="nc" id="L1072">            } catch (final SecurityException e) 
{</span>
                 //
                 // The application is running within a hostile security 
environment.
                 // This will make it very hard to diagnose issues with JCL.
                 // Consider running less securely whilst debugging this issue.
                 //
-<span class="nc" id="L1160">                logDiagnostic(&quot;[CUSTOM LOG 
FACTORY] SecurityException caught trying to determine whether &quot;</span>
-<span class="nc" id="L1161">                        + &quot;the compatibility 
was caused by a class loader conflict: &quot; + e.getMessage());</span>
-<span class="nc" id="L1162">            } catch (final LinkageError e) {</span>
+<span class="nc" id="L1078">                logDiagnostic(</span>
+<span class="nc" id="L1079">                        () -&gt; &quot;[CUSTOM LOG 
FACTORY] SecurityException caught trying to determine whether the compatibility 
was caused by a class loader conflict: &quot;</span>
+<span class="nc" id="L1080">                                + 
e.getMessage());</span>
+<span class="nc" id="L1081">            } catch (final LinkageError e) {</span>
                 //
                 // This should be an unusual circumstance.
                 // LinkageError's usually indicate that a dependent class has 
incompatibly changed.
                 // Another possibility may be an exception thrown by an 
initializer.
                 // Time for a clean rebuild?
                 //
-<span class="nc" id="L1169">                logDiagnostic(&quot;[CUSTOM LOG 
FACTORY] LinkageError caught trying to determine whether &quot;</span>
-<span class="nc" id="L1170">                        + &quot;the compatibility 
was caused by a class loader conflict: &quot; + e.getMessage());</span>
-<span class="nc" id="L1171">            } catch (final ClassNotFoundException 
e) {</span>
+<span class="nc" id="L1088">                logDiagnostic(</span>
+<span class="nc" id="L1089">                        () -&gt; &quot;[CUSTOM LOG 
FACTORY] LinkageError caught trying to determine whether the compatibility was 
caused by a class loader conflict: &quot;</span>

[... 503 lines stripped ...]


Reply via email to