From 9fb30f8541a857e9bbc6c6863dfb243409c73dd4 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Thu, 15 Aug 2024 07:29:24 -0400 Subject: [PATCH] Sort members --- .../apache/commons/logging/LogFactory.java | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/main/java/org/apache/commons/logging/LogFactory.java b/src/main/java/org/apache/commons/logging/LogFactory.java index 4f4a2ef..f88a54a 100644 --- a/src/main/java/org/apache/commons/logging/LogFactory.java +++ b/src/main/java/org/apache/commons/logging/LogFactory.java @@ -1405,45 +1405,6 @@ public abstract class LogFactory { return newFactory(factoryClass, classLoader, null); } - /** - * Tries to load one of the standard three implementations from the given classloader. - *

- * We assume that {@code classLoader} can load this class. - *

- * @param classLoader The classloader to use. - * @return An implementation of this class. - */ - private static LogFactory newStandardFactory(final ClassLoader classLoader) { - if (isClassAvailable(LOG4J_TO_SLF4J_BRIDGE, classLoader)) { - try { - return (LogFactory) Class.forName(FACTORY_SLF4J, true, classLoader).getConstructor().newInstance(); - } catch (final LinkageError | ReflectiveOperationException ignored) { - } finally { - logDiagnostic( - "[LOOKUP] Log4j API to SLF4J redirection detected. Loading the SLF4J LogFactory implementation '" + FACTORY_SLF4J + "'."); - } - } - try { - return (LogFactory) Class.forName(FACTORY_LOG4J_API, true, classLoader).getConstructor().newInstance(); - } catch (final LinkageError | ReflectiveOperationException ignored) { - } finally { - logDiagnostic("[LOOKUP] Loading the Log4j API LogFactory implementation '" + FACTORY_LOG4J_API + "'."); - } - try { - return (LogFactory) Class.forName(FACTORY_SLF4J, true, classLoader).getConstructor().newInstance(); - } catch (final LinkageError | ReflectiveOperationException ignored) { - } finally { - logDiagnostic("[LOOKUP] Loading the SLF4J LogFactory implementation '" + FACTORY_SLF4J + "'."); - } - try { - return (LogFactory) Class.forName(FACTORY_DEFAULT, true, classLoader).getConstructor().newInstance(); - } catch (final LinkageError | ReflectiveOperationException ignored) { - } finally { - logDiagnostic("[LOOKUP] Loading the legacy LogFactory implementation '" + FACTORY_DEFAULT + "'."); - } - return null; - } - /** * Gets a new instance of the specified {@code LogFactory} implementation class, loaded by the specified class loader. If that fails, try the class loader * used to load this (abstract) LogFactory. @@ -1500,6 +1461,45 @@ public abstract class LogFactory { return (LogFactory) result; } + /** + * Tries to load one of the standard three implementations from the given classloader. + *

+ * We assume that {@code classLoader} can load this class. + *

+ * @param classLoader The classloader to use. + * @return An implementation of this class. + */ + private static LogFactory newStandardFactory(final ClassLoader classLoader) { + if (isClassAvailable(LOG4J_TO_SLF4J_BRIDGE, classLoader)) { + try { + return (LogFactory) Class.forName(FACTORY_SLF4J, true, classLoader).getConstructor().newInstance(); + } catch (final LinkageError | ReflectiveOperationException ignored) { + } finally { + logDiagnostic( + "[LOOKUP] Log4j API to SLF4J redirection detected. Loading the SLF4J LogFactory implementation '" + FACTORY_SLF4J + "'."); + } + } + try { + return (LogFactory) Class.forName(FACTORY_LOG4J_API, true, classLoader).getConstructor().newInstance(); + } catch (final LinkageError | ReflectiveOperationException ignored) { + } finally { + logDiagnostic("[LOOKUP] Loading the Log4j API LogFactory implementation '" + FACTORY_LOG4J_API + "'."); + } + try { + return (LogFactory) Class.forName(FACTORY_SLF4J, true, classLoader).getConstructor().newInstance(); + } catch (final LinkageError | ReflectiveOperationException ignored) { + } finally { + logDiagnostic("[LOOKUP] Loading the SLF4J LogFactory implementation '" + FACTORY_SLF4J + "'."); + } + try { + return (LogFactory) Class.forName(FACTORY_DEFAULT, true, classLoader).getConstructor().newInstance(); + } catch (final LinkageError | ReflectiveOperationException ignored) { + } finally { + logDiagnostic("[LOOKUP] Loading the legacy LogFactory implementation '" + FACTORY_DEFAULT + "'."); + } + return null; + } + /** * Returns a string that uniquely identifies the specified object, including * its class.