You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2024/05/03 07:19:41 UTC
(tomcat) 04/04: Code clean-up - formatting - no functional change
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
commit 942e0148ddbcb6735e17ec5037fdac2781d55ce9
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri May 3 08:18:29 2024 +0100
Code clean-up - formatting - no functional change
Re-applying formatting to previously formatted code
---
.../catalina/authenticator/AuthenticatorBase.java | 3 +-
.../catalina/authenticator/BasicAuthenticator.java | 4 +-
.../authenticator/SpnegoAuthenticator.java | 3 +-
java/org/apache/catalina/connector/Connector.java | 8 +-
.../org/apache/catalina/connector/InputBuffer.java | 4 +-
java/org/apache/catalina/connector/Request.java | 6 +-
java/org/apache/catalina/connector/Response.java | 1 -
.../catalina/core/ApplicationDispatcher.java | 3 +-
.../catalina/core/ApplicationFilterChain.java | 3 +-
.../catalina/core/ApplicationHttpRequest.java | 1 -
.../core/ApplicationSessionCookieConfig.java | 3 +-
.../catalina/core/OpenSSLLifecycleListener.java | 41 ++++----
.../core/PropertiesRoleMappingListener.java | 9 +-
java/org/apache/catalina/core/StandardContext.java | 7 +-
.../apache/catalina/core/StandardHostValve.java | 6 +-
java/org/apache/catalina/core/StandardServer.java | 11 +--
.../catalina/filters/CsrfPreventionFilter.java | 107 ++++++++-------------
java/org/apache/catalina/ha/CatalinaCluster.java | 1 +
java/org/apache/catalina/ha/ClusterManager.java | 7 +-
java/org/apache/catalina/ha/ClusterMessage.java | 2 +
.../apache/catalina/ha/deploy/FarmWarDeployer.java | 4 +-
.../ha/session/ClusterSessionListener.java | 1 +
.../apache/catalina/ha/session/DeltaSession.java | 2 +
.../catalina/ha/session/SessionMessageImpl.java | 1 +
.../apache/catalina/ha/tcp/ReplicationValve.java | 10 +-
.../apache/catalina/manager/StatusTransformer.java | 70 +++++++++-----
java/org/apache/catalina/mbeans/MBeanUtils.java | 5 +-
java/org/apache/catalina/realm/CombinedRealm.java | 3 +-
java/org/apache/catalina/realm/RealmBase.java | 19 ++--
.../apache/catalina/security/SecurityListener.java | 19 ++--
.../apache/catalina/session/DataSourceStore.java | 6 +-
.../startup/CatalinaBaseConfigurationSource.java | 3 +-
java/org/apache/catalina/startup/Tomcat.java | 9 +-
33 files changed, 196 insertions(+), 186 deletions(-)
diff --git a/java/org/apache/catalina/authenticator/AuthenticatorBase.java b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
index e52fa2f109..fc8b13cd7a 100644
--- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
+++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -975,7 +975,8 @@ public abstract class AuthenticatorBase extends ValveBase implements Authenticat
associate(ssoId, request.getSessionInternal(true));
if (log.isDebugEnabled()) {
- log.debug(sm.getString("authenticator.reauthentication", request.getUserPrincipal().getName(), request.getAuthType()));
+ log.debug(sm.getString("authenticator.reauthentication", request.getUserPrincipal().getName(),
+ request.getAuthType()));
}
}
diff --git a/java/org/apache/catalina/authenticator/BasicAuthenticator.java b/java/org/apache/catalina/authenticator/BasicAuthenticator.java
index 8421dc54b1..17c4a85857 100644
--- a/java/org/apache/catalina/authenticator/BasicAuthenticator.java
+++ b/java/org/apache/catalina/authenticator/BasicAuthenticator.java
@@ -145,8 +145,8 @@ public class BasicAuthenticator extends AuthenticatorBase {
/**
* Parse the HTTP Authorization header for BASIC authentication as per RFC 7617.
*
- * @param input The header value to parse in-place
- * @param charset The character set to use to convert the bytes to a string
+ * @param input The header value to parse in-place
+ * @param charset The character set to use to convert the bytes to a string
*
* @throws IllegalArgumentException If the header does not conform to RFC 7617
*/
diff --git a/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java b/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java
index dab5cdfed3..9e4537ce0c 100644
--- a/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java
+++ b/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java
@@ -266,7 +266,8 @@ public class SpnegoAuthenticator extends AuthenticatorBase {
}
// Send response token on success and failure
- response.setHeader(AUTH_HEADER_NAME, AUTH_HEADER_VALUE_NEGOTIATE + " " + Base64.getEncoder().encodeToString(outToken));
+ response.setHeader(AUTH_HEADER_NAME,
+ AUTH_HEADER_VALUE_NEGOTIATE + " " + Base64.getEncoder().encodeToString(outToken));
if (principal != null) {
register(request, response, principal, Constants.SPNEGO_METHOD, principal.getName(), null);
diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java
index 64de9046cc..f2c6df6635 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -1009,14 +1009,14 @@ public class Connector extends LifecycleMBeanBase {
setParseBodyMethods(getParseBodyMethods());
}
- if (JreCompat.isJre22Available() && OpenSSLStatus.getUseOpenSSL() && OpenSSLStatus.isAvailable()
- && protocolHandler instanceof AbstractHttp11Protocol) {
+ if (JreCompat.isJre22Available() && OpenSSLStatus.getUseOpenSSL() && OpenSSLStatus.isAvailable() &&
+ protocolHandler instanceof AbstractHttp11Protocol) {
// Use FFM and OpenSSL if available
AbstractHttp11Protocol<?> jsseProtocolHandler = (AbstractHttp11Protocol<?>) protocolHandler;
if (jsseProtocolHandler.isSSLEnabled() && jsseProtocolHandler.getSslImplementationName() == null) {
// OpenSSL is compatible with the JSSE configuration, so use it if it is available
- jsseProtocolHandler.setSslImplementationName
- ("org.apache.tomcat.util.net.openssl.panama.OpenSSLImplementation");
+ jsseProtocolHandler
+ .setSslImplementationName("org.apache.tomcat.util.net.openssl.panama.OpenSSLImplementation");
}
} else if (AprStatus.isAprAvailable() && AprStatus.getUseOpenSSL() &&
protocolHandler instanceof AbstractHttp11Protocol) {
diff --git a/java/org/apache/catalina/connector/InputBuffer.java b/java/org/apache/catalina/connector/InputBuffer.java
index da8fa7fd98..45d64bc8e5 100644
--- a/java/org/apache/catalina/connector/InputBuffer.java
+++ b/java/org/apache/catalina/connector/InputBuffer.java
@@ -308,7 +308,7 @@ public class InputBuffer extends Reader implements ByteChunk.ByteInputChannel, A
if (e instanceof SocketTimeoutException) {
try {
response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT);
- } catch(IllegalStateException ex) {
+ } catch (IllegalStateException ex) {
// Response already committed
response.setStatus(HttpServletResponse.SC_REQUEST_TIMEOUT);
response.setError();
@@ -316,7 +316,7 @@ public class InputBuffer extends Reader implements ByteChunk.ByteInputChannel, A
} else {
try {
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
- } catch(IllegalStateException ex) {
+ } catch (IllegalStateException ex) {
// Response already committed
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.setError();
diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java
index 6bf0f0a940..b100a02414 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -901,9 +901,9 @@ public class Request implements HttpServletRequest {
/**
* {@inheritDoc}
* <p>
- * The attribute names returned will only be those for the attributes set via
- * {@link #setAttribute(String, Object)}. Tomcat internal attributes will not be included although they are
- * accessible via {@link #getAttribute(String)}. The Tomcat internal attributes include:
+ * The attribute names returned will only be those for the attributes set via {@link #setAttribute(String, Object)}.
+ * Tomcat internal attributes will not be included although they are accessible via {@link #getAttribute(String)}.
+ * The Tomcat internal attributes include:
* <ul>
* <li>{@link Globals#DISPATCHER_TYPE_ATTR}</li>
* <li>{@link Globals#DISPATCHER_REQUEST_PATH_ATTR}</li>
diff --git a/java/org/apache/catalina/connector/Response.java b/java/org/apache/catalina/connector/Response.java
index a0d7c8d932..bfbaffb123 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -153,7 +153,6 @@ public class Response implements HttpServletResponse {
}
-
// --------------------------------------------------------- Public Methods
/**
diff --git a/java/org/apache/catalina/core/ApplicationDispatcher.java b/java/org/apache/catalina/core/ApplicationDispatcher.java
index 245a1a85ea..22f0d439a2 100644
--- a/java/org/apache/catalina/core/ApplicationDispatcher.java
+++ b/java/org/apache/catalina/core/ApplicationDispatcher.java
@@ -289,8 +289,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
if (response instanceof ResponseFacade) {
finished = true;
((ResponseFacade) response).finish();
- } else if (context.getSuspendWrappedResponseAfterForward()
- && response instanceof ServletResponseWrapper) {
+ } else if (context.getSuspendWrappedResponseAfterForward() && response instanceof ServletResponseWrapper) {
ServletResponse baseResponse = response;
do {
baseResponse = ((ServletResponseWrapper) baseResponse).getResponse();
diff --git a/java/org/apache/catalina/core/ApplicationFilterChain.java b/java/org/apache/catalina/core/ApplicationFilterChain.java
index 9d4a3a3437..675aac9d65 100644
--- a/java/org/apache/catalina/core/ApplicationFilterChain.java
+++ b/java/org/apache/catalina/core/ApplicationFilterChain.java
@@ -103,8 +103,7 @@ public final class ApplicationFilterChain implements FilterChain {
try {
Filter filter = filterConfig.getFilter();
- if (request.isAsyncSupported() &&
- !(filterConfig.getFilterDef().getAsyncSupportedBoolean())) {
+ if (request.isAsyncSupported() && !(filterConfig.getFilterDef().getAsyncSupportedBoolean())) {
request.setAttribute(Globals.ASYNC_SUPPORTED_ATTR, Boolean.FALSE);
}
filter.doFilter(request, response, this);
diff --git a/java/org/apache/catalina/core/ApplicationHttpRequest.java b/java/org/apache/catalina/core/ApplicationHttpRequest.java
index 814ee277e8..3438a4bc0e 100644
--- a/java/org/apache/catalina/core/ApplicationHttpRequest.java
+++ b/java/org/apache/catalina/core/ApplicationHttpRequest.java
@@ -379,7 +379,6 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
}
-
@Override
public String getMethod() {
return method;
diff --git a/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java b/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java
index 97a001b95f..732e843d20 100644
--- a/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java
+++ b/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java
@@ -221,8 +221,7 @@ public class ApplicationSessionCookieConfig implements SessionCookieConfig {
cookie.setHttpOnly(true);
}
- cookie.setAttribute(Constants.COOKIE_PARTITIONED_ATTR,
- Boolean.toString(context.getUsePartitioned()));
+ cookie.setAttribute(Constants.COOKIE_PARTITIONED_ATTR, Boolean.toString(context.getUsePartitioned()));
cookie.setPath(SessionConfig.getSessionCookiePath(context));
diff --git a/java/org/apache/catalina/core/OpenSSLLifecycleListener.java b/java/org/apache/catalina/core/OpenSSLLifecycleListener.java
index 477ca41317..5b0ea02531 100644
--- a/java/org/apache/catalina/core/OpenSSLLifecycleListener.java
+++ b/java/org/apache/catalina/core/OpenSSLLifecycleListener.java
@@ -29,12 +29,10 @@ import org.apache.tomcat.util.net.openssl.OpenSSLStatus;
import org.apache.tomcat.util.res.StringManager;
-
/**
- * Implementation of <code>LifecycleListener</code> that will do the global
- * initialization of OpenSSL according to specified configuration parameters.
- * Using the listener is completely optional, but is needed for configuration
- * and full cleanup of a few native memory allocations.
+ * Implementation of <code>LifecycleListener</code> that will do the global initialization of OpenSSL according to
+ * specified configuration parameters. Using the listener is completely optional, but is needed for configuration and
+ * full cleanup of a few native memory allocations.
*/
public class OpenSSLLifecycleListener implements LifecycleListener {
@@ -55,7 +53,8 @@ public class OpenSSLLifecycleListener implements LifecycleListener {
OpenSSLStatus.setInitialized(true);
} else {
try {
- Class<?> openSSLLibraryClass = Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
+ Class<?> openSSLLibraryClass =
+ Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
openSSLLibraryClass.getMethod("init").invoke(null);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
@@ -85,8 +84,7 @@ public class OpenSSLLifecycleListener implements LifecycleListener {
boolean initError = false;
if (Lifecycle.BEFORE_INIT_EVENT.equals(event.getType())) {
if (!(event.getLifecycle() instanceof Server)) {
- log.warn(sm.getString("listener.notServer",
- event.getLifecycle().getClass().getSimpleName()));
+ log.warn(sm.getString("listener.notServer", event.getLifecycle().getClass().getSimpleName()));
}
synchronized (lock) {
if (!JreCompat.isJre22Available()) {
@@ -95,7 +93,8 @@ public class OpenSSLLifecycleListener implements LifecycleListener {
return;
}
try {
- Class<?> openSSLLibraryClass = Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
+ Class<?> openSSLLibraryClass =
+ Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
openSSLLibraryClass.getMethod("init").invoke(null);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
@@ -120,7 +119,8 @@ public class OpenSSLLifecycleListener implements LifecycleListener {
}
// Note: Without the listener, destroy will never be called (which is not a significant problem)
try {
- Class<?> openSSLLibraryClass = Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
+ Class<?> openSSLLibraryClass =
+ Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
openSSLLibraryClass.getMethod("destroy").invoke(null);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
@@ -135,7 +135,8 @@ public class OpenSSLLifecycleListener implements LifecycleListener {
public String getSSLEngine() {
if (JreCompat.isJre22Available()) {
try {
- Class<?> openSSLLibraryClass = Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
+ Class<?> openSSLLibraryClass =
+ Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
return (String) openSSLLibraryClass.getMethod("getSSLEngine").invoke(null);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
@@ -148,7 +149,8 @@ public class OpenSSLLifecycleListener implements LifecycleListener {
public void setSSLEngine(String SSLEngine) {
if (JreCompat.isJre22Available()) {
try {
- Class<?> openSSLLibraryClass = Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
+ Class<?> openSSLLibraryClass =
+ Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
openSSLLibraryClass.getMethod("setSSLEngine").invoke(null, SSLEngine);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
@@ -160,7 +162,8 @@ public class OpenSSLLifecycleListener implements LifecycleListener {
public String getSSLRandomSeed() {
if (JreCompat.isJre22Available()) {
try {
- Class<?> openSSLLibraryClass = Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
+ Class<?> openSSLLibraryClass =
+ Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
return (String) openSSLLibraryClass.getMethod("getSSLRandomSeed").invoke(null);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
@@ -173,7 +176,8 @@ public class OpenSSLLifecycleListener implements LifecycleListener {
public void setSSLRandomSeed(String SSLRandomSeed) {
if (JreCompat.isJre22Available()) {
try {
- Class<?> openSSLLibraryClass = Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
+ Class<?> openSSLLibraryClass =
+ Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
openSSLLibraryClass.getMethod("setSSLRandomSeed").invoke(null, SSLRandomSeed);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
@@ -185,7 +189,8 @@ public class OpenSSLLifecycleListener implements LifecycleListener {
public String getFIPSMode() {
if (JreCompat.isJre22Available()) {
try {
- Class<?> openSSLLibraryClass = Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
+ Class<?> openSSLLibraryClass =
+ Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
return (String) openSSLLibraryClass.getMethod("getFIPSMode").invoke(null);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
@@ -198,7 +203,8 @@ public class OpenSSLLifecycleListener implements LifecycleListener {
public void setFIPSMode(String FIPSMode) {
if (JreCompat.isJre22Available()) {
try {
- Class<?> openSSLLibraryClass = Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
+ Class<?> openSSLLibraryClass =
+ Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
openSSLLibraryClass.getMethod("setFIPSMode").invoke(null, FIPSMode);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
@@ -210,7 +216,8 @@ public class OpenSSLLifecycleListener implements LifecycleListener {
public boolean isFIPSModeActive() {
if (JreCompat.isJre22Available()) {
try {
- Class<?> openSSLLibraryClass = Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
+ Class<?> openSSLLibraryClass =
+ Class.forName("org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary");
return ((Boolean) openSSLLibraryClass.getMethod("isFIPSModeActive").invoke(null)).booleanValue();
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
diff --git a/java/org/apache/catalina/core/PropertiesRoleMappingListener.java b/java/org/apache/catalina/core/PropertiesRoleMappingListener.java
index 00ddc5b4af..ead567886e 100644
--- a/java/org/apache/catalina/core/PropertiesRoleMappingListener.java
+++ b/java/org/apache/catalina/core/PropertiesRoleMappingListener.java
@@ -37,8 +37,8 @@ import org.apache.tomcat.util.res.StringManager;
* This listener must only be nested within {@link Context} elements.
* <p>
* The keys represent application roles (e.g., admin, user, uservisor, etc.) while the values represent technical roles
- * (e.g., DNs, SIDs, UUIDs, etc.). A key can also be prefixed if, e.g., the properties file contains generic
- * application configuration as well: {@code app-roles.}.
+ * (e.g., DNs, SIDs, UUIDs, etc.). A key can also be prefixed if, e.g., the properties file contains generic application
+ * configuration as well: {@code app-roles.}.
* <p>
* Note: The default value for the {@code roleMappingFile} is {@code webapp:/WEB-INF/role-mapping.properties}.
*/
@@ -60,7 +60,8 @@ public class PropertiesRoleMappingListener implements LifecycleListener {
* {@link ConfigFileLoader} supports.
*
* @param roleMappingFile the role mapping properties file to load from
- * @throws NullPointerException if roleMappingFile is null
+ *
+ * @throws NullPointerException if roleMappingFile is null
* @throws IllegalArgumentException if roleMappingFile is empty
*/
public void setRoleMappingFile(String roleMappingFile) {
@@ -116,7 +117,7 @@ public class PropertiesRoleMappingListener implements LifecycleListener {
}
int linkCount = 0;
- for (Entry<Object, Object> prop : props.entrySet()) {
+ for (Entry<Object,Object> prop : props.entrySet()) {
String role = (String) prop.getKey();
if (keyPrefix != null) {
diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java
index 4879e90244..27406d6a86 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -2129,8 +2129,8 @@ public class StandardContext extends ContainerBase implements Context, Notificat
@Override
public ServletContext getServletContext() {
/*
- * This method is called (multiple times) during context start which is single threaded so there is concurrency
- * issue here.
+ * This method is called (multiple times) during context start which is single threaded so there is concurrency
+ * issue here.
*/
if (context == null) {
context = new ApplicationContext(this);
@@ -5698,8 +5698,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
}
@Override
- public FilterRegistration.Dynamic addFilter(String filterName,
- Class<? extends Filter> filterClass) {
+ public FilterRegistration.Dynamic addFilter(String filterName, Class<? extends Filter> filterClass) {
throw new UnsupportedOperationException(sm.getString("noPluggabilityServletContext.notAllowed"));
}
diff --git a/java/org/apache/catalina/core/StandardHostValve.java b/java/org/apache/catalina/core/StandardHostValve.java
index a67ec0d2bf..ba818e9534 100644
--- a/java/org/apache/catalina/core/StandardHostValve.java
+++ b/java/org/apache/catalina/core/StandardHostValve.java
@@ -298,9 +298,9 @@ final class StandardHostValve extends ValveBase {
}
} else {
/*
- * A custom error-page has not been defined for the exception that was thrown during request processing.
- * Set the status to 500 if an error status has not already been set and check for custom error-page for
- * the status.
+ * A custom error-page has not been defined for the exception that was thrown during request processing. Set
+ * the status to 500 if an error status has not already been set and check for custom error-page for the
+ * status.
*/
if (response.getStatus() < HttpServletResponse.SC_BAD_REQUEST) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
diff --git a/java/org/apache/catalina/core/StandardServer.java b/java/org/apache/catalina/core/StandardServer.java
index 241c57ed1a..bc180007c6 100644
--- a/java/org/apache/catalina/core/StandardServer.java
+++ b/java/org/apache/catalina/core/StandardServer.java
@@ -931,8 +931,7 @@ public final class StandardServer extends LifecycleMBeanBase implements Server {
/**
* {@inheritDoc}
* <p>
- * This is used to allow connectors to bind to restricted ports under Unix
- * operating environments.
+ * This is used to allow connectors to bind to restricted ports under Unix operating environments.
*/
@Override
protected void initInternal() throws LifecycleException {
@@ -999,10 +998,10 @@ public final class StandardServer extends LifecycleMBeanBase implements Server {
/**
* @return the MBean domain for this server. The domain is obtained using the following search order:
- * <ol>
- * <li>Name of first {@link org.apache.catalina.Engine}.</li>
- * <li>Name of first {@link Service}.</li>
- * </ol>
+ * <ol>
+ * <li>Name of first {@link org.apache.catalina.Engine}.</li>
+ * <li>Name of first {@link Service}.</li>
+ * </ol>
*/
@Override
protected String getDomainInternal() {
diff --git a/java/org/apache/catalina/filters/CsrfPreventionFilter.java b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
index 8a172702dc..93f53f18a3 100644
--- a/java/org/apache/catalina/filters/CsrfPreventionFilter.java
+++ b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
@@ -49,33 +49,26 @@ import org.apache.juli.logging.LogFactory;
* <li>{@link HttpServletResponse#encodeRedirectURL(String)} and {@link HttpServletResponse#encodeURL(String)} are used
* to encode all URLs returned to the client
* </ul>
- *
* <p>
- * CSRF protection is enabled by generating random nonce values which are
- * stored in the client's HTTP session. Each URL encoded using
- * {@link HttpServletResponse#encodeURL(String)} has a URL parameter added
- * which, when sent to the server in a future request, will be checked
- * against this stored set of nonces for validity.
+ * CSRF protection is enabled by generating random nonce values which are stored in the client's HTTP session. Each URL
+ * encoded using {@link HttpServletResponse#encodeURL(String)} has a URL parameter added which, when sent to the server
+ * in a future request, will be checked against this stored set of nonces for validity.
* </p>
- *
* <p>
- * Some URLs should be accessible even without a valid nonce parameter value.
- * These URLs are known as "entry points" because clients should be able to
- * "enter" the application without first establishing any valid tokens. These
- * are configured with the <code>entryPoints</code> filter
- * <code>init-param</code>.
+ * Some URLs should be accessible even without a valid nonce parameter value. These URLs are known as "entry points"
+ * because clients should be able to "enter" the application without first establishing any valid tokens. These are
+ * configured with the <code>entryPoints</code> filter <code>init-param</code>.
* </p>
- *
* <p>
- * Some URLs should not have nonce parameters added to them at all
+ * Some URLs should not have nonce parameters added to them at all
*/
public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
/**
* The default set of URL patterns for which nonces will not be appended.
*/
- private static final String DEFAULT_NO_NONCE_URL_PATTERNS
- = "*.css, *.js, *.gif, *.png, *.jpg, *.svg, *.ico, *.jpeg, *.mjs";
+ private static final String DEFAULT_NO_NONCE_URL_PATTERNS =
+ "*.css, *.js, *.gif, *.png, *.jpg, *.svg, *.ico, *.jpeg, *.mjs";
/**
* The servlet context in which this Filter is operating.
@@ -91,14 +84,12 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
private String nonceRequestParameterName = Constants.CSRF_NONCE_REQUEST_PARAM;
/**
- * Flag which determines whether this Filter is in "enforcement" mode
- * (the default) or in "reporting" mode.
+ * Flag which determines whether this Filter is in "enforcement" mode (the default) or in "reporting" mode.
*/
private boolean enforce = true;
/**
- * A set of comma-separated URL patterns which will have no nonce
- * parameters added to them.
+ * A set of comma-separated URL patterns which will have no nonce parameters added to them.
*/
private String noNoncePatterns = DEFAULT_NO_NONCE_URL_PATTERNS;
@@ -139,43 +130,34 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
}
/**
- * Sets the flag to enforce CSRF protection or just log failures as DEBUG
- * messages.
+ * Sets the flag to enforce CSRF protection or just log failures as DEBUG messages.
*
- * @param enforce <code>true</code> to enforce CSRF protection or
- * <code>false</code> to log DEBUG messages and allow
- * all requests.
+ * @param enforce <code>true</code> to enforce CSRF protection or <code>false</code> to log DEBUG messages and allow
+ * all requests.
*/
public void setEnforce(boolean enforce) {
this.enforce = enforce;
}
/**
- * Gets the flag to enforce CSRF protection or just log failures as DEBUG
- * messages.
+ * Gets the flag to enforce CSRF protection or just log failures as DEBUG messages.
*
- * @return <code>true</code> if CSRF protection will be enforced or
- * <code>false</code> if all requests will be allowed and
- * failures will be logged as DEBUG messages.
+ * @return <code>true</code> if CSRF protection will be enforced or <code>false</code> if all requests will be
+ * allowed and failures will be logged as DEBUG messages.
*/
public boolean isEnforce() {
return this.enforce;
}
/**
- * Sets the list of URL patterns to suppress nonce-addition for.
+ * Sets the list of URL patterns to suppress nonce-addition for. Some URLs do not need nonces added to them such as
+ * static resources. By <i>not</i> adding nonces to those URLs, HTTP caches can be more effective because the CSRF
+ * prevention filter won't generate what look like unique URLs for those commonly-reused resources.
*
- * Some URLs do not need nonces added to them such as static resources.
- * By <i>not</i> adding nonces to those URLs, HTTP caches can be more
- * effective because the CSRF prevention filter won't generate what
- * look like unique URLs for those commonly-reused resources.
- *
- * @param patterns A comma-separated list of URL patterns that will not
- * have nonces added to them. Patterns may begin or end with a
- * <code>*</code> character to denote a suffix-match or
- * prefix-match. Any matched URL will not have a CSRF nonce
- * added to it when passed through
- * {@link HttpServletResponse#encodeURL(String)}.
+ * @param patterns A comma-separated list of URL patterns that will not have nonces added to them. Patterns may
+ * begin or end with a <code>*</code> character to denote a suffix-match or prefix-match. Any
+ * matched URL will not have a CSRF nonce added to it when passed through
+ * {@link HttpServletResponse#encodeURL(String)}.
*/
public void setNoNonceURLPatterns(String patterns) {
this.noNoncePatterns = patterns;
@@ -188,7 +170,7 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
/**
* Creates a collection of matchers from a comma-separated string of patterns.
*
- * @param context the Servlet context
+ * @param context the Servlet context
* @param patterns A comma-separated string of URL matching patterns.
*
* @return A collection of predicates representing the URL patterns.
@@ -222,11 +204,9 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
* Creates a predicate that can match the specified type of pattern.
*
* @param context the Servlet context
- * @param pattern The pattern to match e.g. <code>*.foo</code> or
- * <code>/bar/*</code>.
+ * @param pattern The pattern to match e.g. <code>*.foo</code> or <code>/bar/*</code>.
*
- * @return A Predicate which can match the specified pattern, or
- * <code>null</code> if the pattern is null or blank.
+ * @return A Predicate which can match the specified pattern, or <code>null</code> if the pattern is null or blank.
*/
protected static Predicate<String> createNoNoncePredicate(ServletContext context, String pattern) {
if (null == pattern || 0 == pattern.trim().length()) {
@@ -246,10 +226,8 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
}
/**
- * A no-nonce Predicate that evaluates a MIME type instead of a URL.
- *
- * It can be used with any other Predicate for matching
- * the actual value of the MIME type.
+ * A no-nonce Predicate that evaluates a MIME type instead of a URL. It can be used with any other Predicate for
+ * matching the actual value of the MIME type.
*/
protected static class MimePredicate implements Predicate<String> {
private final ServletContext context;
@@ -277,6 +255,7 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
*/
protected static class PrefixPredicate implements Predicate<String> {
private final String prefix;
+
public PrefixPredicate(String prefix) {
this.prefix = prefix;
}
@@ -292,6 +271,7 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
*/
protected static class SuffixPredicate implements Predicate<String> {
private final String suffix;
+
public SuffixPredicate(String suffix) {
this.suffix = suffix;
}
@@ -381,7 +361,8 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
} else {
if (log.isTraceEnabled()) {
log.trace("Would have rejecting request for " + getRequestedPath(req) + ", session " +
- (null == session ? "(null)" : session.getId()) + " due to empty / missing nonce cache");
+ (null == session ? "(null)" : session.getId()) +
+ " due to empty / missing nonce cache");
}
}
} else if (!nonceCache.contains(previousNonce)) {
@@ -402,8 +383,8 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
}
} else {
if (log.isTraceEnabled()) {
- log.trace(
- "Allowing request to " + getRequestedPath(req) + " with valid CSRF nonce " + previousNonce);
+ log.trace("Allowing request to " + getRequestedPath(req) + " with valid CSRF nonce " +
+ previousNonce);
}
}
}
@@ -448,19 +429,15 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
}
/**
- * Check to see if the request and path should be enforced or only
- * observed and reported.
- *
- * Note that the <code>requestedPath</code> parameter is purely
- * a performance optimization to avoid calling
+ * Check to see if the request and path should be enforced or only observed and reported. Note that the
+ * <code>requestedPath</code> parameter is purely a performance optimization to avoid calling
* {@link #getRequestedPath(HttpServletRequest)} multiple times.
*
- * @param req The request.
+ * @param req The request.
* @param requestedPath The path of the request being evaluated.
*
- * @return <code>true</code> if the CSRF prevention should be enforced,
- * <code>false</code> if the CSRF prevention should only be
- * logged in DEBUG mode.
+ * @return <code>true</code> if the CSRF prevention should be enforced, <code>false</code> if the CSRF prevention
+ * should only be logged in DEBUG mode.
*/
protected boolean enforce(HttpServletRequest req, String requestedPath) {
return isEnforce();
@@ -556,8 +533,8 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
private final String nonce;
private final Collection<Predicate<String>> noNoncePatterns;
- public CsrfResponseWrapper(HttpServletResponse response, String nonceRequestParameterName,
- String nonce, Collection<Predicate<String>> noNoncePatterns) {
+ public CsrfResponseWrapper(HttpServletResponse response, String nonceRequestParameterName, String nonce,
+ Collection<Predicate<String>> noNoncePatterns) {
super(response);
this.nonceRequestParameterName = nonceRequestParameterName;
this.nonce = nonce;
diff --git a/java/org/apache/catalina/ha/CatalinaCluster.java b/java/org/apache/catalina/ha/CatalinaCluster.java
index 11fd69996a..1c0a2a2dc5 100644
--- a/java/org/apache/catalina/ha/CatalinaCluster.java
+++ b/java/org/apache/catalina/ha/CatalinaCluster.java
@@ -133,6 +133,7 @@ public interface CatalinaCluster extends Cluster {
/**
* Set the channel associated with the cluster.
+ *
* @param channel the channel
*/
void setChannel(Channel channel);
diff --git a/java/org/apache/catalina/ha/ClusterManager.java b/java/org/apache/catalina/ha/ClusterManager.java
index c8bb510aa3..586f2c9bae 100644
--- a/java/org/apache/catalina/ha/ClusterManager.java
+++ b/java/org/apache/catalina/ha/ClusterManager.java
@@ -83,6 +83,7 @@ public interface ClusterManager extends Manager {
/**
* Set the cluster associated with this manager.
+ *
* @param cluster the cluster
*/
void setCluster(CatalinaCluster cluster);
@@ -91,7 +92,9 @@ public interface ClusterManager extends Manager {
* Open stream and use correct ClassLoader (Container), switching thread context class loader.
*
* @param data the data
+ *
* @return the object input stream
+ *
* @throws IOException An error occurred
*/
ReplicationStream getReplicationStream(byte[] data) throws IOException;
@@ -99,10 +102,12 @@ public interface ClusterManager extends Manager {
/**
* Open stream and use correct ClassLoader (Container), switching thread context class loader.
*
- * @param data the data
+ * @param data the data
* @param offset the offset in the data array
* @param length the data length
+ *
* @return the object input stream
+ *
* @throws IOException An error occurred
*/
ReplicationStream getReplicationStream(byte[] data, int offset, int length) throws IOException;
diff --git a/java/org/apache/catalina/ha/ClusterMessage.java b/java/org/apache/catalina/ha/ClusterMessage.java
index 34aed3b286..14bf5e3e43 100644
--- a/java/org/apache/catalina/ha/ClusterMessage.java
+++ b/java/org/apache/catalina/ha/ClusterMessage.java
@@ -28,6 +28,7 @@ public interface ClusterMessage extends Serializable {
/**
* Set the member associated with the message.
+ *
* @param member the member
*/
void setAddress(Member member);
@@ -44,6 +45,7 @@ public interface ClusterMessage extends Serializable {
/**
* Set the timestamp for this message.
+ *
* @param timestamp the timestamp
*/
void setTimestamp(long timestamp);
diff --git a/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java b/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
index 212bc93dac..085404cc3c 100644
--- a/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
+++ b/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
@@ -228,7 +228,8 @@ public class FarmWarDeployer extends ClusterListener implements ClusterDeployer,
Files.move(factory.getFile().toPath(), deployable.toPath());
} catch (IOException ioe) {
- log.error(sm.getString("farmWarDeployer.renameFail", factory.getFile(), deployable), ioe);
+ log.error(sm.getString("farmWarDeployer.renameFail", factory.getFile(), deployable),
+ ioe);
} finally {
removeServiced(contextName);
}
@@ -305,6 +306,7 @@ public class FarmWarDeployer extends ClusterListener implements ClusterDeployer,
/**
* {@inheritDoc}
+ * <p>
* This listener accepts only FileMessage or UndeployMessage.
*/
@Override
diff --git a/java/org/apache/catalina/ha/session/ClusterSessionListener.java b/java/org/apache/catalina/ha/session/ClusterSessionListener.java
index e4a7a3e2f4..eb85f88f13 100644
--- a/java/org/apache/catalina/ha/session/ClusterSessionListener.java
+++ b/java/org/apache/catalina/ha/session/ClusterSessionListener.java
@@ -87,6 +87,7 @@ public class ClusterSessionListener extends ClusterListener {
/**
* {@inheritDoc}
+ * <p>
* This listener accepts only SessionMessage.
*/
@Override
diff --git a/java/org/apache/catalina/ha/session/DeltaSession.java b/java/org/apache/catalina/ha/session/DeltaSession.java
index f8ef3b7c7c..2cba31e3e4 100644
--- a/java/org/apache/catalina/ha/session/DeltaSession.java
+++ b/java/org/apache/catalina/ha/session/DeltaSession.java
@@ -546,7 +546,9 @@ public class DeltaSession extends StandardSession implements Externalizable, Clu
/**
* Get the request.
+ *
* @return the request
+ *
* @deprecated Unused. This method will be removed in Tomcat 12.
*/
@Deprecated
diff --git a/java/org/apache/catalina/ha/session/SessionMessageImpl.java b/java/org/apache/catalina/ha/session/SessionMessageImpl.java
index 70f8e01e44..c3b8d2713f 100644
--- a/java/org/apache/catalina/ha/session/SessionMessageImpl.java
+++ b/java/org/apache/catalina/ha/session/SessionMessageImpl.java
@@ -101,6 +101,7 @@ public class SessionMessageImpl extends ClusterMessageBase implements SessionMes
/**
* Set message send time but only the first setting works (one shot)
+ *
* @param time the timestamp
*/
@Override
diff --git a/java/org/apache/catalina/ha/tcp/ReplicationValve.java b/java/org/apache/catalina/ha/tcp/ReplicationValve.java
index 6ff8bf325a..5e2257f74c 100644
--- a/java/org/apache/catalina/ha/tcp/ReplicationValve.java
+++ b/java/org/apache/catalina/ha/tcp/ReplicationValve.java
@@ -537,7 +537,7 @@ public class ReplicationValve extends ValveBase implements ClusterValve {
*
* @param requestTime Request time
* @param clusterTime Cluster time
- * @param isAsync if the request was in async mode
+ * @param isAsync if the request was in async mode
*/
protected void updateStats(long requestTime, long clusterTime, boolean isAsync) {
long currentTime = System.currentTimeMillis();
@@ -550,9 +550,11 @@ public class ReplicationValve extends ValveBase implements ClusterValve {
if ((nrOfRequests.longValue() % 100) == 0) {
log.debug(sm.getString("ReplicationValve.stats",
new Object[] { Long.valueOf(totalRequestTime.longValue() / nrOfRequests.longValue()),
- Long.valueOf(totalSendTime.longValue() / nrOfRequests.longValue()), Long.valueOf(nrOfRequests.longValue()),
- Long.valueOf(nrOfSendRequests.longValue()), Long.valueOf(nrOfCrossContextSendRequests.longValue()),
- Long.valueOf(nrOfFilterRequests.longValue()), Long.valueOf(totalRequestTime.longValue()),
+ Long.valueOf(totalSendTime.longValue() / nrOfRequests.longValue()),
+ Long.valueOf(nrOfRequests.longValue()), Long.valueOf(nrOfSendRequests.longValue()),
+ Long.valueOf(nrOfCrossContextSendRequests.longValue()),
+ Long.valueOf(nrOfFilterRequests.longValue()),
+ Long.valueOf(totalRequestTime.longValue()),
Long.valueOf(totalSendTime.longValue()) }));
}
}
diff --git a/java/org/apache/catalina/manager/StatusTransformer.java b/java/org/apache/catalina/manager/StatusTransformer.java
index d6719d70b9..bef7f8edb7 100644
--- a/java/org/apache/catalina/manager/StatusTransformer.java
+++ b/java/org/apache/catalina/manager/StatusTransformer.java
@@ -273,8 +273,7 @@ public class StatusTransformer {
*
* @throws Exception Propagated JMX error
*/
- public static void writeConnectorsState(PrintWriter writer, MBeanServer mBeanServer,
- List<ObjectName> threadPools,
+ public static void writeConnectorsState(PrintWriter writer, MBeanServer mBeanServer, List<ObjectName> threadPools,
List<ObjectName> globalRequestProcessors, List<ObjectName> requestProcessors, int mode, Object[] args)
throws Exception {
if (mode == 2) {
@@ -292,8 +291,8 @@ public class StatusTransformer {
}
String name = objectName.getKeyProperty("name");
// use StatusTransformer to output status
- writeConnectorState(
- writer, objectName, name, mBeanServer, globalRequestProcessors, requestProcessors, mode, args);
+ writeConnectorState(writer, objectName, name, mBeanServer, globalRequestProcessors, requestProcessors, mode,
+ args);
}
if (mode == 2) {
writer.append(']');
@@ -447,9 +446,12 @@ public class StatusTransformer {
}
appendJSonValue(writer, "name", jsonName).append(',').println();
indent(writer, 3).append('"').append("threadInfo").append('"').append(':').append('{');
- appendJSonValue(writer, "maxThreads", mBeanServer.getAttribute(tpName, "maxThreads").toString()).append(',');
- appendJSonValue(writer, "currentThreadCount", mBeanServer.getAttribute(tpName, "currentThreadCount").toString()).append(',');
- appendJSonValue(writer, "currentThreadsBusy", mBeanServer.getAttribute(tpName, "currentThreadsBusy").toString());
+ appendJSonValue(writer, "maxThreads", mBeanServer.getAttribute(tpName, "maxThreads").toString())
+ .append(',');
+ appendJSonValue(writer, "currentThreadCount",
+ mBeanServer.getAttribute(tpName, "currentThreadCount").toString()).append(',');
+ appendJSonValue(writer, "currentThreadsBusy",
+ mBeanServer.getAttribute(tpName, "currentThreadsBusy").toString());
writer.append('}');
ObjectName grpName = null;
@@ -464,10 +466,14 @@ public class StatusTransformer {
writer.append(',').println();
indent(writer, 3).append('"').append("requestInfo").append('"').append(':').append('{');
appendJSonValue(writer, "maxTime", mBeanServer.getAttribute(grpName, "maxTime").toString()).append(',');
- appendJSonValue(writer, "processingTime", mBeanServer.getAttribute(grpName, "processingTime").toString()).append(',');
- appendJSonValue(writer, "requestCount", mBeanServer.getAttribute(grpName, "requestCount").toString()).append(',');
- appendJSonValue(writer, "errorCount", mBeanServer.getAttribute(grpName, "errorCount").toString()).append(',');
- appendJSonValue(writer, "bytesReceived", mBeanServer.getAttribute(grpName, "bytesReceived").toString()).append(',');
+ appendJSonValue(writer, "processingTime",
+ mBeanServer.getAttribute(grpName, "processingTime").toString()).append(',');
+ appendJSonValue(writer, "requestCount", mBeanServer.getAttribute(grpName, "requestCount").toString())
+ .append(',');
+ appendJSonValue(writer, "errorCount", mBeanServer.getAttribute(grpName, "errorCount").toString())
+ .append(',');
+ appendJSonValue(writer, "bytesReceived", mBeanServer.getAttribute(grpName, "bytesReceived").toString())
+ .append(',');
appendJSonValue(writer, "bytesSent", mBeanServer.getAttribute(grpName, "bytesSent").toString());
writer.append('}').println();
// Note: No detailed per processor info
@@ -810,8 +816,10 @@ public class StatusTransformer {
indent(writer, 2).append('{').println();
appendJSonValue(indent(writer, 3), "name", JSONFilter.escape(JSONFilter.escape(name))).append(',');
appendJSonValue(writer, "startTime",
- new Date(((Long) mBeanServer.getAttribute(objectName, "startTime")).longValue()).toString()).append(',');
- appendJSonValue(writer, "startupTime", mBeanServer.getAttribute(objectName, "startupTime").toString()).append(',');
+ new Date(((Long) mBeanServer.getAttribute(objectName, "startTime")).longValue()).toString())
+ .append(',');
+ appendJSonValue(writer, "startupTime", mBeanServer.getAttribute(objectName, "startupTime").toString())
+ .append(',');
appendJSonValue(writer, "tldScanTime", mBeanServer.getAttribute(objectName, "tldScanTime").toString());
if (managerON != null) {
writeManager(writer, managerON, mBeanServer, mode);
@@ -877,14 +885,22 @@ public class StatusTransformer {
} else if (mode == 2) {
writer.append(',').println();
indent(writer, 3).append('"').append("manager").append('"').append(':').append('{');
- appendJSonValue(writer, "activeSessions", mBeanServer.getAttribute(objectName, "activeSessions").toString()).append(',');
- appendJSonValue(writer, "sessionCounter", mBeanServer.getAttribute(objectName, "sessionCounter").toString()).append(',');
- appendJSonValue(writer, "maxActive", mBeanServer.getAttribute(objectName, "maxActive").toString()).append(',');
- appendJSonValue(writer, "rejectedSessions", mBeanServer.getAttribute(objectName, "rejectedSessions").toString()).append(',');
- appendJSonValue(writer, "expiredSessions", mBeanServer.getAttribute(objectName, "expiredSessions").toString()).append(',');
- appendJSonValue(writer, "sessionMaxAliveTime", mBeanServer.getAttribute(objectName, "sessionMaxAliveTime").toString()).append(',');
- appendJSonValue(writer, "sessionAverageAliveTime", mBeanServer.getAttribute(objectName, "sessionAverageAliveTime").toString()).append(',');
- appendJSonValue(writer, "processingTime", mBeanServer.getAttribute(objectName, "processingTime").toString());
+ appendJSonValue(writer, "activeSessions", mBeanServer.getAttribute(objectName, "activeSessions").toString())
+ .append(',');
+ appendJSonValue(writer, "sessionCounter", mBeanServer.getAttribute(objectName, "sessionCounter").toString())
+ .append(',');
+ appendJSonValue(writer, "maxActive", mBeanServer.getAttribute(objectName, "maxActive").toString())
+ .append(',');
+ appendJSonValue(writer, "rejectedSessions",
+ mBeanServer.getAttribute(objectName, "rejectedSessions").toString()).append(',');
+ appendJSonValue(writer, "expiredSessions",
+ mBeanServer.getAttribute(objectName, "expiredSessions").toString()).append(',');
+ appendJSonValue(writer, "sessionMaxAliveTime",
+ mBeanServer.getAttribute(objectName, "sessionMaxAliveTime").toString()).append(',');
+ appendJSonValue(writer, "sessionAverageAliveTime",
+ mBeanServer.getAttribute(objectName, "sessionAverageAliveTime").toString()).append(',');
+ appendJSonValue(writer, "processingTime",
+ mBeanServer.getAttribute(objectName, "processingTime").toString());
writer.append('}');
}
@@ -983,11 +999,15 @@ public class StatusTransformer {
} else if (mode == 2) {
indent(writer, 4).append('{');
appendJSonValue(writer, "servletName", JSONFilter.escape(servletName)).append(',');
- appendJSonValue(writer, "processingTime", mBeanServer.getAttribute(objectName, "processingTime").toString()).append(',');
+ appendJSonValue(writer, "processingTime", mBeanServer.getAttribute(objectName, "processingTime").toString())
+ .append(',');
appendJSonValue(writer, "maxTime", mBeanServer.getAttribute(objectName, "maxTime").toString()).append(',');
- appendJSonValue(writer, "requestCount", mBeanServer.getAttribute(objectName, "requestCount").toString()).append(',');
- appendJSonValue(writer, "errorCount", mBeanServer.getAttribute(objectName, "errorCount").toString()).append(',');
- appendJSonValue(writer, "loadTime", mBeanServer.getAttribute(objectName, "loadTime").toString()).append(',');
+ appendJSonValue(writer, "requestCount", mBeanServer.getAttribute(objectName, "requestCount").toString())
+ .append(',');
+ appendJSonValue(writer, "errorCount", mBeanServer.getAttribute(objectName, "errorCount").toString())
+ .append(',');
+ appendJSonValue(writer, "loadTime", mBeanServer.getAttribute(objectName, "loadTime").toString())
+ .append(',');
appendJSonValue(writer, "classLoadTime", mBeanServer.getAttribute(objectName, "classLoadTime").toString());
writer.append('}');
}
diff --git a/java/org/apache/catalina/mbeans/MBeanUtils.java b/java/org/apache/catalina/mbeans/MBeanUtils.java
index c4477a8f2e..8bfa690388 100644
--- a/java/org/apache/catalina/mbeans/MBeanUtils.java
+++ b/java/org/apache/catalina/mbeans/MBeanUtils.java
@@ -56,9 +56,8 @@ public class MBeanUtils {
* The set of exceptions to the normal rules used by <code>createManagedBean()</code>. The first element of each
* pair is a class name, and the second element is the managed bean name.
*/
- private static final String exceptions[][] = {
- { "org.apache.catalina.users.GenericGroup", "Group" }, { "org.apache.catalina.users.GenericRole", "Role" },
- { "org.apache.catalina.users.GenericUser", "User" } };
+ private static final String exceptions[][] = { { "org.apache.catalina.users.GenericGroup", "Group" },
+ { "org.apache.catalina.users.GenericRole", "Role" }, { "org.apache.catalina.users.GenericUser", "User" } };
/**
diff --git a/java/org/apache/catalina/realm/CombinedRealm.java b/java/org/apache/catalina/realm/CombinedRealm.java
index 0a97c340f2..902173a122 100644
--- a/java/org/apache/catalina/realm/CombinedRealm.java
+++ b/java/org/apache/catalina/realm/CombinedRealm.java
@@ -60,7 +60,8 @@ public class CombinedRealm extends RealmBase {
realms.add(theRealm);
if (log.isDebugEnabled()) {
- log.debug(sm.getString("combinedRealm.addRealm", theRealm.getClass().getName(), Integer.toString(realms.size())));
+ log.debug(sm.getString("combinedRealm.addRealm", theRealm.getClass().getName(),
+ Integer.toString(realms.size())));
}
}
diff --git a/java/org/apache/catalina/realm/RealmBase.java b/java/org/apache/catalina/realm/RealmBase.java
index 8f12552ee7..c0aaa49068 100644
--- a/java/org/apache/catalina/realm/RealmBase.java
+++ b/java/org/apache/catalina/realm/RealmBase.java
@@ -1274,9 +1274,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements Realm {
* specified, the default for the CredentialHandler will be used.</li>
* <li><b>-h</b> - The fully qualified class name of the CredentialHandler to use. If not specified, the built-in
* handlers will be tested in turn and the first one to accept the specified algorithm will be used.</li>
- * <li><b>-f</b> - The name of the file that contains passwords to encode. Each
- * line in the file should contain only one password. Using this
- * option ignores other password input.</li>
+ * <li><b>-f</b> - The name of the file that contains passwords to encode. Each line in the file should contain only
+ * one password. Using this option ignores other password input.</li>
* </ul>
* <p>
* This generation process currently supports the following CredentialHandlers, the correct one being selected based
@@ -1317,7 +1316,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements Realm {
// Note: Reducing args.length requirement to argIndex+1 so that -f works and ignores
// trailing words
- while (args.length > argIndex + 1 && args[argIndex].length() == 2 && args[argIndex].charAt(0) == '-' && !endOfList) {
+ while (args.length > argIndex + 1 && args[argIndex].length() == 2 && args[argIndex].charAt(0) == '-' &&
+ !endOfList) {
switch (args[argIndex].charAt(1)) {
case 'a': {
algorithm = args[argIndex + 1];
@@ -1348,7 +1348,7 @@ public abstract class RealmBase extends LifecycleMBeanBase implements Realm {
break;
}
case '-': {
- // When encountering -- option don't parse anything else as an option
+ // When encountering -- option don't parse anything else as an option
endOfList = true;
// The -- opt doesn't take an argument, decrement the argIndex so that it parses
// all remaining args
@@ -1436,8 +1436,7 @@ public abstract class RealmBase extends LifecycleMBeanBase implements Realm {
// A FileNotFound is the likely exception here and self-explanatory. Softly
// reporting it and exit 1 so that you can tell it failed from the command line.
if (e instanceof java.io.FileNotFoundException) {
- System.err.println("cannot stat '" + passwordFile +
- "': No such file or directory");
+ System.err.println("cannot stat '" + passwordFile + "': No such file or directory");
// Not sure if using an exit here is OK, but I wanted to return a code that
// showed failure.
System.exit(1);
@@ -1457,9 +1456,9 @@ public abstract class RealmBase extends LifecycleMBeanBase implements Realm {
}
private static void usage() {
- System.out.println("Usage: RealmBase [-a <algorithm>] [-e <encoding>]"
- + " [-i <iterations>] [-s <salt-length>] [-k <key-length>]"
- + " [-h <handler-class-name>] | <XX credentials>");
+ System.out.println("Usage: RealmBase [-a <algorithm>] [-e <encoding>]" +
+ " [-i <iterations>] [-s <salt-length>] [-k <key-length>]" +
+ " [-h <handler-class-name>] | <XX credentials>");
}
diff --git a/java/org/apache/catalina/security/SecurityListener.java b/java/org/apache/catalina/security/SecurityListener.java
index 7917b9a6a4..8873b77a10 100644
--- a/java/org/apache/catalina/security/SecurityListener.java
+++ b/java/org/apache/catalina/security/SecurityListener.java
@@ -139,28 +139,24 @@ public class SecurityListener implements LifecycleListener {
}
/**
- * Sets the number of days that may pass between the build-date of this
- * Tomcat instance before warnings are printed.
+ * Sets the number of days that may pass between the build-date of this Tomcat instance before warnings are printed.
*
- * @param ageDays The number of days a Tomcat build is allowed to age
- * before logging warnings.
+ * @param ageDays The number of days a Tomcat build is allowed to age before logging warnings.
*/
public void setBuildDateWarningAgeDays(String ageDays) {
try {
buildDateWarningAgeDays = Integer.parseInt(ageDays);
} catch (NumberFormatException nfe) {
// Just use the default and warn the user
- log.warn(sm.getString("SecurityListener.buildDateAgeUnreadable",
- ageDays, String.valueOf(DEFAULT_BUILD_DATE_WARNING_AGE_DAYS)));
+ log.warn(sm.getString("SecurityListener.buildDateAgeUnreadable", ageDays,
+ String.valueOf(DEFAULT_BUILD_DATE_WARNING_AGE_DAYS)));
}
}
/**
- * Gets the number of days that may pass between the build-date of this
- * Tomcat instance before warnings are printed.
+ * Gets the number of days that may pass between the build-date of this Tomcat instance before warnings are printed.
*
- * @return The number of days a Tomcat build is allowed to age
- * before logging warnings.
+ * @return The number of days a Tomcat build is allowed to age before logging warnings.
*/
public int getBuildDateWarningAgeDays() {
return buildDateWarningAgeDays;
@@ -226,7 +222,8 @@ public class SecurityListener implements LifecycleListener {
if (allowedAgeDays >= 0) {
String buildDateString = ServerInfo.getServerBuiltISO();
- if (null == buildDateString || buildDateString.length() < 1 || !Character.isDigit(buildDateString.charAt(0))) {
+ if (null == buildDateString || buildDateString.length() < 1 ||
+ !Character.isDigit(buildDateString.charAt(0))) {
log.warn(sm.getString("SecurityListener.buildDateUnreadable", buildDateString));
} else {
try {
diff --git a/java/org/apache/catalina/session/DataSourceStore.java b/java/org/apache/catalina/session/DataSourceStore.java
index 9406f5a25a..3a0806cd79 100644
--- a/java/org/apache/catalina/session/DataSourceStore.java
+++ b/java/org/apache/catalina/session/DataSourceStore.java
@@ -599,13 +599,11 @@ public class DataSourceStore extends StoreBase {
manager.getContext().getLogger().info(sm.getString("dataSourceStore.checkConnectionDBClosed"));
conn = open();
if (conn == null || conn.isClosed()) {
- manager.getContext().getLogger()
- .info(sm.getString("dataSourceStore.checkConnectionDBReOpenFail"));
+ manager.getContext().getLogger().info(sm.getString("dataSourceStore.checkConnectionDBReOpenFail"));
}
}
} catch (SQLException ex) {
- manager.getContext().getLogger()
- .error(sm.getString("dataSourceStore.checkConnectionSQLException", ex));
+ manager.getContext().getLogger().error(sm.getString("dataSourceStore.checkConnectionSQLException", ex));
}
return conn;
diff --git a/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java b/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java
index cd31f0fd1e..5f600d6b01 100644
--- a/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java
+++ b/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java
@@ -63,7 +63,8 @@ public class CatalinaBaseConfigurationSource implements ConfigurationSource {
InputStream stream = getClass().getClassLoader().getResourceAsStream(LEGACY_SERVER_EMBED_XML);
if (stream != null) {
try {
- result = new Resource(stream, getClass().getClassLoader().getResource(LEGACY_SERVER_EMBED_XML).toURI());
+ result = new Resource(stream,
+ getClass().getClassLoader().getResource(LEGACY_SERVER_EMBED_XML).toURI());
} catch (URISyntaxException e) {
stream.close();
}
diff --git a/java/org/apache/catalina/startup/Tomcat.java b/java/org/apache/catalina/startup/Tomcat.java
index 2da827d3bc..d4b4bb9006 100644
--- a/java/org/apache/catalina/startup/Tomcat.java
+++ b/java/org/apache/catalina/startup/Tomcat.java
@@ -835,11 +835,10 @@ public class Tomcat {
System.setProperty(Globals.CATALINA_HOME_PROP, server.getCatalinaHome().getPath());
}
- static final String[] silences =
- new String[] { "org.apache.coyote.http11.Http11NioProtocol", "org.apache.catalina.core.StandardService",
- "org.apache.catalina.core.StandardEngine", "org.apache.catalina.startup.ContextConfig",
- "org.apache.catalina.core.ApplicationContext", "org.apache.catalina.core.AprLifecycleListener",
- "org.apache.catalina.core.OpenSSLLifecycleListener" };
+ static final String[] silences = new String[] { "org.apache.coyote.http11.Http11NioProtocol",
+ "org.apache.catalina.core.StandardService", "org.apache.catalina.core.StandardEngine",
+ "org.apache.catalina.startup.ContextConfig", "org.apache.catalina.core.ApplicationContext",
+ "org.apache.catalina.core.AprLifecycleListener", "org.apache.catalina.core.OpenSSLLifecycleListener" };
private boolean silent = false;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org