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

mattsicker pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit fae9b867179b381bd2f499a3675d44478f93ba92
Author: Matt Sicker <[email protected]>
AuthorDate: Sun Oct 1 18:30:51 2023 -0500

    Clean up more warnings and broken javadoc links
    
    Signed-off-by: Matt Sicker <[email protected]>
---
 .../spi/CopyOnWriteSortedArrayThreadContextMap.java   |  2 +-
 .../logging/log4j/spi/DefaultThreadContextMap.java    |  2 +-
 .../logging/log4j/spi/DefaultThreadContextStack.java  |  6 +++---
 .../logging/log4j/spi/ExtendedLoggerWrapper.java      |  2 --
 .../spi/GarbageFreeSortedArrayThreadContextMap.java   |  2 +-
 .../org/apache/logging/log4j/spi/LoggingSystem.java   |  4 ++--
 .../logging/log4j/spi/LoggingSystemProperty.java      |  1 +
 .../logging/log4j/spi/NoOpThreadContextMap.java       |  4 ++--
 .../org/apache/logging/log4j/status/StatusLogger.java | 10 +++++-----
 .../java/org/apache/logging/log4j/util/Constants.java | 19 +++----------------
 .../log4j/util/ContextAwarePropertySource.java        |  2 +-
 .../org/apache/logging/log4j/util/EnglishEnums.java   |  2 ++
 12 files changed, 22 insertions(+), 34 deletions(-)

diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
index 222a09df66..d4c8280b91 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
@@ -215,7 +215,7 @@ class CopyOnWriteSortedArrayThreadContextMap implements 
ReadOnlyThreadContextMap
     @Override
     public boolean isEmpty() {
         final StringMap map = localMap.get();
-        return map == null || map.size() == 0;
+        return map == null || map.isEmpty();
     }
 
     @Override
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
index bbb219decc..6f68dfbe80 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
@@ -178,7 +178,7 @@ public class DefaultThreadContextMap implements 
ThreadContextMap, ReadOnlyString
     @Override
     public boolean isEmpty() {
         final Map<String, String> map = localMap.get();
-        return map == null || map.size() == 0;
+        return map == null || map.isEmpty();
     }
 
     @Override
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
index b8f831db0a..c91799750a 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
@@ -170,7 +170,7 @@ public class DefaultThreadContextStack implements 
ThreadContextStack, StringBuil
     @Override
     public String peek() {
         final MutableThreadContextStack values = STACK.get();
-        if (values == null || values.size() == 0) {
+        if (values == null || values.isEmpty()) {
             return Strings.EMPTY;
         }
         return values.peek();
@@ -182,7 +182,7 @@ public class DefaultThreadContextStack implements 
ThreadContextStack, StringBuil
             return Strings.EMPTY;
         }
         final MutableThreadContextStack values = STACK.get();
-        if (values == null || values.size() == 0) {
+        if (values == null || values.isEmpty()) {
             // Like version 1.2
             return Strings.EMPTY;
         }
@@ -208,7 +208,7 @@ public class DefaultThreadContextStack implements 
ThreadContextStack, StringBuil
             return false;
         }
         final MutableThreadContextStack values = STACK.get();
-        if (values == null || values.size() == 0) {
+        if (values == null || values.isEmpty()) {
             return false;
         }
         final MutableThreadContextStack copy = (MutableThreadContextStack) 
values.copy();
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLoggerWrapper.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLoggerWrapper.java
index e95e1e100d..ac4953d9e9 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLoggerWrapper.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLoggerWrapper.java
@@ -27,8 +27,6 @@ import org.apache.logging.log4j.util.StackLocatorUtil;
  */
 public class ExtendedLoggerWrapper extends AbstractLogger {
 
-    private static final long serialVersionUID = 1L;
-
     /**
      * The wrapped Logger.
      */
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
index 226c0754a0..4c205e7019 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
@@ -218,7 +218,7 @@ class GarbageFreeSortedArrayThreadContextMap implements 
ReadOnlyThreadContextMap
     @Override
     public boolean isEmpty() {
         final StringMap map = localMap.get();
-        return map == null || map.size() == 0;
+        return map == null || map.isEmpty();
     }
 
     @Override
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggingSystem.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggingSystem.java
index b6e3a93922..1c626be8ee 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggingSystem.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggingSystem.java
@@ -329,10 +329,10 @@ public class LoggingSystem {
          * Creates the ThreadContextMap instance used by the ThreadContext.
          * <p>
          * If {@linkplain Constants#isThreadLocalsEnabled() Log4j can use 
ThreadLocals}, a garbage-free StringMap-based context map can
-         * be installed by setting system property {@value 
LoggingSystemProperty#THREAD_CONTEXT_GARBAGE_FREE_ENABLED} to {@code true}.
+         * be installed by setting system property {@link 
LoggingSystemProperty#THREAD_CONTEXT_GARBAGE_FREE_ENABLED} to {@code true}.
          * </p><p>
          * Furthermore, any custom {@code ThreadContextMap} can be installed 
by setting system property
-         * {@value LoggingSystemProperty#THREAD_CONTEXT_MAP_CLASS} to the 
fully qualified class name of the class implementing the
+         * {@link LoggingSystemProperty#THREAD_CONTEXT_MAP_CLASS} to the fully 
qualified class name of the class implementing the
          * {@code ThreadContextMap} interface. (Also implement the {@code 
ReadOnlyThreadContextMap} interface if your custom
          * {@code ThreadContextMap} implementation should be accessible to 
applications via the
          * {@link ThreadContext#getThreadContextMap()} method.)
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggingSystemProperty.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggingSystemProperty.java
index 3bd60133cf..418ab4cd19 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggingSystemProperty.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggingSystemProperty.java
@@ -238,6 +238,7 @@ public enum LoggingSystemProperty implements PropertyKey {
         return systemKey;
     }
 
+    @Override
     public String toString() {
         return getKey();
     }
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/NoOpThreadContextMap.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/NoOpThreadContextMap.java
index 8dd46b9101..d07c6bd790 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/NoOpThreadContextMap.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/NoOpThreadContextMap.java
@@ -21,8 +21,8 @@ import java.util.Map;
 
 /**
  * {@code ThreadContextMap} implementation used when either of system 
properties
- * {@value LoggingSystemProperty#THREAD_CONTEXT_MAP_DISABLED} or
- * {@value LoggingSystemProperty#THREAD_CONTEXT_DISABLED} is {@code true}. 
This implementation does nothing.
+ * {@link LoggingSystemProperty#THREAD_CONTEXT_MAP_ENABLED} or
+ * {@link LoggingSystemProperty#THREAD_CONTEXT_ENABLE} is {@code false}. This 
implementation does nothing.
  *
  * @since 2.7
  */
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
index 9de496411a..5a57841814 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
@@ -43,7 +43,7 @@ import org.apache.logging.log4j.util.LowLevelLogUtil;
  * Records events that occur in the logging system. By default, only error 
messages are logged to {@link System#err}.
  * Normally, the Log4j StatusLogger is configured via the root {@code 
<Configuration status="LEVEL"/>} node in a Log4j
  * configuration file. However, this can be overridden via a system property 
named
- * {@value LoggingSystemProperty#STATUS_DEFAULT_LISTENER_LEVEL} and will work 
with any Log4j provider.
+ * {@link LoggingSystemProperty#STATUS_DEFAULT_LISTENER_LEVEL} and will work 
with any Log4j provider.
  *
  * @see SimpleLogger
  * @see SimpleLoggerContext
@@ -78,21 +78,21 @@ public final class StatusLogger extends AbstractLogger {
      * This is now the logger level is set:
      * </p>
      * <ol>
-     * <li>If the property {@value LoggingSystemProperty#SYSTEM_DEBUG} is 
{@code "true"}, then use {@link Level#TRACE}, otherwise,</li>
+     * <li>If the property {@link LoggingSystemProperty#STATUS_LOGGER_DEBUG} 
is {@code "true"}, then use {@link Level#TRACE}, otherwise,</li>
      * <li>Use {@link Level#ERROR}</li>
      * </ol>
      * <p>
      * This is now the listener level is set:
      * </p>
      * <ol>
-     * <li>If the property {@value 
LoggingSystemProperty#STATUS_DEFAULT_LISTENER_LEVEL} is set, then use 
<em>it</em>, otherwise,</li>
+     * <li>If the property {@link 
LoggingSystemProperty#STATUS_DEFAULT_LISTENER_LEVEL} is set, then use 
<em>it</em>, otherwise,</li>
      * <li>Use {@link Level#WARN}</li>
      * </ol>
      * <p>
      * See:
      * <ol>
      * <li>LOG4J2-1813 Provide shorter and more intuitive way to switch on 
Log4j internal debug logging. If system property
-     * {@value LoggingSystemProperty#SYSTEM_DEBUG} is defined, print all 
status logging.</li>
+     * {@link LoggingSystemProperty#STATUS_LOGGER_DEBUG} is defined, print all 
status logging.</li>
      * <li>LOG4J2-3340 StatusLogger's log Level cannot be changed as 
advertised.</li>
      * </ol>
      * </p>
@@ -387,7 +387,7 @@ public final class StatusLogger extends AbstractLogger {
         if (configuration.isDebugEnabled()) {
             return true;
         }
-        if (listeners.size() > 0) {
+        if (!listeners.isEmpty()) {
             return listenersLevel >= level.intLevel();
         }
         return logger.isEnabled(level, marker);
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java
index af155306fb..d399d64fc6 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java
@@ -28,7 +28,8 @@ public final class Constants {
 
     private static final LazyBoolean isWebApp = new LazyBoolean(() -> 
PropertiesUtil.getProperties()
             .getBooleanProperty(LoggingSystemProperty.IS_WEBAPP,
-                    isClassAvailable("javax.servlet.Servlet") || 
isClassAvailable("jakarta.servlet.Servlet")));
+                    LoaderUtil.isClassAvailable("javax.servlet.Servlet") ||
+                            
LoaderUtil.isClassAvailable("jakarta.servlet.Servlet")));
 
     /**
      * {@code true} if we think we are running in a web container, based on 
the boolean value of system property
@@ -88,7 +89,7 @@ public final class Constants {
      * After a large message has been delivered to the appenders, the 
StringBuilder is trimmed to this size.
      * <p>
      * The default value is 518, which allows the StringBuilder to resize 
three times from its initial size.
-     * Users can override with system property {@value 
LoggingSystemProperty#GC_REUSABLE_MESSAGE_MAX_SIZE}.
+     * Users can override with system property {@link 
LoggingSystemProperty#GC_REUSABLE_MESSAGE_MAX_SIZE}.
      * </p>
      * @since 2.9
      */
@@ -99,20 +100,6 @@ public final class Constants {
         return PropertiesUtil.getProperties().getIntegerProperty(property, 
defaultValue);
     }
 
-    /**
-     * Determines if a named Class can be loaded or not.
-     *
-     * @param className The class name.
-     * @return {@code true} if the class could be found or {@code false} 
otherwise.
-     */
-    private static boolean isClassAvailable(final String className) {
-        try {
-            return LoaderUtil.loadClass(className) != null;
-        } catch (final Throwable e) {
-            return false;
-        }
-    }
-
     /**
      * The empty array.
      */
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/util/ContextAwarePropertySource.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/util/ContextAwarePropertySource.java
index a4a1590878..bb00f2fff5 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/util/ContextAwarePropertySource.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/util/ContextAwarePropertySource.java
@@ -34,7 +34,7 @@ public abstract class ContextAwarePropertySource implements 
PropertySource {
 
     protected final Map<String, Properties> propertiesMap;
     private final String contextName;
-    private boolean includeInvalid;
+    private final boolean includeInvalid;
 
     public ContextAwarePropertySource(final Properties properties, final 
String contextName,
                                       final boolean includeInvalid) {
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java
index 7b482da91a..6a360354d9 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java
@@ -17,6 +17,8 @@
 package org.apache.logging.log4j.util;
 
 
+import java.util.Locale;
+
 import static org.apache.logging.log4j.util.Strings.toRootUpperCase;
 
 /**

Reply via email to