This is an automated email from the ASF dual-hosted git repository.
markt-asf 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 e7dc8f088b Code clean-up - re-apply standard formatting
e7dc8f088b is described below
commit e7dc8f088b09281f3d6cac387afa5e0b6589c7e4
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Aug 21 18:09:21 2026 +0100
Code clean-up - re-apply standard formatting
---
java/org/apache/catalina/Store.java | 6 ++-
java/org/apache/catalina/session/ManagerBase.java | 18 ++++---
.../catalina/session/StandardSessionAccessor.java | 2 +-
.../catalina/valves/AbstractAccessLogValve.java | 56 ++++++++++------------
.../valves/CrawlerSessionManagerValve.java | 3 ++
.../apache/catalina/valves/ErrorReportValve.java | 4 +-
.../catalina/valves/ExtendedAccessLogValve.java | 15 ++++++
.../catalina/valves/JsonErrorReportValve.java | 7 ++-
.../apache/catalina/valves/PersistentValve.java | 11 ++---
.../catalina/valves/ProxyErrorReportValve.java | 4 +-
java/org/apache/catalina/valves/SSLValve.java | 3 +-
.../catalina/valves/StuckThreadDetectionValve.java | 3 +-
12 files changed, 76 insertions(+), 56 deletions(-)
diff --git a/java/org/apache/catalina/Store.java b/java/org/apache/catalina/Store.java
index 095df95c9a..c2cb99c572 100644
--- a/java/org/apache/catalina/Store.java
+++ b/java/org/apache/catalina/Store.java
@@ -48,6 +48,7 @@ public interface Store {
* Return the number of Sessions present in this Store.
*
* @return the number of Sessions
+ *
* @exception IOException if an input/output error occurs
*/
int getSize() throws IOException;
@@ -62,10 +63,11 @@ public interface Store {
/**
- * Return an array containing the session identifiers of all Sessions currently saved in this Store. If there are
- * no such Sessions, a zero-length array is returned.
+ * Return an array containing the session identifiers of all Sessions currently saved in this Store. If there are no
+ * such Sessions, a zero-length array is returned.
*
* @return the session identifiers
+ *
* @exception IOException if an input/output error occurred
*/
String[] keys() throws IOException;
diff --git a/java/org/apache/catalina/session/ManagerBase.java b/java/org/apache/catalina/session/ManagerBase.java
index b292c83df8..57c2b6b26f 100644
--- a/java/org/apache/catalina/session/ManagerBase.java
+++ b/java/org/apache/catalina/session/ManagerBase.java
@@ -414,8 +414,8 @@ public abstract class ManagerBase extends LifecycleMBeanBase implements Manager
sessionIdGenerator = sessionIdGeneratorClass.getConstructor().newInstance();
return sessionIdGenerator;
} catch (ReflectiveOperationException ex) {
- log.warn(sm.getString("managerBase.sessionIdGeneratorInitFailed",
- sessionIdGeneratorClass.getName()), ex);
+ log.warn(sm.getString("managerBase.sessionIdGeneratorInitFailed", sessionIdGeneratorClass.getName()),
+ ex);
}
}
return null;
@@ -815,9 +815,9 @@ public abstract class ManagerBase extends LifecycleMBeanBase implements Manager
/**
* Change the session ID.
*
- * @param session The session
- * @param newId The new session ID
- * @param notifySessionListeners Whether to notify session listeners
+ * @param session The session
+ * @param newId The new session ID
+ * @param notifySessionListeners Whether to notify session listeners
* @param notifyContainerListeners Whether to notify container listeners
*/
protected void changeSessionId(Session session, String newId, boolean notifySessionListeners,
@@ -1197,6 +1197,7 @@ public abstract class ManagerBase extends LifecycleMBeanBase implements Manager
* Get the timestamp of the last access for the given session.
*
* @param sessionId The session ID
+ *
* @return the timestamp or -1 if not found
*/
public long getThisAccessedTimestamp(String sessionId) {
@@ -1214,6 +1215,7 @@ public abstract class ManagerBase extends LifecycleMBeanBase implements Manager
* Get the last access time for the given session as a formatted string.
*
* @param sessionId The session ID
+ *
* @return the formatted time or empty string if not found
*/
public String getThisAccessedTime(String sessionId) {
@@ -1231,6 +1233,7 @@ public abstract class ManagerBase extends LifecycleMBeanBase implements Manager
* Get the timestamp of the last access for the given session.
*
* @param sessionId The session ID
+ *
* @return the timestamp or -1 if not found
*/
public long getLastAccessedTimestamp(String sessionId) {
@@ -1248,6 +1251,7 @@ public abstract class ManagerBase extends LifecycleMBeanBase implements Manager
* Get the last access time for the given session as a formatted string.
*
* @param sessionId The session ID
+ *
* @return the formatted time or empty string if not found
*/
public String getLastAccessedTime(String sessionId) {
@@ -1265,6 +1269,7 @@ public abstract class ManagerBase extends LifecycleMBeanBase implements Manager
* Get the creation time for the given session as a formatted string.
*
* @param sessionId The session ID
+ *
* @return the formatted time or empty string if not found
*/
public String getCreationTime(String sessionId) {
@@ -1282,6 +1287,7 @@ public abstract class ManagerBase extends LifecycleMBeanBase implements Manager
* Get the creation timestamp for the given session.
*
* @param sessionId The session ID
+ *
* @return the timestamp or -1 if not found
*/
public long getCreationTimestamp(String sessionId) {
@@ -1333,7 +1339,7 @@ public abstract class ManagerBase extends LifecycleMBeanBase implements Manager
* Record for session timing information.
*
* @param timestamp The time stamp in milliseconds
- * @param duration The duration in seconds
+ * @param duration The duration in seconds
*/
protected record SessionTiming(long timestamp, int duration) {
diff --git a/java/org/apache/catalina/session/StandardSessionAccessor.java b/java/org/apache/catalina/session/StandardSessionAccessor.java
index f9a1a7140e..512be692cb 100644
--- a/java/org/apache/catalina/session/StandardSessionAccessor.java
+++ b/java/org/apache/catalina/session/StandardSessionAccessor.java
@@ -44,7 +44,7 @@ public class StandardSessionAccessor implements HttpSession.Accessor {
* Construct a new session accessor.
*
* @param manager The manager that owns the session
- * @param id The session identifier
+ * @param id The session identifier
*/
public StandardSessionAccessor(Manager manager, String id) {
if (manager == null) {
diff --git a/java/org/apache/catalina/valves/AbstractAccessLogValve.java b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
index f2792daf53..0293476c9e 100644
--- a/java/org/apache/catalina/valves/AbstractAccessLogValve.java
+++ b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
@@ -319,7 +319,7 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access
* Creates a new cache with the given format, locale and parent cache.
*
* @param format The format string
- * @param loc The locale
+ * @param loc The locale
* @param parent The parent cache
*/
private Cache(String format, Locale loc, Cache parent) {
@@ -431,8 +431,8 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access
/**
* Creates a new date format cache.
*
- * @param size The cache size
- * @param loc The default locale
+ * @param size The cache size
+ * @param loc The default locale
* @param parentFC The parent cache
*/
protected DateFormatCache(int size, Locale loc, DateFormatCache parentFC) {
@@ -452,7 +452,7 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access
* Gets the cache for the given format.
*
* @param format The format string
- * @param loc The locale
+ * @param loc The locale
*
* @return The cache
*/
@@ -491,8 +491,8 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access
* Gets the formatted timestamp in the given format.
*
* @param format The format string
- * @param loc The locale
- * @param time The time in milliseconds
+ * @param loc The locale
+ * @param time The time in milliseconds
*
* @return The formatted timestamp
*/
@@ -520,8 +520,8 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access
protected String condition = null;
/**
- * Are we doing conditional logging ? default null. It is the value of <code>conditionIf</code> property.
- * If the ServletRequest.getAttribute(conditionIf) yields a non-null value, the logging will be performed.
+ * Are we doing conditional logging ? default null. It is the value of <code>conditionIf</code> property. If the
+ * ServletRequest.getAttribute(conditionIf) yields a non-null value, the logging will be performed.
*/
protected String conditionIf = null;
@@ -1718,14 +1718,14 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access
/**
* Appends the query string to the buffer with optional formatting.
*
- * @param query The query string to append
- * @param buf The buffer to which the query string should be appended
- * @param appendDelim Whether to prepend a '?' delimiter
- * @param escapeQuoteAsDouble Whether to escape quotes as double quotes
- * @param writeDashOnNull Whether to write "-" when query is null
- */
- protected static void appendQueryString(String query, CharArrayWriter buf,
- boolean appendDelim, boolean escapeQuoteAsDouble, boolean writeDashOnNull) {
+ * @param query The query string to append
+ * @param buf The buffer to which the query string should be appended
+ * @param appendDelim Whether to prepend a '?' delimiter
+ * @param escapeQuoteAsDouble Whether to escape quotes as double quotes
+ * @param writeDashOnNull Whether to write "-" when query is null
+ */
+ protected static void appendQueryString(String query, CharArrayWriter buf, boolean appendDelim,
+ boolean escapeQuoteAsDouble, boolean writeDashOnNull) {
if (query != null) {
if (appendDelim) {
buf.append('?');
@@ -2290,8 +2290,8 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access
* - %to trailer response header - %V server name per UseCanonicalName setting
*
* The following escaped elements are not escaped in Tomcat because values that would require escaping are rejected
- * before they reach the AccessLogValve: - %h remote host - %H request protocol - %m request method
- * - %v canonical server name
+ * before they reach the AccessLogValve: - %h remote host - %H request protocol - %m request method - %v canonical
+ * server name
*
* The following escaped elements are supported by Tomcat: - %{}i request header - %{}o response header - %u remote
* user
@@ -2323,9 +2323,9 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access
/**
* Escapes and appends the input string to the destination writer.
*
- * @param input The input string
- * @param dest The destination writer
- * @param escapeQuoteAsDouble Whether to escape quotes as double quotes
+ * @param input The input string
+ * @param dest The destination writer
+ * @param escapeQuoteAsDouble Whether to escape quotes as double quotes
*/
protected static void escapeAndAppend(String input, CharArrayWriter dest, boolean escapeQuoteAsDouble) {
if (input == null || input.isEmpty()) {
@@ -2383,16 +2383,12 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access
next = current + 1;
switch (c) {
// Standard escapes for some control chars
- case '\f' -> // dec 12
- dest.append("\\f");
- case '\n' -> // dec 10
- dest.append("\\n");
- case '\r' -> // dec 13
- dest.append("\\r");
- case '\t' -> // dec 09
- dest.append("\\t");
- // Unicode escape \\uXXXX
+ case '\f' -> dest.append("\\f"); // dec 12
+ case '\n' -> dest.append("\\n"); // dec 10
+ case '\r' -> dest.append("\\r"); // dec 13
+ case '\t' -> dest.append("\\t"); // dec 09
default -> {
+ // Unicode escape \\uXXXX
dest.append("\\u");
dest.append(HexUtils.toHexString(c));
}
diff --git a/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java b/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
index c67229d9be..553588e7b8 100644
--- a/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
+++ b/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
@@ -89,6 +89,7 @@ public class CrawlerSessionManagerValve extends ValveBase {
/**
* Get the regular expression used to identify crawlers based on the User-Agent header.
+ *
* @see #setCrawlerUserAgents(String)
*
* @return The current regular expression being used to match user agents
@@ -115,6 +116,7 @@ public class CrawlerSessionManagerValve extends ValveBase {
/**
* Get the regular expression used to identify crawlers based on their IP address.
+ *
* @see #setCrawlerIps(String)
*
* @return The current regular expression being used to match IP addresses
@@ -136,6 +138,7 @@ public class CrawlerSessionManagerValve extends ValveBase {
/**
* Get the session timeout for a crawler's session.
+ *
* @see #setSessionInactiveInterval(int)
*
* @return The current timeout in seconds
diff --git a/java/org/apache/catalina/valves/ErrorReportValve.java b/java/org/apache/catalina/valves/ErrorReportValve.java
index 9f4211e396..b525cdbd31 100644
--- a/java/org/apache/catalina/valves/ErrorReportValve.java
+++ b/java/org/apache/catalina/valves/ErrorReportValve.java
@@ -427,8 +427,8 @@ public class ErrorReportValve extends ValveBase {
/**
- * Sets a property for error page configuration. Properties starting with
- * "errorCode." or "exceptionType." are used to configure error pages.
+ * Sets a property for error page configuration. Properties starting with "errorCode." or "exceptionType." are used
+ * to configure error pages.
*
* @param name The property name
* @param value The property value
diff --git a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
index 8700a4126f..fe18c81d94 100644
--- a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
+++ b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
@@ -471,6 +471,7 @@ public class ExtendedAccessLogValve extends AccessLogValve {
* Returns the next token from the pattern string.
*
* @return the next token, or {@code null} if no more tokens are available
+ *
* @throws IOException if an I/O error occurs
*/
public String getToken() throws IOException {
@@ -519,6 +520,7 @@ public class ExtendedAccessLogValve extends AccessLogValve {
* Returns the parameter value from the most recent parameter token.
*
* @return the parameter value, or {@code null} if no parameter is available
+ *
* @throws IOException if an I/O error occurs
*/
public String getParameter() throws IOException {
@@ -544,6 +546,7 @@ public class ExtendedAccessLogValve extends AccessLogValve {
* Returns any whitespace following the current position.
*
* @return the whitespace characters, or an empty string if none
+ *
* @throws IOException if an I/O error occurs
*/
public String getWhiteSpaces() throws IOException {
@@ -581,6 +584,7 @@ public class ExtendedAccessLogValve extends AccessLogValve {
* Returns the remaining unparsed portion of the pattern string.
*
* @return the remaining characters in the pattern
+ *
* @throws IOException if an I/O error occurs
*/
public String getRemains() throws IOException {
@@ -645,7 +649,9 @@ public class ExtendedAccessLogValve extends AccessLogValve {
*
* @param token the pattern token
* @param tokenizer the pattern tokenizer
+ *
* @return the log element, or {@code null} if the token is unrecognized
+ *
* @throws IOException if an I/O error occurs while reading the pattern
*/
protected AccessLogElement getLogElement(String token, PatternTokenizer tokenizer) throws IOException {
@@ -724,7 +730,9 @@ public class ExtendedAccessLogValve extends AccessLogValve {
* Returns the appropriate log element for a client-to-server token.
*
* @param tokenizer the pattern tokenizer
+ *
* @return the log element, or {@code null} if unrecognized
+ *
* @throws IOException if an I/O error occurs while reading the pattern
*/
protected AccessLogElement getClientToServerElement(PatternTokenizer tokenizer) throws IOException {
@@ -773,7 +781,9 @@ public class ExtendedAccessLogValve extends AccessLogValve {
* Returns the appropriate log element for a server-to-client token.
*
* @param tokenizer the pattern tokenizer
+ *
* @return the log element, or {@code null} if unrecognized
+ *
* @throws IOException if an I/O error occurs while reading the pattern
*/
protected AccessLogElement getServerToClientElement(PatternTokenizer tokenizer) throws IOException {
@@ -800,7 +810,9 @@ public class ExtendedAccessLogValve extends AccessLogValve {
* Returns the appropriate log element for a proxy token.
*
* @param tokenizer the pattern tokenizer
+ *
* @return the log element, or {@code null} if unrecognized
+ *
* @throws IOException if an I/O error occurs while reading the pattern
*/
protected AccessLogElement getProxyElement(PatternTokenizer tokenizer) throws IOException {
@@ -819,7 +831,9 @@ public class ExtendedAccessLogValve extends AccessLogValve {
* Returns the appropriate log element for an x-parameter token.
*
* @param tokenizer the pattern tokenizer
+ *
* @return the log element, or {@code null} if unrecognized
+ *
* @throws IOException if an I/O error occurs while reading the pattern
*/
protected AccessLogElement getXParameterElement(PatternTokenizer tokenizer) throws IOException {
@@ -874,6 +888,7 @@ public class ExtendedAccessLogValve extends AccessLogValve {
* Returns the appropriate log element for a servlet request method parameter.
*
* @param parameter the parameter name mapping to a request method
+ *
* @return the log element, or {@code null} if the parameter is unrecognized
*/
protected AccessLogElement getServletRequestElement(String parameter) {
diff --git a/java/org/apache/catalina/valves/JsonErrorReportValve.java b/java/org/apache/catalina/valves/JsonErrorReportValve.java
index 9f562523fc..12e6a4185b 100644
--- a/java/org/apache/catalina/valves/JsonErrorReportValve.java
+++ b/java/org/apache/catalina/valves/JsonErrorReportValve.java
@@ -121,8 +121,7 @@ public class JsonErrorReportValve extends ErrorReportValve {
StackTraceElement[] elements = throwable.getStackTrace();
int pos = elements.length;
for (int i = elements.length - 1; i >= 0; i--) {
- if (elements[i].getClassName()
- .startsWith("org.apache.catalina.core.ApplicationFilterChain") &&
+ if (elements[i].getClassName().startsWith("org.apache.catalina.core.ApplicationFilterChain") &&
elements[i].getMethodName().equals("doFilter")) {
pos = i;
break;
@@ -130,8 +129,8 @@ public class JsonErrorReportValve extends ErrorReportValve {
}
for (int i = 0; i < pos; i++) {
if (!elements[i].getClassName().startsWith("org.apache.catalina.core.")) {
- sb.append(',').append('\"').append(' ')
- .append(JSONFilter.escape(elements[i].toString())).append('\"');
+ sb.append(',').append('\"').append(' ').append(JSONFilter.escape(elements[i].toString()))
+ .append('\"');
}
}
diff --git a/java/org/apache/catalina/valves/PersistentValve.java b/java/org/apache/catalina/valves/PersistentValve.java
index 31e047d748..c2e7f10f2d 100644
--- a/java/org/apache/catalina/valves/PersistentValve.java
+++ b/java/org/apache/catalina/valves/PersistentValve.java
@@ -50,8 +50,7 @@ import org.apache.juli.logging.LogFactory;
* <p>
* To avoid conflicts and/or errors when updating the session store, each session must only be accessed by no more than
* one concurrent request. The {@code filter} field can be used to define requests (e.g. those for static resources)
- * that do not need access to the session and can bypass the session load/save functionality
- * provided by this Valve.
+ * that do not need access to the session and can bypass the session load/save functionality provided by this Valve.
* <p>
* The Valve uses a per session {@code Semaphore} to ensure that each session is accessed by no more than one request at
* a time within a single Tomcat instance. The behaviour if multiple requests try to access the session concurrently can
@@ -147,8 +146,8 @@ public class PersistentValve extends ValveBase {
* Acquire the per session semaphore.
*/
if (sessionId != null) {
- semaphore = sessionToSemaphoreMap.compute(sessionId,
- (k, v) -> v == null ? new UsageCountingSemaphore(semaphoreFairness) : v.incrementUsageCount());
+ semaphore = sessionToSemaphoreMap.compute(sessionId, (k,
+ v) -> v == null ? new UsageCountingSemaphore(semaphoreFairness) : v.incrementUsageCount());
if (semaphoreBlockOnAcquire) {
if (semaphoreAcquireUninterruptibly) {
semaphore.acquireUninterruptibly();
@@ -226,8 +225,8 @@ public class PersistentValve extends ValveBase {
*/
if (!asyncOnEntry) {
AsyncContext asyncContext = request.getAsyncContext();
- asyncContext.addListener(
- new StoreSessionAsyncListener(request, context, sessionId, semaphore, mustReleaseSemaphore));
+ asyncContext.addListener(new StoreSessionAsyncListener(request, context, sessionId, semaphore,
+ mustReleaseSemaphore));
}
} else {
storeSession(request, context, sessionId, semaphore, mustReleaseSemaphore);
diff --git a/java/org/apache/catalina/valves/ProxyErrorReportValve.java b/java/org/apache/catalina/valves/ProxyErrorReportValve.java
index a813f51c9b..75ed77f3a5 100644
--- a/java/org/apache/catalina/valves/ProxyErrorReportValve.java
+++ b/java/org/apache/catalina/valves/ProxyErrorReportValve.java
@@ -124,8 +124,8 @@ public class ProxyErrorReportValve extends ErrorReportValve {
/**
* Reports the error by redirecting or proxying to the configured error URL.
*
- * @param request the servlet request
- * @param response the servlet response
+ * @param request the servlet request
+ * @param response the servlet response
* @param throwable the exception that caused the error, or {@code null}
*/
@Override
diff --git a/java/org/apache/catalina/valves/SSLValve.java b/java/org/apache/catalina/valves/SSLValve.java
index d87bd37608..f3db673ace 100644
--- a/java/org/apache/catalina/valves/SSLValve.java
+++ b/java/org/apache/catalina/valves/SSLValve.java
@@ -195,7 +195,8 @@ public class SSLValve extends ValveBase {
* Retrieves the value of the specified header from the request, handling null and "(null)" values.
*
* @param request The request object
- * @param header The header name to retrieve
+ * @param header The header name to retrieve
+ *
* @return The header value, or null if not present or equal to "(null)"
*/
public String mygetHeader(Request request, String header) {
diff --git a/java/org/apache/catalina/valves/StuckThreadDetectionValve.java b/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
index 9302697de5..92d9d868a9 100644
--- a/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
+++ b/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
@@ -279,8 +279,7 @@ public class StuckThreadDetectionValve extends ValveBase {
}
/**
- * Returns the total number of threads that have been interrupted
- * due to being stuck.
+ * Returns the total number of threads that have been interrupted due to being stuck.
*
* @return the count of interrupted threads
*/
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.