You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/06/24 11:33:15 UTC

(commons-logging) branch master updated (726ab53 -> 2dded17)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git


    from 726ab53  Use import instead of FQCN
     new 3e07b2f  Upper case internal constant
     new fcbf9af  Upper case internal constant
     new 5459010  Javadoc
     new 2dded17  Inline single use variables

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/commons/logging/impl/Log4JLogger.java   |  21 +-
 .../commons/logging/impl/LogFactoryImpl.java       | 308 +++++++--------------
 .../apache/commons/logging/impl/WeakHashtable.java |  46 ++-
 3 files changed, 130 insertions(+), 245 deletions(-)


(commons-logging) 04/04: Inline single use variables

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git

commit 2dded1722e5943f54e54b68d4815907eda46770a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 24 07:33:11 2025 -0400

    Inline single use variables
    
    Reduce vertical whitespace
---
 .../apache/commons/logging/impl/WeakHashtable.java | 46 ++++++++--------------
 1 file changed, 16 insertions(+), 30 deletions(-)

diff --git a/src/main/java/org/apache/commons/logging/impl/WeakHashtable.java b/src/main/java/org/apache/commons/logging/impl/WeakHashtable.java
index a0df2b8..17ddd4a 100644
--- a/src/main/java/org/apache/commons/logging/impl/WeakHashtable.java
+++ b/src/main/java/org/apache/commons/logging/impl/WeakHashtable.java
@@ -136,12 +136,8 @@ public final class WeakHashtable extends Hashtable {
             boolean result = false;
             if (o instanceof Map.Entry) {
                 final Map.Entry entry = (Map.Entry) o;
-                result =    (getKey()==null ?
-                                            entry.getKey() == null :
-                                            getKey().equals(entry.getKey())) &&
-                            (getValue()==null ?
-                                            entry.getValue() == null :
-                                            getValue().equals(entry.getValue()));
+                result = (getKey() == null ? entry.getKey() == null : getKey().equals(entry.getKey()))
+                        && (getValue() == null ? entry.getValue() == null : getValue().equals(entry.getValue()));
             }
             return result;
         }
