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

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 2099e15fb6 Code clean-up - formatting. No functional change
2099e15fb6 is described below

commit 2099e15fb64ad64efc65f56f79d7a72bb875a425
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Apr 3 17:10:33 2025 +0100

    Code clean-up - formatting. No functional change
---
 java/org/apache/juli/AsyncFileHandler.java      |  8 +++----
 java/org/apache/juli/ClassLoaderLogManager.java |  8 +++----
 java/org/apache/juli/FileHandler.java           |  4 ++--
 java/org/apache/juli/JsonFormatter.java         | 29 +++++++++++++------------
 java/org/apache/juli/OneLineFormatter.java      | 21 +++++++++++-------
 java/org/apache/juli/VerbatimFormatter.java     |  6 ++---
 6 files changed, 41 insertions(+), 35 deletions(-)

diff --git a/java/org/apache/juli/AsyncFileHandler.java 
b/java/org/apache/juli/AsyncFileHandler.java
index 933817aad0..c16fff6679 100644
--- a/java/org/apache/juli/AsyncFileHandler.java
+++ b/java/org/apache/juli/AsyncFileHandler.java
@@ -55,8 +55,8 @@ public class AsyncFileHandler extends FileHandler {
     public static final int MAX_RECORDS = Integer
             
.parseInt(System.getProperty("org.apache.juli.AsyncMaxRecordCount", 
Integer.toString(DEFAULT_MAX_RECORDS)));
 
-    private static final LoggerExecutorService LOGGER_SERVICE = new 
LoggerExecutorService(OVERFLOW_DROP_TYPE,
-            MAX_RECORDS);
+    private static final LoggerExecutorService LOGGER_SERVICE =
+            new LoggerExecutorService(OVERFLOW_DROP_TYPE, MAX_RECORDS);
 
     private final Object closeLock = new Object();
     protected volatile boolean closed = false;
@@ -121,8 +121,8 @@ public class AsyncFileHandler extends FileHandler {
         record.getSourceMethodName();
         loggerService.execute(() -> {
             /*
-             * During Tomcat shutdown, the Handlers are closed before the 
executor queue is flushed therefore the
-             * closed flag is ignored if the executor is shutting down.
+             * During Tomcat shutdown, the Handlers are closed before the 
executor queue is flushed therefore the closed
+             * flag is ignored if the executor is shutting down.
              */
             if (!closed || loggerService.isTerminating()) {
                 publishInternal(record);
diff --git a/java/org/apache/juli/ClassLoaderLogManager.java 
b/java/org/apache/juli/ClassLoaderLogManager.java
index 877db5cac6..3d918f942a 100644
--- a/java/org/apache/juli/ClassLoaderLogManager.java
+++ b/java/org/apache/juli/ClassLoaderLogManager.java
@@ -95,7 +95,7 @@ public class ClassLoaderLogManager extends LogManager {
      * Map containing the classloader information, keyed per classloader. A 
weak hashmap is used to ensure no
      * classloader reference is leaked from application redeployment.
      */
-    protected final Map<ClassLoader, ClassLoaderLogInfo> classLoaderLoggers = 
new WeakHashMap<>(); // Guarded by this
+    protected final Map<ClassLoader,ClassLoaderLogInfo> classLoaderLoggers = 
new WeakHashMap<>(); // Guarded by this
 
 
     /**
@@ -681,7 +681,7 @@ public class ClassLoaderLogManager extends LogManager {
     protected static final class LogNode {
         Logger logger;
 
-        final Map<String, LogNode> children = new HashMap<>();
+        final Map<String,LogNode> children = new HashMap<>();
 
         final LogNode parent;
 
@@ -747,8 +747,8 @@ public class ClassLoaderLogManager extends LogManager {
 
     protected static final class ClassLoaderLogInfo {
         final LogNode rootNode;
-        final Map<String, Logger> loggers = new ConcurrentHashMap<>();
-        final Map<String, Handler> handlers = new HashMap<>();
+        final Map<String,Logger> loggers = new ConcurrentHashMap<>();
+        final Map<String,Handler> handlers = new HashMap<>();
         final Properties props = new Properties();
 
         ClassLoaderLogInfo(final LogNode rootNode) {
diff --git a/java/org/apache/juli/FileHandler.java 
b/java/org/apache/juli/FileHandler.java
index 3cc4e05c8e..25c6d8320b 100644
--- a/java/org/apache/juli/FileHandler.java
+++ b/java/org/apache/juli/FileHandler.java
@@ -87,8 +87,8 @@ public class FileHandler extends Handler {
     public static final int DEFAULT_BUFFER_SIZE = -1;
 
 
-    private static final ExecutorService DELETE_FILES_SERVICE = Executors
-            .newSingleThreadExecutor(new 
ThreadFactory("FileHandlerLogFilesCleaner-"));
+    private static final ExecutorService DELETE_FILES_SERVICE =
+            Executors.newSingleThreadExecutor(new 
ThreadFactory("FileHandlerLogFilesCleaner-"));
 
     // ------------------------------------------------------------ Constructor
 
diff --git a/java/org/apache/juli/JsonFormatter.java 
b/java/org/apache/juli/JsonFormatter.java
index 22ed1625d6..c2ad5382e1 100644
--- a/java/org/apache/juli/JsonFormatter.java
+++ b/java/org/apache/juli/JsonFormatter.java
@@ -20,9 +20,8 @@ import java.util.logging.LogManager;
 import java.util.logging.LogRecord;
 
 /**
- * Provides the same information as the one line format but using JSON 
formatting.
- * All the information of the LogRecord is included as a one line JSON 
document,
- * including the full stack trace of the associated exception if any.
+ * Provides the same information as the one line format but using JSON 
formatting. All the information of the LogRecord
+ * is included as a one line JSON document, including the full stack trace of 
the associated exception if any.
  * <p>
  * The LogRecord is mapped as attributes:
  * <ul>
@@ -32,9 +31,9 @@ import java.util.logging.LogRecord;
  * <li>class: the class from which the log originated</li>
  * <li>method: the method from which the log originated</li>
  * <li>message: the log message</li>
- * <li>throwable: the full stack trace from an exception, if present, 
represented as an array of string
- *  (the message first, then one string per stack trace element prefixed by a 
whitespace,
- *  then moving on to the cause exception if any)</li>
+ * <li>throwable: the full stack trace from an exception, if present, 
represented as an array of string (the message
+ * first, then one string per stack trace element prefixed by a whitespace, 
then moving on to the cause exception if
+ * any)</li>
  * </ul>
  */
 public class JsonFormatter extends OneLineFormatter {
@@ -121,15 +120,16 @@ public class JsonFormatter extends OneLineFormatter {
 
 
     /**
-     * Provides escaping of values so they can be included in a JSON document.
-     * Escaping is based on the definition of JSON found in
-     * <a href="https://www.rfc-editor.org/rfc/rfc8259.html";>RFC 8259</a>.
+     * Provides escaping of values so they can be included in a JSON document. 
Escaping is based on the definition of
+     * JSON found in <a href="https://www.rfc-editor.org/rfc/rfc8259.html";>RFC 
8259</a>.
      */
     public static class JSONFilter {
 
         /**
          * Escape the given string.
+         *
          * @param input the string
+         *
          * @return the escaped string
          */
         public static String escape(String input) {
@@ -138,16 +138,17 @@ public class JsonFormatter extends OneLineFormatter {
 
         /**
          * Escape the given char sequence.
-         * @param input the char sequence
-         * @param off the offset on which escaping will start
+         *
+         * @param input  the char sequence
+         * @param off    the offset on which escaping will start
          * @param length the length which should be escaped
+         *
          * @return the escaped char sequence corresponding to the specified 
range
          */
         public static CharSequence escape(CharSequence input, int off, int 
length) {
             /*
-             * While any character MAY be escaped, only U+0000 to U+001F 
(control
-             * characters), U+0022 (quotation mark) and U+005C (reverse 
solidus)
-             * MUST be escaped.
+             * While any character MAY be escaped, only U+0000 to U+001F 
(control characters), U+0022 (quotation mark)
+             * and U+005C (reverse solidus) MUST be escaped.
              */
             StringBuilder escaped = null;
             int lastUnescapedStart = off;
diff --git a/java/org/apache/juli/OneLineFormatter.java 
b/java/org/apache/juli/OneLineFormatter.java
index c48811af7d..4ad3680b18 100644
--- a/java/org/apache/juli/OneLineFormatter.java
+++ b/java/org/apache/juli/OneLineFormatter.java
@@ -41,8 +41,8 @@ public class OneLineFormatter extends Formatter {
     private static final Object threadMxBeanLock = new Object();
     private static volatile ThreadMXBean threadMxBean = null;
     private static final int THREAD_NAME_CACHE_SIZE = 10000;
-    private static final ThreadLocal<ThreadNameCache> threadNameCache = 
ThreadLocal
-            .withInitial(() -> new ThreadNameCache(THREAD_NAME_CACHE_SIZE));
+    private static final ThreadLocal<ThreadNameCache> threadNameCache =
+            ThreadLocal.withInitial(() -> new 
ThreadNameCache(THREAD_NAME_CACHE_SIZE));
 
     /* Timestamp format */
     private static final String DEFAULT_TIME_FORMAT = "dd-MMM-yyyy 
HH:mm:ss.SSS";
@@ -100,8 +100,8 @@ public class OneLineFormatter extends Formatter {
         }
 
         final DateFormatCache globalDateCache = new 
DateFormatCache(globalCacheSize, cachedTimeFormat, null);
-        localDateCache = ThreadLocal
-                .withInitial(() -> new DateFormatCache(localCacheSize, 
cachedTimeFormat, globalDateCache));
+        localDateCache =
+                ThreadLocal.withInitial(() -> new 
DateFormatCache(localCacheSize, cachedTimeFormat, globalDateCache));
     }
 
 
@@ -215,10 +215,11 @@ public class OneLineFormatter extends Formatter {
      * resulting mess that follows.
      *
      * @param logRecordThreadId the thread id
+     *
      * @return the thread name
      */
     protected static String getThreadName(int logRecordThreadId) {
-        Map<Integer, String> cache = threadNameCache.get();
+        Map<Integer,String> cache = threadNameCache.get();
         String result = cache.get(Integer.valueOf(logRecordThreadId));
 
         if (result != null) {
@@ -252,7 +253,7 @@ public class OneLineFormatter extends Formatter {
     /*
      * This is an LRU cache.
      */
-    private static class ThreadNameCache extends LinkedHashMap<Integer, 
String> {
+    private static class ThreadNameCache extends LinkedHashMap<Integer,String> 
{
 
         private static final long serialVersionUID = 1L;
 
@@ -264,7 +265,7 @@ public class OneLineFormatter extends Formatter {
         }
 
         @Override
-        protected boolean removeEldestEntry(Map.Entry<Integer, String> eldest) 
{
+        protected boolean removeEldestEntry(Map.Entry<Integer,String> eldest) {
             return (size() > cacheSize);
         }
     }
@@ -289,6 +290,10 @@ public class OneLineFormatter extends Formatter {
 
 
     private enum MillisHandling {
-        NONE, APPEND, REPLACE_S, REPLACE_SS, REPLACE_SSS,
+        NONE,
+        APPEND,
+        REPLACE_S,
+        REPLACE_SS,
+        REPLACE_SSS,
     }
 }
diff --git a/java/org/apache/juli/VerbatimFormatter.java 
b/java/org/apache/juli/VerbatimFormatter.java
index 6378180610..88efa4ddf7 100644
--- a/java/org/apache/juli/VerbatimFormatter.java
+++ b/java/org/apache/juli/VerbatimFormatter.java
@@ -20,9 +20,9 @@ import java.util.logging.Formatter;
 import java.util.logging.LogRecord;
 
 /**
- * Outputs just the log message with no additional elements. Stack traces are 
not logged. Log messages are separated
- * by <code>System.lineSeparator()</code>. This is intended for use by access 
logs and the like that need complete
- * control over the output format.
+ * Outputs just the log message with no additional elements. Stack traces are 
not logged. Log messages are separated by
+ * <code>System.lineSeparator()</code>. This is intended for use by access 
logs and the like that need complete control
+ * over the output format.
  */
 public class VerbatimFormatter extends Formatter {
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to