This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new a51548dc42 Code clean-up - formatting. No functional change
a51548dc42 is described below
commit a51548dc4235b8438890fc8b9e6327d31e69980a
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Apr 3 17:09:44 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 d0dca3bc9d..d643e7780c 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 2c056c7eeb..103aee181c 100644
--- a/java/org/apache/juli/ClassLoaderLogManager.java
+++ b/java/org/apache/juli/ClassLoaderLogManager.java
@@ -78,7 +78,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
/**
@@ -602,7 +602,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;
@@ -668,8 +668,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 2eec7de595..deeae3495d 100644
--- a/java/org/apache/juli/FileHandler.java
+++ b/java/org/apache/juli/FileHandler.java
@@ -84,8 +84,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 c83bea1123..2d07fb29d8 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 24005db227..447a4304ce 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));
}
@@ -211,10 +211,11 @@ public class OneLineFormatter extends Formatter {
* LogRecord has threadID but no thread name.
*
* @param logRecordThreadId the thread id
+ *
* @return the thread name
*/
protected static String getThreadName(long logRecordThreadId) {
- Map<Long, String> cache = threadNameCache.get();
+ Map<Long,String> cache = threadNameCache.get();
String result = cache.get(Long.valueOf(logRecordThreadId));
if (result != null) {
@@ -244,7 +245,7 @@ public class OneLineFormatter extends Formatter {
/*
* This is an LRU cache.
*/
- private static class ThreadNameCache extends LinkedHashMap<Long, String> {
+ private static class ThreadNameCache extends LinkedHashMap<Long,String> {
@Serial
private static final long serialVersionUID = 1L;
@@ -257,7 +258,7 @@ public class OneLineFormatter extends Formatter {
}
@Override
- protected boolean removeEldestEntry(Map.Entry<Long, String> eldest) {
+ protected boolean removeEldestEntry(Map.Entry<Long,String> eldest) {
return (size() > cacheSize);
}
}
@@ -282,6 +283,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: [email protected]
For additional commands, e-mail: [email protected]