@@ -158,8 +154,7 @@ public final class WeakHashtable extends Hashtable {
 
         @Override
         public int hashCode() {
-            return (getKey()==null ? 0 : getKey().hashCode()) ^
-                (getValue()==null ? 0 : getValue().hashCode());
+            return (getKey() == null ? 0 : getKey().hashCode()) ^ (getValue() == null ? 0 : getValue().hashCode());
         }
 
         @Override
@@ -172,7 +167,7 @@ public final class WeakHashtable extends Hashtable {
     private final static class Referenced {
 
         private final WeakReference reference;
-        private final int           hashCode;
+        private final int hashCode;
 
         /**
          *
@@ -182,7 +177,7 @@ public final class WeakHashtable extends Hashtable {
             reference = new WeakReference(referant);
             // Calc a permanent hashCode so calls to Hashtable.remove()
             // work if the WeakReference has been cleared
-            hashCode  = referant.hashCode();
+            hashCode = referant.hashCode();
         }
 
         /**
@@ -193,8 +188,7 @@ public final class WeakHashtable extends Hashtable {
             reference = new WeakKey(key, queue, this);
             // Calc a permanent hashCode so calls to Hashtable.remove()
             // work if the WeakReference has been cleared
-            hashCode  = key.hashCode();
-
+            hashCode = key.hashCode();
         }
 
         @Override
@@ -206,7 +200,6 @@ public final class WeakHashtable extends Hashtable {
                 final Object otherKeyValue = otherKey.getValue();
                 if (thisKeyValue == null) {
                     result = otherKeyValue == null;
-
                     // Since our hash code was calculated from the original
                     // non-null referant, the above check breaks the
                     // hash code/equals contract, as two cleared Referenced
@@ -218,9 +211,7 @@ public final class WeakHashtable extends Hashtable {
                     // and Hashtable does not do equality checks between
                     // existing keys, normal hash table operations should never
                     // result in an equals comparison between null referants
-                }
-                else
-                {
+                } else {
                     result = thisKeyValue.equals(otherKeyValue);
                 }
             }
@@ -246,9 +237,7 @@ public final class WeakHashtable extends Hashtable {
 
         private final Referenced referenced;
 
-        private WeakKey(final Object key,
-                        final ReferenceQueue queue,
-                        final Referenced referenced) {
+        private WeakKey(final Object key, final ReferenceQueue queue, final Referenced referenced) {
             super(key, queue);
             this.referenced = referenced;
         }
@@ -256,7 +245,7 @@ public final class WeakHashtable extends Hashtable {
         private Referenced getReferenced() {
             return referenced;
         }
-     }
+    }
 
     /** Serializable version identifier. */
     private static final long serialVersionUID = -1546036869799732453L;
@@ -271,7 +260,7 @@ public final class WeakHashtable extends Hashtable {
      * The maximum number of times put() or remove() can be called before
      * the map will be purged of one cleared entry.
      */
-    private static final int PARTIAL_PURGE_COUNT     = 10;
+    private static final int PARTIAL_PURGE_COUNT = 10;
 
     /** ReferenceQueue we check for GC'd keys. */
     private final transient ReferenceQueue queue = new ReferenceQueue();
@@ -283,7 +272,9 @@ public final class WeakHashtable extends Hashtable {
      * Constructs a WeakHashtable with the Hashtable default
      * capacity and load factor.
      */
-    public WeakHashtable() {}
+    public WeakHashtable() {
+        // empty
+    }
 
     /**
      *@see Hashtable
@@ -291,8 +282,7 @@ public final class WeakHashtable extends Hashtable {
     @Override
     public boolean containsKey(final Object key) {
         // purge should not be required
-        final Referenced referenced = new Referenced(key);
-        return super.containsKey(referenced);
+        return super.containsKey(new Referenced(key));
     }
 
     /**
@@ -331,8 +321,7 @@ public final class WeakHashtable extends Hashtable {
     @Override
     public Object get(final Object key) {
         // for performance reasons, no purge
-        final Referenced referenceKey = new Referenced(key);
-        return super.get(referenceKey);
+        return super.get(new Referenced(key));
     }
 
     /**
@@ -387,14 +376,13 @@ public final class WeakHashtable extends Hashtable {
      * have been garbage collected.
      */
     private void purge() {
-        final List toRemove = new ArrayList();
+        final List toRemove = new ArrayList<>();
         synchronized (queue) {
             WeakKey key;
             while ((key = (WeakKey) queue.poll()) != null) {
                 toRemove.add(key.getReferenced());
             }
         }
-
         // LOGGING-119: do the actual removal of the keys outside the sync block
         // to prevent deadlock scenarios as purge() may be called from
         // non-synchronized methods too
@@ -425,7 +413,6 @@ public final class WeakHashtable extends Hashtable {
         // check for nulls, ensuring semantics match superclass
         Objects.requireNonNull(key, "key");
         Objects.requireNonNull(value, "value");
-
         // for performance reasons, only purge every
         // MAX_CHANGES_BEFORE_PURGE times
         if (changeCount++ > MAX_CHANGES_BEFORE_PURGE) {
@@ -436,7 +423,6 @@ public final class WeakHashtable extends Hashtable {
         else if (changeCount % PARTIAL_PURGE_COUNT == 0) {
             purgeOne();
         }
-
         final Referenced keyRef = new Referenced(key, queue);
         return super.put(keyRef, value);
     }


(commons-logging) 02/04: Upper case internal constant

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git

commit fcbf9aff698858a7e2402248d1a902d239d221f7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 24 07:21:25 2025 -0400

    Upper case internal constant
    
    Reduce vertical whitespace
---
 .../commons/logging/impl/LogFactoryImpl.java       | 47 +++++++---------------
 1 file changed, 15 insertions(+), 32 deletions(-)

diff --git a/src/main/java/org/apache/commons/logging/impl/LogFactoryImpl.java b/src/main/java/org/apache/commons/logging/impl/LogFactoryImpl.java
index 0c87884..2137d22 100644
--- a/src/main/java/org/apache/commons/logging/impl/LogFactoryImpl.java
+++ b/src/main/java/org/apache/commons/logging/impl/LogFactoryImpl.java
@@ -147,7 +147,7 @@ public class LogFactoryImpl extends LogFactory {
      * other error indicates that the underlying logging library is available
      * but broken/unusable for some reason.
      */
-    private static final String[] classesToDiscover = {
+    private static final String[] DISCOVER_CLASSES = {
             LOGGING_IMPL_JDK14_LOGGER,
             LOGGING_IMPL_SIMPLE_LOGGER
     };
@@ -494,32 +494,23 @@ public class LogFactoryImpl extends LogFactory {
      * or if no adapter at all can be instantiated
      */
     private Log discoverLogImplementation(final String logCategory)
-        throws LogConfigurationException {
+            throws LogConfigurationException {
         if (isDiagnosticsEnabled()) {
             logDiagnostic("Discovering a Log implementation...");
         }
-
         initConfiguration();
-
         Log result = null;
-
         // See if the user specified the Log implementation to use
         final String specifiedLogClassName = findUserSpecifiedLogClassName();
-
         if (specifiedLogClassName != null) {
             if (isDiagnosticsEnabled()) {
-                logDiagnostic("Attempting to load user-specified log class '" +
-                    specifiedLogClassName + "'...");
+                logDiagnostic("Attempting to load user-specified log class '" + specifiedLogClassName + "'...");
             }
-
-            result = createLogFromClass(specifiedLogClassName,
-                                        logCategory,
-                                        true);
+            result = createLogFromClass(specifiedLogClassName, logCategory, true);
             if (result == null) {
-                final StringBuilder messageBuffer =  new StringBuilder("User-specified log class '");
+                final StringBuilder messageBuffer = new StringBuilder("User-specified log class '");
                 messageBuffer.append(specifiedLogClassName);
                 messageBuffer.append("' cannot be found or is not useable.");
-
                 // Mistyping or misspelling names is a common fault.
                 // Construct a good error message, if we can
                 informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_LOG4J_LOGGER);
@@ -528,23 +519,21 @@ public class LogFactoryImpl extends LogFactory {
                 informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_SIMPLE_LOGGER);
                 throw new LogConfigurationException(messageBuffer.toString());
             }
-
             return result;
         }
-
         // No user specified log; try to discover what's on the classpath
         //
         // Note that we deliberately loop here over classesToDiscover and
         // expect method createLogFromClass to loop over the possible source
         // class loaders. The effect is:
-        //   for each discoverable log adapter
-        //      for each possible class loader
-        //          see if it works
+        // for each discoverable log adapter
+        // for each possible class loader
+        // see if it works
         //
         // It appears reasonable at first glance to do the opposite:
-        //   for each possible class loader
-        //     for each discoverable log adapter
-        //        see if it works
+        // for each possible class loader
+        // for each discoverable log adapter
+        // see if it works
         //
         // The latter certainly has advantages for user-installable logging
         // libraries such as Log4j; in a webapp for example this code should
@@ -559,21 +548,15 @@ public class LogFactoryImpl extends LogFactory {
         // in a webapp should use a commons-logging.properties file or a
         // service file in META-INF to force use of that logging lib anyway,
         // rather than relying on discovery.
-
         if (isDiagnosticsEnabled()) {
-            logDiagnostic(
-                "No user-specified Log implementation; performing discovery" +
-                " using the standard supported logging implementations...");
+            logDiagnostic("No user-specified Log implementation; performing discovery" + " using the standard supported logging implementations...");
         }
-        for(int i=0; i<classesToDiscover.length && result == null; ++i) {
-            result = createLogFromClass(classesToDiscover[i], logCategory, true);
+        for (int i = 0; i < DISCOVER_CLASSES.length && result == null; ++i) {
+            result = createLogFromClass(DISCOVER_CLASSES[i], logCategory, true);
         }
-
         if (result == null) {
-            throw new LogConfigurationException
-                        ("No suitable Log implementation");
+            throw new LogConfigurationException("No suitable Log implementation");
         }
-
         return result;
     }
 


(commons-logging) 01/04: Upper case internal constant

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git

commit 3e07b2f982b778c5034f4cf00db16ab761194fbd
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 24 07:20:34 2025 -0400

    Upper case internal constant
---
 .../apache/commons/logging/impl/Log4JLogger.java    | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/apache/commons/logging/impl/Log4JLogger.java b/src/main/java/org/apache/commons/logging/impl/Log4JLogger.java
index 5b73dca..0779bed 100644
--- a/src/main/java/org/apache/commons/logging/impl/Log4JLogger.java
+++ b/src/main/java/org/apache/commons/logging/impl/Log4JLogger.java
@@ -52,7 +52,7 @@ public class Log4JLogger implements Log, Serializable {
     /** The fully qualified name of the Log4JLogger class. */
     private static final String FQCN = Log4JLogger.class.getName();
 
-    private static final Priority traceLevel;
+    private static final Priority TRACE_LEVEL;
 
     //
     // Note that this must come after the static variable declarations
@@ -69,19 +69,17 @@ public class Log4JLogger implements Log, Serializable {
             // nope, this is Log4j 1.3, so force an ExceptionInInitializerError
             throw new InstantiationError("Log4J 1.2 not available");
         }
-
         // Releases of Log4j 1.2 >= 1.2.12 have Priority.TRACE available, earlier
         // versions do not. If TRACE is not available, then we have to map
         // calls to Log.trace(...) onto the DEBUG level.
-
-        Priority _traceLevel;
+        Priority traceLevel;
         try {
-            _traceLevel = (Priority) Level.class.getDeclaredField("TRACE").get(null);
+            traceLevel = (Priority) Level.class.getDeclaredField("TRACE").get(null);
         } catch (final Exception ex) {
             // ok, trace not available
-            _traceLevel = Level.DEBUG;
+            traceLevel = Level.DEBUG;
         }
-        traceLevel = _traceLevel;
+        TRACE_LEVEL = traceLevel;
     }
 
     /** Log to this logger */
@@ -104,8 +102,7 @@ public class Log4JLogger implements Log, Serializable {
      */
     public Log4JLogger(final Logger logger) {
         if (logger == null) {
-            throw new IllegalArgumentException(
-                "Warning - null logger in constructor; possible Log4j misconfiguration.");
+            throw new IllegalArgumentException("Warning - null logger in constructor; possible Log4j misconfiguration.");
         }
         this.name = logger.getName();
         this.logger = logger;
@@ -270,7 +267,7 @@ public class Log4JLogger implements Log, Serializable {
      */
     @Override
     public boolean isTraceEnabled() {
-        return getLogger().isEnabledFor(traceLevel);
+        return getLogger().isEnabledFor(TRACE_LEVEL);
     }
 
     /**
@@ -291,7 +288,7 @@ public class Log4JLogger implements Log, Serializable {
      */
     @Override
     public void trace(final Object message) {
-        getLogger().log(FQCN, traceLevel, message, null);
+        getLogger().log(FQCN, TRACE_LEVEL, message, null);
     }
 
     /**
@@ -305,7 +302,7 @@ public class Log4JLogger implements Log, Serializable {
      */
     @Override
     public void trace(final Object message, final Throwable t) {
-        getLogger().log(FQCN, traceLevel, message, t);
+        getLogger().log(FQCN, TRACE_LEVEL, message, t);
     }
 
     /**


(commons-logging) 03/04: Javadoc

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git

commit 545901047fdce106c94bc360005445a656bbae3e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 24 07:28:41 2025 -0400

    Javadoc
    
    Reduce vertical whitespace
---
 .../commons/logging/impl/LogFactoryImpl.java       | 261 +++++++--------------
 1 file changed, 90 insertions(+), 171 deletions(-)

diff --git a/src/main/java/org/apache/commons/logging/impl/LogFactoryImpl.java b/src/main/java/org/apache/commons/logging/impl/LogFactoryImpl.java
index 2137d22..076d989 100644
--- a/src/main/java/org/apache/commons/logging/impl/LogFactoryImpl.java
+++ b/src/main/java/org/apache/commons/logging/impl/LogFactoryImpl.java
@@ -54,25 +54,29 @@ import org.apache.commons.logging.LogFactory;
  * parameter, this method will be called on each newly created instance
  * to identify the associated factory.  This makes factory configuration
  * attributes available to the Log instance, if it so desires.
+ * </p>
  * <p>
  * This factory will remember previously created {@code Log} instances
  * for the same name, and will return them on repeated requests to the
  * {@code getInstance()} method.
+ * </p>
  */
 public class LogFactoryImpl extends LogFactory {
 
     /** Log4JLogger class name */
     private static final String LOGGING_IMPL_LOG4J_LOGGER = "org.apache.commons.logging.impl.Log4JLogger";
+
     /** Jdk14Logger class name */
     private static final String LOGGING_IMPL_JDK14_LOGGER = "org.apache.commons.logging.impl.Jdk14Logger";
+
     /** Jdk13LumberjackLogger class name */
-    private static final String LOGGING_IMPL_LUMBERJACK_LOGGER =
-            "org.apache.commons.logging.impl.Jdk13LumberjackLogger";
+    private static final String LOGGING_IMPL_LUMBERJACK_LOGGER = "org.apache.commons.logging.impl.Jdk13LumberjackLogger";
 
     /** SimpleLog class name */
     private static final String LOGGING_IMPL_SIMPLE_LOGGER = "org.apache.commons.logging.impl.SimpleLog";
 
     private static final String PKG_IMPL="org.apache.commons.logging.impl.";
+
     private static final int PKG_LEN = PKG_IMPL.length();
 
     /**
@@ -99,10 +103,12 @@ public class LogFactoryImpl extends LogFactory {
      * When set to false, a LogConfigurationException is thrown if
      * LogFactoryImpl is loaded via a child class loader of the TCCL (this
      * should never happen in sane systems).
-     *
+     * <p>
      * Default behavior: true (tolerates bad context class loaders)
-     *
+     * </p>
+     * <p>
      * See also method setAttribute.
+     * </p>
      */
     public static final String ALLOW_FLAWED_CONTEXT_PROPERTY =
         "org.apache.commons.logging.Log.allowFlawedContext";
@@ -117,8 +123,10 @@ public class LogFactoryImpl extends LogFactory {
      * with a different logging implementation than they expected).
      * <p>
      * Default behavior: true (tolerates bad logging adapters)
-     *
+     * </p>
+     * <p>
      * See also method setAttribute.
+     * </p>
      */
     public static final String ALLOW_FLAWED_DISCOVERY_PROPERTY =
         "org.apache.commons.logging.Log.allowFlawedDiscovery";
@@ -133,8 +141,10 @@ public class LogFactoryImpl extends LogFactory {
      * might end up with a different logging implementation than they expected).
      * <p>
      * Default behavior: true (tolerates bad Log class hierarchy)
-     *
+     * </p>
+     * <p>
      * See also method setAttribute.
+     * </p>
      */
     public static final String ALLOW_FLAWED_HIERARCHY_PROPERTY =
         "org.apache.commons.logging.Log.allowFlawedHierarchy";
@@ -205,6 +215,7 @@ public class LogFactoryImpl extends LogFactory {
      * Take care not to expose the value returned by this method to the
      * calling application in any way; otherwise the calling app can use that
      * info to access data that should not be available to it.
+     * </p>
      */
     private static String getSystemProperty(final String key, final String def)
             throws SecurityException {
@@ -320,23 +331,16 @@ public class LogFactoryImpl extends LogFactory {
      *  configuration and the handleFlawedDiscovery method decided this
      *  problem was fatal.
      */
-    private Log createLogFromClass(final String logAdapterClassName,
-                                   final String logCategory,
-                                   final boolean affectState)
-        throws LogConfigurationException {
-
+    private Log createLogFromClass(final String logAdapterClassName, final String logCategory, final boolean affectState) throws LogConfigurationException {
         if (isDiagnosticsEnabled()) {
             logDiagnostic("Attempting to instantiate '" + logAdapterClassName + "'");
         }
-
         final Object[] params = { logCategory };
         Log logAdapter = null;
         Constructor<?> constructor = null;
-
         Class<?> logAdapterClass = null;
         ClassLoader currentCL = getBaseClassLoader();
-
-        for(;;) {
+        for (;;) {
             // Loop through the class loader hierarchy trying to find
             // a viable class loader.
             logDiagnostic("Trying to load '" + logAdapterClassName + "' from class loader " + objectId(currentCL));
@@ -349,18 +353,16 @@ public class LogFactoryImpl extends LogFactory {
                     URL url;
                     final String resourceName = logAdapterClassName.replace('.', '/') + ".class";
                     if (currentCL != null) {
-                        url = currentCL.getResource(resourceName );
+                        url = currentCL.getResource(resourceName);
                     } else {
                         url = ClassLoader.getSystemResource(resourceName + ".class");
                     }
-
                     if (url == null) {
                         logDiagnostic("Class '" + logAdapterClassName + "' [" + resourceName + "] cannot be found.");
                     } else {
                         logDiagnostic("Class '" + logAdapterClassName + "' was found at '" + url + "'");
                     }
                 }
-
                 Class<?> clazz;
                 try {
                     clazz = Class.forName(logAdapterClassName, true, currentCL);
@@ -369,8 +371,7 @@ public class LogFactoryImpl extends LogFactory {
                     // in this or any ancestor class loader. There's no point in
                     // trying higher up in the hierarchy in this case.
                     String msg = originalClassNotFoundException.getMessage();
-                    logDiagnostic("The log adapter '" + logAdapterClassName + "' is not available via class loader " +
-                                  objectId(currentCL) + ": " + trim(msg));
+                    logDiagnostic("The log adapter '" + logAdapterClassName + "' is not available via class loader " + objectId(currentCL) + ": " + trim(msg));
                     try {
                         // Try the class class loader.
                         // This may work in cases where the TCCL
@@ -383,15 +384,12 @@ public class LogFactoryImpl extends LogFactory {
                     } catch (final ClassNotFoundException secondaryClassNotFoundException) {
                         // no point continuing: this adapter isn't available
                         msg = secondaryClassNotFoundException.getMessage();
-                        logDiagnostic("The log adapter '" + logAdapterClassName +
-                                      "' is not available via the LogFactoryImpl class class loader: " + trim(msg));
+                        logDiagnostic("The log adapter '" + logAdapterClassName + "' is not available via the LogFactoryImpl class class loader: " + trim(msg));
                         break;
                     }
                 }
-
                 constructor = clazz.getConstructor(logConstructorSignature);
                 final Object o = constructor.newInstance(params);
-
                 // Note that we do this test after trying to create an instance
                 // [rather than testing Log.class.isAssignableFrom(c)] so that
                 // we don't complain about Log hierarchy problems when the
@@ -401,7 +399,6 @@ public class LogFactoryImpl extends LogFactory {
                     logAdapter = (Log) o;
                     break;
                 }
-
                 // Oops, we have a potential problem here. An adapter class
                 // has been found and its underlying lib is present too, but
                 // there are multiple Log interface classes available making it
@@ -420,9 +417,8 @@ public class LogFactoryImpl extends LogFactory {
                 // ancestor class loader. There's no point in trying higher up
                 // in the hierarchy in this case.
                 final String msg = e.getMessage();
-                logDiagnostic("The log adapter '" + logAdapterClassName +
-                              "' is missing dependencies when loaded via class loader " + objectId(currentCL) +
-                              ": " + trim(msg));
+                logDiagnostic("The log adapter '" + logAdapterClassName + "' is missing dependencies when loaded via class loader " + objectId(currentCL) +
+                        ": " + trim(msg));
                 break;
             } catch (final ExceptionInInitializerError e) {
                 // A static initializer block or the initializer code associated
@@ -432,9 +428,8 @@ public class LogFactoryImpl extends LogFactory {
                 // We treat this as meaning the adapter's underlying logging
                 // library could not be found.
                 final String msg = e.getMessage();
-                logDiagnostic("The log adapter '" + logAdapterClassName +
-                              "' is unable to initialize itself when loaded via class loader " + objectId(currentCL) +
-                              ": " + trim(msg));
+                logDiagnostic("The log adapter '" + logAdapterClassName + "' is unable to initialize itself when loaded via class loader " +
+                        objectId(currentCL) + ": " + trim(msg));
                 break;
             } catch (final LogConfigurationException e) {
                 // call to handleFlawedHierarchy above must have thrown
@@ -447,21 +442,17 @@ public class LogFactoryImpl extends LogFactory {
                 // will be thrown.
                 handleFlawedDiscovery(logAdapterClassName, t);
             }
-
             if (currentCL == null) {
                 break;
             }
-
             // try the parent class loader
             // currentCL = currentCL.getParent();
             currentCL = getParentClassLoader(currentCL);
         }
-
         if (logAdapterClass != null && affectState) {
             // We've succeeded, so set instance fields
-            this.logClassName   = logAdapterClassName;
+            this.logClassName = logAdapterClassName;
             this.logConstructor = constructor;
-
             // Identify the {@code setLogFactory} method (if there is one)
             try {
                 this.logMethod = logAdapterClass.getMethod("setLogFactory", logMethodSignature);
@@ -469,14 +460,12 @@ public class LogFactoryImpl extends LogFactory {
             } catch (final Throwable t) {
                 handleThrowable(t); // may re-throw t
                 this.logMethod = null;
-                logDiagnostic("[INFO] '" + logAdapterClassName + "' from class loader " + objectId(currentCL) +
-                              " does not declare optional method " + "setLogFactory(LogFactory)");
+                logDiagnostic("[INFO] '" + logAdapterClassName + "' from class loader " + objectId(currentCL) + " does not declare optional method " +
+                        "setLogFactory(LogFactory)");
             }
-
-            logDiagnostic("Log adapter '" + logAdapterClassName + "' from class loader " +
-                          objectId(logAdapterClass.getClassLoader()) + " has been selected for use.");
+            logDiagnostic("Log adapter '" + logAdapterClassName + "' from class loader " + objectId(logAdapterClass.getClassLoader()) +
+                    " has been selected for use.");
         }
-
         return logAdapter;
     }
 
@@ -572,52 +561,42 @@ public class LogFactoryImpl extends LogFactory {
             logDiagnostic("Trying to get log class from attribute '" + LOG_PROPERTY + "'");
         }
         String specifiedClass = (String) getAttribute(LOG_PROPERTY);
-
         if (specifiedClass == null) { // @deprecated
             if (isDiagnosticsEnabled()) {
-                logDiagnostic("Trying to get log class from attribute '" +
-                              LOG_PROPERTY_OLD + "'");
+                logDiagnostic("Trying to get log class from attribute '" + LOG_PROPERTY_OLD + "'");
             }
             specifiedClass = (String) getAttribute(LOG_PROPERTY_OLD);
         }
-
         if (specifiedClass == null) {
             if (isDiagnosticsEnabled()) {
-                logDiagnostic("Trying to get log class from system property '" +
-                          LOG_PROPERTY + "'");
+                logDiagnostic("Trying to get log class from system property '" + LOG_PROPERTY + "'");
             }
             try {
                 specifiedClass = getSystemProperty(LOG_PROPERTY, null);
             } catch (final SecurityException e) {
                 if (isDiagnosticsEnabled()) {
-                    logDiagnostic("No access allowed to system property '" +
-                        LOG_PROPERTY + "' - " + e.getMessage());
+                    logDiagnostic("No access allowed to system property '" + LOG_PROPERTY + "' - " + e.getMessage());
                 }
             }
         }
-
         if (specifiedClass == null) { // @deprecated
             if (isDiagnosticsEnabled()) {
-                logDiagnostic("Trying to get log class from system property '" +
-                          LOG_PROPERTY_OLD + "'");
+                logDiagnostic("Trying to get log class from system property '" + LOG_PROPERTY_OLD + "'");
             }
             try {
                 specifiedClass = getSystemProperty(LOG_PROPERTY_OLD, null);
             } catch (final SecurityException e) {
                 if (isDiagnosticsEnabled()) {
-                    logDiagnostic("No access allowed to system property '" +
-                        LOG_PROPERTY_OLD + "' - " + e.getMessage());
+                    logDiagnostic("No access allowed to system property '" + LOG_PROPERTY_OLD + "' - " + e.getMessage());
                 }
             }
         }
-
         // Remove any whitespace; it's never valid in a class name so its
         // presence just means a user mistake. As we know what they meant,
         // we may as well strip the spaces.
         if (specifiedClass != null) {
             specifiedClass = specifiedClass.trim();
         }
-
         return specifiedClass;
     }
 
@@ -651,6 +630,7 @@ public class LogFactoryImpl extends LogFactory {
      * of the context class loader <em>and</em> the allowFlawedContext option
      * has been set then the class loader which loaded this class is returned
      * instead.
+     * </p>
      * <p>
      * The only time when the class loader which loaded this class is a
      * descendant (rather than the same as or an ancestor of the context
@@ -658,40 +638,33 @@ public class LogFactoryImpl extends LogFactory {
      * failed to correctly set the context class loader. This is a bug in
      * the calling application; however we provide the option for JCL to
      * simply generate a warning rather than fail outright.
+     * </p>
      */
     private ClassLoader getBaseClassLoader() throws LogConfigurationException {
         final ClassLoader thisClassLoader = getClassLoader(LogFactoryImpl.class);
-
         if (!useTCCL) {
             return thisClassLoader;
         }
-
         final ClassLoader contextClassLoader = getContextClassLoaderInternal();
-
-        final ClassLoader baseClassLoader = getLowestClassLoader(
-                contextClassLoader, thisClassLoader);
-
+        final ClassLoader baseClassLoader = getLowestClassLoader(contextClassLoader, thisClassLoader);
         if (baseClassLoader == null) {
-           // The two class loaders are not part of a parent child relationship.
-           // In some classloading setups (e.g. JBoss with its
-           // UnifiedLoaderRepository) this can still work, so if user hasn't
-           // forbidden it, just return the contextClassLoader.
-           if (!allowFlawedContext) {
-            throw new LogConfigurationException("Bad class loader hierarchy; LogFactoryImpl was loaded via" +
-                                                " a class loader that is not related to the current context" +
-                                                " class loader.");
-           }
-        if (isDiagnosticsEnabled()) {
-               logDiagnostic("[WARNING] the context class loader is not part of a" +
-                             " parent-child relationship with the class loader that" +
-                             " loaded LogFactoryImpl.");
-          }
-          // If contextClassLoader were null, getLowestClassLoader() would
-          // have returned thisClassLoader.  The fact we are here means
-          // contextClassLoader is not null, so we can just return it.
-          return contextClassLoader;
+            // The two class loaders are not part of a parent child relationship.
+            // In some classloading setups (e.g. JBoss with its
+            // UnifiedLoaderRepository) this can still work, so if user hasn't
+            // forbidden it, just return the contextClassLoader.
+            if (!allowFlawedContext) {
+                throw new LogConfigurationException("Bad class loader hierarchy; LogFactoryImpl was loaded via" +
+                        " a class loader that is not related to the current context class loader.");
+            }
+            if (isDiagnosticsEnabled()) {
+                logDiagnostic(
+                        "[WARNING] the context class loader is not part of a parent-child relationship with the class loader that loaded LogFactoryImpl.");
+            }
+            // If contextClassLoader were null, getLowestClassLoader() would
+            // have returned thisClassLoader. The fact we are here means
+            // contextClassLoader is not null, so we can just return it.
+            return contextClassLoader;
         }
-
         if (baseClassLoader != contextClassLoader) {
             // We really should just use the contextClassLoader as the starting
             // point for scanning for log adapter classes. However it is expected
@@ -699,21 +672,14 @@ public class LogFactoryImpl extends LogFactory {
             // custom class loaders but fail to set the context class loader so
             // we handle those flawed systems anyway.
             if (!allowFlawedContext) {
-                throw new LogConfigurationException(
-                        "Bad class loader hierarchy; LogFactoryImpl was loaded via" +
-                        " a class loader that is not related to the current context" +
-                        " class loader.");
+                throw new LogConfigurationException("Bad class loader hierarchy; LogFactoryImpl was loaded via" +
+                        " a class loader that is not related to the current context class loader.");
             }
             if (isDiagnosticsEnabled()) {
-                logDiagnostic(
-                        "Warning: the context class loader is an ancestor of the" +
-                        " class loader that loaded LogFactoryImpl; it should be" +
-                        " the same or a descendant. The application using" +
-                        " commons-logging should ensure the context class loader" +
-                        " is used correctly.");
+                logDiagnostic("Warning: the context class loader is an ancestor of the class loader that loaded LogFactoryImpl; it should be" +
+                        " the same or a descendant. The application using commons-logging should ensure the context class loader is used correctly.");
             }
         }
-
         return baseClassLoader;
     }
 
@@ -737,6 +703,7 @@ public class LogFactoryImpl extends LogFactory {
      * system properties in case someone has explicitly called setAttribute,
      * or a configuration property has been set in a commons-logging.properties
      * file.
+     * </p>
      *
      * @return the value associated with the property, or null.
      */
@@ -744,19 +711,16 @@ public class LogFactoryImpl extends LogFactory {
         if (isDiagnosticsEnabled()) {
             logDiagnostic("[ENV] Trying to get configuration for item " + property);
         }
-
-        final Object valueObj =  getAttribute(property);
+        final Object valueObj = getAttribute(property);
         if (valueObj != null) {
             if (isDiagnosticsEnabled()) {
                 logDiagnostic("[ENV] Found LogFactory attribute [" + valueObj + "] for " + property);
             }
             return valueObj.toString();
         }
-
         if (isDiagnosticsEnabled()) {
             logDiagnostic("[ENV] No LogFactory attribute found for " + property);
         }
-
         try {
             // warning: minor security hole here, in that we potentially read a system
             // property that the caller cannot, then output it in readable form as a
@@ -769,7 +733,6 @@ public class LogFactoryImpl extends LogFactory {
                 }
                 return value;
             }
-
             if (isDiagnosticsEnabled()) {
                 logDiagnostic("[ENV] No system property found for property " + property);
             }
@@ -778,11 +741,9 @@ public class LogFactoryImpl extends LogFactory {
                 logDiagnostic("[ENV] Security prevented reading system property " + property);
             }
         }
-
         if (isDiagnosticsEnabled()) {
             logDiagnostic("[ENV] No configuration defined for item " + property);
         }
-
         return null;
     }
 
@@ -800,8 +761,8 @@ public class LogFactoryImpl extends LogFactory {
     }
 
     /**
-     * <p>Construct (if necessary) and return a {@code Log} instance,
-     * using the factory's current set of configuration attributes.</p>
+     * Construct (if necessary) and return a {@code Log} instance,
+     * using the factory's current set of configuration attributes.
      *
      * <p><strong>NOTE</strong> - Depending upon the implementation of
      * the {@code LogFactory} you are using, the {@code Log}
@@ -832,15 +793,11 @@ public class LogFactoryImpl extends LogFactory {
         if (logClassName == null) {
             discoverLogImplementation(getClass().getName());
         }
-
         return logClassName;
     }
 
     /**
-     * <p>
      * Gets the {@code Constructor} that can be called to instantiate new {@link org.apache.commons.logging.Log} instances.
-     * </p>
-     *
      * <p>
      * <strong>IMPLEMENTATION NOTE</strong> - Race conditions caused by calling this method from more than one thread are ignored, because the same
      * {@code Constructor} instance will ultimately be derived in all circumstances.
@@ -851,17 +808,13 @@ public class LogFactoryImpl extends LogFactory {
      * @deprecated Never invoked by this class; subclasses should not assume it will be.
      */
     @Deprecated
-    protected Constructor<?> getLogConstructor()
-        throws LogConfigurationException {
-
+    protected Constructor<?> getLogConstructor() throws LogConfigurationException {
         // Return the previously identified Constructor (if any)
         if (logConstructor == null) {
             discoverLogImplementation(getClass().getName());
         }
-
         return logConstructor;
     }
-
     //  ------------------------------------------------------ Private Methods
 
     /**
@@ -875,17 +828,13 @@ public class LogFactoryImpl extends LogFactory {
      */
     private ClassLoader getLowestClassLoader(final ClassLoader c1, final ClassLoader c2) {
         // TODO: use AccessController when dealing with class loaders here
-
         if (c1 == null) {
             return c2;
         }
-
         if (c2 == null) {
             return c1;
         }
-
         ClassLoader current;
-
         // scan c1's ancestors to find c2
         current = c1;
         while (current != null) {
@@ -895,7 +844,6 @@ public class LogFactoryImpl extends LogFactory {
             // current = current.getParent();
             current = getParentClassLoader(current);
         }
-
         // scan c2's ancestors to find c1
         current = c2;
         while (current != null) {
@@ -905,7 +853,6 @@ public class LogFactoryImpl extends LogFactory {
             // current = current.getParent();
             current = getParentClassLoader(current);
         }
-
         return null;
     }
 
@@ -913,8 +860,10 @@ public class LogFactoryImpl extends LogFactory {
      * Fetch the parent class loader of a specified class loader.
      * <p>
      * If a SecurityException occurs, null is returned.
+     * </p>
      * <p>
      * Note that this method is non-static merely so logDiagnostic is available.
+     * </p>
      */
     private ClassLoader getParentClassLoader(final ClassLoader cl) {
         try {
@@ -923,7 +872,6 @@ public class LogFactoryImpl extends LogFactory {
             logDiagnostic("[SECURITY] Unable to obtain parent class loader");
             return null;
         }
-
     }
 
     /**
@@ -936,26 +884,18 @@ public class LogFactoryImpl extends LogFactory {
      * @param discoveryFlaw is the Throwable created by the class loader
      * @throws LogConfigurationException    ALWAYS
      */
-    private void handleFlawedDiscovery(final String logAdapterClassName,
-                                       final Throwable discoveryFlaw) {
-
+    private void handleFlawedDiscovery(final String logAdapterClassName, final Throwable discoveryFlaw) {
         if (isDiagnosticsEnabled()) {
-            logDiagnostic("Could not instantiate Log '" +
-                      logAdapterClassName + "' -- " +
-                      discoveryFlaw.getClass().getName() + ": " +
-                      discoveryFlaw.getLocalizedMessage());
-
-            if (discoveryFlaw instanceof InvocationTargetException ) {
+            logDiagnostic("Could not instantiate Log '" + logAdapterClassName + "' -- " + discoveryFlaw.getClass().getName() + ": " +
+                    discoveryFlaw.getLocalizedMessage());
+            if (discoveryFlaw instanceof InvocationTargetException) {
                 // Ok, the lib is there but while trying to create a real underlying
                 // logger something failed in the underlying lib; display info about
                 // that if possible.
                 final InvocationTargetException ite = (InvocationTargetException) discoveryFlaw;
                 final Throwable cause = ite.getTargetException();
                 if (cause != null) {
-                    logDiagnostic("... InvocationTargetException: " +
-                        cause.getClass().getName() + ": " +
-                        cause.getLocalizedMessage());
-
+                    logDiagnostic("... InvocationTargetException: " + cause.getClass().getName() + ": " + cause.getLocalizedMessage());
                     if (cause instanceof ExceptionInInitializerError) {
                         final ExceptionInInitializerError eiie = (ExceptionInInitializerError) cause;
                         final Throwable cause2 = eiie.getCause();
@@ -968,7 +908,6 @@ public class LogFactoryImpl extends LogFactory {
                 }
             }
         }
-
         if (!allowFlawedDiscovery) {
             throw new LogConfigurationException(discoveryFlaw);
         }
@@ -981,6 +920,7 @@ public class LogFactoryImpl extends LogFactory {
      * <p>
      * There are two possible reasons why we successfully loaded the
      * specified log adapter class then failed to cast it to a Log object:
+     * </p>
      * <ol>
      * <li>the specific class just doesn't implement the Log interface
      *     (user screwed up), or
@@ -990,6 +930,7 @@ public class LogFactoryImpl extends LogFactory {
      * <p>
      * Here we try to figure out which case has occurred so we can give the
      * user some reasonable feedback.
+     * </p>
      *
      * @param badClassLoader is the class loader we loaded the problem class from,
      * ie it is equivalent to badClass.getClassLoader().
@@ -1000,9 +941,7 @@ public class LogFactoryImpl extends LogFactory {
      * @throws LogConfigurationException when the situation
      * should not be recovered from.
      */
-    private void handleFlawedHierarchy(final ClassLoader badClassLoader, final Class<?> badClass)
-        throws LogConfigurationException {
-
+    private void handleFlawedHierarchy(final ClassLoader badClassLoader, final Class<?> badClass) throws LogConfigurationException {
         boolean implementsLog = false;
         final String logInterfaceName = Log.class.getName();
         final Class<?>[] interfaces = badClass.getInterfaces();
@@ -1012,22 +951,19 @@ public class LogFactoryImpl extends LogFactory {
                 break;
             }
         }
-
         if (implementsLog) {
             // the class does implement an interface called Log, but
             // it is in the wrong class loader
             if (isDiagnosticsEnabled()) {
                 try {
                     final ClassLoader logInterfaceClassLoader = getClassLoader(Log.class);
-                    logDiagnostic("Class '" + badClass.getName() + "' was found in class loader " +
-                                  objectId(badClassLoader) + ". It is bound to a Log interface which is not" +
-                                  " the one loaded from class loader " + objectId(logInterfaceClassLoader));
+                    logDiagnostic("Class '" + badClass.getName() + "' was found in class loader " + objectId(badClassLoader) +
+                            ". It is bound to a Log interface which is not the one loaded from class loader " + objectId(logInterfaceClassLoader));
                 } catch (final Throwable t) {
                     handleThrowable(t); // may re-throw t
-                    logDiagnostic("Error while trying to output diagnostics about" + " bad class '" + badClass + "'");
+                    logDiagnostic("Error while trying to output diagnostics about bad class '" + badClass + "'");
                 }
             }
-
             if (!allowFlawedHierarchy) {
                 final StringBuilder msg = new StringBuilder();
                 msg.append("Terminating logging for this context ");
@@ -1040,7 +976,6 @@ public class LogFactoryImpl extends LogFactory {
                 }
                 throw new LogConfigurationException(msg.toString());
             }
-
             if (isDiagnosticsEnabled()) {
                 final StringBuilder msg = new StringBuilder();
                 msg.append("Warning: bad log hierarchy. ");
@@ -1060,10 +995,8 @@ public class LogFactoryImpl extends LogFactory {
                 if (isDiagnosticsEnabled()) {
                     logDiagnostic(msg.toString());
                 }
-
                 throw new LogConfigurationException(msg.toString());
             }
-
             if (isDiagnosticsEnabled()) {
                 final StringBuilder msg = new StringBuilder();
                 msg.append("[WARNING] Log class '");
@@ -1081,14 +1014,12 @@ public class LogFactoryImpl extends LogFactory {
      * @param name the (trimmed) name to be test against the candidate, not null
      * @param candidate the candidate name (not null)
      */
-    private void informUponSimilarName(final StringBuilder messageBuffer, final String name,
-            final String candidate) {
+    private void informUponSimilarName(final StringBuilder messageBuffer, final String name, final String candidate) {
         if (name.equals(candidate)) {
             // Don't suggest a name that is exactly the same as the one the
             // user tried...
             return;
         }
-
         // If the user provides a name that is in the right package, and gets
         // the first 5 characters of the adapter class right (ignoring case),
         // then suggest the candidate adapter class name.
@@ -1100,7 +1031,7 @@ public class LogFactoryImpl extends LogFactory {
     }
 
     /**
-     * Initialize a number of variables that control the behavior of this
+     * Initializes a number of variables that control the behavior of this
      * class and that can be tweaked by the user. This is done when the first
      * logger is created, not in the constructor of this class, because we
      * need to give the user a chance to call method setAttribute in order to
@@ -1113,7 +1044,7 @@ public class LogFactoryImpl extends LogFactory {
     }
 
     /**
-     * Calculate and cache a string that uniquely identifies this instance,
+     * Initializes a string that uniquely identifies this instance,
      * including which class loader the object was loaded from.
      * <p>
      * This string will later be prefixed to each "internal logging" message
@@ -1158,9 +1089,7 @@ public class LogFactoryImpl extends LogFactory {
      */
     @Deprecated
     protected boolean isJdk13LumberjackAvailable() {
-        return isLogLibraryAvailable(
-                "Jdk13Lumberjack",
-                "org.apache.commons.logging.impl.Jdk13LumberjackLogger");
+        return isLogLibraryAvailable("Jdk13Lumberjack", "org.apache.commons.logging.impl.Jdk13LumberjackLogger");
     }
 
     /**
@@ -1187,20 +1116,15 @@ public class LogFactoryImpl extends LogFactory {
     }
 
     /**
-     * Utility method to check whether a particular logging library is
-     * present and available for use. Note that this does <em>not</em>
-     * affect the future behavior of this class.
+     * Tests whether a particular logging library is present and available for use. Note that this does <em>not</em> affect the future behavior of this class.
      */
     private boolean isLogLibraryAvailable(final String name, final String className) {
         if (isDiagnosticsEnabled()) {
             logDiagnostic("Checking for '" + name + "'.");
         }
         try {
-            final Log log = createLogFromClass(
-                        className,
-                        this.getClass().getName(), // dummy category
-                        false);
-
+            final Log log = createLogFromClass(className, this.getClass().getName(), // dummy category
+                    false);
             if (log == null) {
                 if (isDiagnosticsEnabled()) {
                     logDiagnostic("Did not find '" + name + "'.");
@@ -1244,26 +1168,20 @@ public class LogFactoryImpl extends LogFactory {
         try {
             if (logConstructor == null) {
                 instance = discoverLogImplementation(name);
-            }
-            else {
+            } else {
                 final Object[] params = { name };
                 instance = (Log) logConstructor.newInstance(params);
             }
-
             if (logMethod != null) {
                 final Object[] params = { this };
                 logMethod.invoke(instance, params);
             }
-
             return instance;
-
         } catch (final LogConfigurationException lce) {
-
             // this type of exception means there was a problem in discovery
             // and we've already output diagnostics about the issue, etc.;
             // just pass it on
             throw lce;
-
         } catch (final InvocationTargetException e) {
             // A problem occurred invoking the Constructor or Method
             // previously discovered
@@ -1278,7 +1196,7 @@ public class LogFactoryImpl extends LogFactory {
     }
 
     /**
-     * Release any internal references to previously created
+     * Releases any internal references to previously created
      * {@link org.apache.commons.logging.Log}
      * instances returned by this factory.  This is useful in environments
      * like servlet containers, which implement application reloading by
@@ -1287,7 +1205,6 @@ public class LogFactoryImpl extends LogFactory {
      */
     @Override
     public void release() {
-
         logDiagnostic("Releasing all known loggers");
         instances.clear();
     }
@@ -1313,15 +1230,19 @@ public class LogFactoryImpl extends LogFactory {
      * within a container (such as a webapp) to configure behavior on a
      * per-component level instead of globally as system properties would do.
      * To use this method instead of a system property, call
+     * </p>
      * <pre>
      * LogFactory.getFactory().setAttribute(...)
      * </pre>
+     * <p>
      * This must be done before the first Log object is created; configuration
      * changes after that point will be ignored.
+     * </p>
      * <p>
      * This method is also called automatically if LogFactory detects a
      * commons-logging.properties file; every entry in that file is set
      * automatically as an attribute here.
+     * </p>
      *
      * @param name Name of the attribute to set
      * @param value Value of the attribute to set, or {@code null}
@@ -1332,13 +1253,11 @@ public class LogFactoryImpl extends LogFactory {
         if (logConstructor != null) {
             logDiagnostic("setAttribute: call too late; configuration already performed.");
         }
-
         if (value == null) {
             attributes.remove(name);
         } else {
             attributes.put(name, value);
         }
-
         if (name.equals(TCCL_KEY)) {
             useTCCL = value != null && Boolean.parseBoolean(value.toString());
         }