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 2023/02/23 16:50:19 UTC

[tomcat] branch 10.1.x updated (e7388e78d0 -> 018e5bd7dc)

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

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


    from e7388e78d0 Validate the scheme pseudo-header in HTTP/2
     new e4dff72164 Handle CONNECT with deliberate 501 rather than accidental 400
     new a34d9daeb6 Use i18n
     new e3d9795e8a Clean-up - formatting. No functional change.
     new dbb979a15f Clean-up - formatting. No functional change.
     new 1b6c6c4701 Clean-up - formatting. No functional change.
     new 018e5bd7dc Clean-up - formatting. No functional change.

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../catalina/connector/ClientAbortException.java   |  10 +-
 java/org/apache/catalina/connector/Connector.java  | 234 +++----
 .../apache/catalina/connector/CoyoteAdapter.java   | 319 ++++-----
 .../catalina/connector/CoyoteInputStream.java      |  19 +-
 .../catalina/connector/CoyoteOutputStream.java     |  16 +-
 .../apache/catalina/connector/CoyotePrincipal.java |   7 +-
 .../apache/catalina/connector/CoyoteReader.java    |  37 +-
 .../apache/catalina/connector/CoyoteWriter.java    |   5 +-
 .../org/apache/catalina/connector/InputBuffer.java |  34 +-
 .../catalina/connector/LocalStrings.properties     |   4 +
 .../apache/catalina/connector/OutputBuffer.java    |  46 +-
 java/org/apache/catalina/connector/Request.java    | 755 +++++++++------------
 .../apache/catalina/connector/RequestFacade.java   | 137 ++--
 java/org/apache/catalina/connector/Response.java   | 311 ++++-----
 .../apache/catalina/connector/ResponseFacade.java  |  23 +-
 .../coyote/http11/AbstractHttp11JsseProtocol.java  |  27 +-
 .../coyote/http11/AbstractHttp11Protocol.java      | 251 ++++---
 .../coyote/http11/HeadersTooLargeException.java    |   3 +-
 .../apache/coyote/http11/Http11InputBuffer.java    | 165 ++---
 .../apache/coyote/http11/Http11Nio2Protocol.java   |   6 +-
 .../apache/coyote/http11/Http11NioProtocol.java    |  14 +-
 .../apache/coyote/http11/Http11OutputBuffer.java   |  95 ++-
 java/org/apache/coyote/http11/Http11Processor.java | 164 ++---
 .../org/apache/coyote/http11/HttpOutputBuffer.java |   5 +-
 java/org/apache/coyote/http11/InputFilter.java     |  15 +-
 java/org/apache/coyote/http11/OutputFilter.java    |   5 +-
 java/org/apache/coyote/http2/Stream.java           |   3 +-
 .../coyote/http11/TestHttp11InputBuffer.java       | 122 +---
 .../coyote/http11/TestHttp11InputBufferCRLF.java   |  66 +-
 .../coyote/http11/TestHttp11OutputBuffer.java      |   2 +-
 .../apache/coyote/http11/TestHttp11Processor.java  | 514 ++++++--------
 test/org/apache/coyote/http2/Http2TestBase.java    | 215 +++---
 .../apache/coyote/http2/TestAbstractStream.java    | 107 ++-
 test/org/apache/coyote/http2/TestAsync.java        |  19 +-
 test/org/apache/coyote/http2/TestAsyncFlush.java   |   5 +-
 test/org/apache/coyote/http2/TestAsyncTimeout.java |   3 +-
 .../apache/coyote/http2/TestCancelledUpload.java   |  27 +-
 test/org/apache/coyote/http2/TestFlowControl.java  |  20 +-
 test/org/apache/coyote/http2/TestHpack.java        |   8 +-
 .../coyote/http2/TestHttp2InitialConnection.java   |  40 +-
 test/org/apache/coyote/http2/TestHttp2Limits.java  | 294 ++++----
 .../apache/coyote/http2/TestHttp2Section_3_2.java  |  31 +-
 .../apache/coyote/http2/TestHttp2Section_3_5.java  |   4 +-
 .../apache/coyote/http2/TestHttp2Section_4_1.java  |  10 +-
 .../apache/coyote/http2/TestHttp2Section_4_2.java  |  14 +-
 .../apache/coyote/http2/TestHttp2Section_4_3.java  |  11 +-
 .../apache/coyote/http2/TestHttp2Section_5_1.java  |  55 +-
 .../apache/coyote/http2/TestHttp2Section_5_2.java  |  13 +-
 .../apache/coyote/http2/TestHttp2Section_5_3.java  |  53 +-
 .../apache/coyote/http2/TestHttp2Section_5_5.java  |   9 +-
 .../apache/coyote/http2/TestHttp2Section_6_1.java  |  50 +-
 .../apache/coyote/http2/TestHttp2Section_6_2.java  |  13 +-
 .../apache/coyote/http2/TestHttp2Section_6_3.java  |  10 +-
 .../apache/coyote/http2/TestHttp2Section_6_4.java  |  10 +-
 .../apache/coyote/http2/TestHttp2Section_6_5.java  |  22 +-
 .../apache/coyote/http2/TestHttp2Section_6_6.java  |   5 +-
 .../apache/coyote/http2/TestHttp2Section_6_7.java  |   7 +-
 .../apache/coyote/http2/TestHttp2Section_6_8.java  |  11 +-
 .../apache/coyote/http2/TestHttp2Section_6_9.java  |  63 +-
 .../apache/coyote/http2/TestHttp2Section_8_1.java  |  72 +-
 .../org/apache/coyote/http2/TestHttp2Timeouts.java |  10 +-
 .../coyote/http2/TestHttp2UpgradeHandler.java      |  46 +-
 test/org/apache/coyote/http2/TestLargeUpload.java  |  19 +-
 test/org/apache/coyote/http2/TestStream.java       |  32 +-
 .../apache/coyote/http2/TestStreamProcessor.java   |  47 +-
 .../apache/coyote/http2/TestStreamQueryString.java |  45 +-
 .../org/apache/coyote/http2/TesterHttp2Parser.java |   6 +-
 webapps/docs/changelog.xml                         |   4 +
 68 files changed, 2033 insertions(+), 2791 deletions(-)


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


[tomcat] 03/06: Clean-up - formatting. No functional change.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e3d9795e8ac41b66eaf87a976e3c48d168435d86
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Feb 23 16:49:22 2023 +0000

    Clean-up - formatting. No functional change.
---
 .../catalina/connector/ClientAbortException.java   |  10 +-
 java/org/apache/catalina/connector/Connector.java  | 234 +++----
 .../apache/catalina/connector/CoyoteAdapter.java   | 241 +++----
 .../catalina/connector/CoyoteInputStream.java      |  19 +-
 .../catalina/connector/CoyoteOutputStream.java     |  16 +-
 .../apache/catalina/connector/CoyotePrincipal.java |   7 +-
 .../apache/catalina/connector/CoyoteReader.java    |  37 +-
 .../apache/catalina/connector/CoyoteWriter.java    |   5 +-
 .../org/apache/catalina/connector/InputBuffer.java |  34 +-
 .../apache/catalina/connector/OutputBuffer.java    |  46 +-
 java/org/apache/catalina/connector/Request.java    | 755 +++++++++------------
 .../apache/catalina/connector/RequestFacade.java   | 137 ++--
 java/org/apache/catalina/connector/Response.java   | 311 ++++-----
 .../apache/catalina/connector/ResponseFacade.java  |  23 +-
 14 files changed, 775 insertions(+), 1100 deletions(-)

diff --git a/java/org/apache/catalina/connector/ClientAbortException.java b/java/org/apache/catalina/connector/ClientAbortException.java
index fa469f96ee..ca40f014d6 100644
--- a/java/org/apache/catalina/connector/ClientAbortException.java
+++ b/java/org/apache/catalina/connector/ClientAbortException.java
@@ -19,8 +19,7 @@ package org.apache.catalina.connector;
 import java.io.IOException;
 
 /**
- * Extend IOException to identify it as being caused by an abort of a request by
- * a remote client.
+ * Extend IOException to identify it as being caused by an abort of a request by a remote client.
  *
  * @author Glenn L. Nielsen
  */
@@ -29,7 +28,7 @@ public final class ClientAbortException extends IOException {
     private static final long serialVersionUID = 1L;
 
 
-    //------------------------------------------------------------ Constructors
+    // ------------------------------------------------------------ Constructors
 
     /**
      * Construct a new ClientAbortException with no other information.
@@ -60,10 +59,9 @@ public final class ClientAbortException extends IOException {
 
 
     /**
-     * Construct a new ClientAbortException for the specified message
-     * and throwable.
+     * Construct a new ClientAbortException for the specified message and throwable.
      *
-     * @param message Message describing this exception
+     * @param message   Message describing this exception
      * @param throwable Throwable that caused this exception
      */
     public ClientAbortException(String message, Throwable throwable) {
diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java
index fbdd3061bf..235b987c65 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -53,7 +53,7 @@ import org.apache.tomcat.util.res.StringManager;
  * @author Craig R. McClanahan
  * @author Remy Maucherat
  */
-public class Connector extends LifecycleMBeanBase  {
+public class Connector extends LifecycleMBeanBase {
 
     private static final Log log = LogFactory.getLog(Connector.class);
 
@@ -77,8 +77,7 @@ public class Connector extends LifecycleMBeanBase  {
         try {
             p = ProtocolHandler.create(protocol);
         } catch (Exception e) {
-            log.error(sm.getString(
-                    "coyoteConnector.protocolHandlerInstantiationFailed"), e);
+            log.error(sm.getString("coyoteConnector.protocolHandlerInstantiationFailed"), e);
         }
         if (p != null) {
             protocolHandler = p;
@@ -110,9 +109,8 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * If this is <code>true</code> the '\' character will be permitted as a
-     * path delimiter. If not specified, the default value of
-     * <code>false</code> will be used.
+     * If this is <code>true</code> the '\' character will be permitted as a path delimiter. If not specified, the
+     * default value of <code>false</code> will be used.
      */
     protected boolean allowBackslash = false;
 
@@ -136,15 +134,11 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * If this is <code>true</code> then a call to
-     * <code>Response.getWriter()</code> if no character encoding
-     * has been specified will result in subsequent calls to
-     * <code>Response.getCharacterEncoding()</code> returning
-     * <code>ISO-8859-1</code> and the <code>Content-Type</code> response header
-     * will include a <code>charset=ISO-8859-1</code> component.
-     * (SRV.15.2.22.1)
-     * If not specified, the default specification compliant value of
-     * <code>true</code> will be used.
+     * If this is <code>true</code> then a call to <code>Response.getWriter()</code> if no character encoding has been
+     * specified will result in subsequent calls to <code>Response.getCharacterEncoding()</code> returning
+     * <code>ISO-8859-1</code> and the <code>Content-Type</code> response header will include a
+     * <code>charset=ISO-8859-1</code> component. (SRV.15.2.22.1) If not specified, the default specification compliant
+     * value of <code>true</code> will be used.
      */
     protected boolean enforceEncodingInGetWriter = true;
 
@@ -156,29 +150,25 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * The server name to which we should pretend requests to this Connector
-     * were directed.  This is useful when operating Tomcat behind a proxy
-     * server, so that redirects get constructed accurately.  If not specified,
-     * the server name included in the <code>Host</code> header is used.
+     * The server name to which we should pretend requests to this Connector were directed. This is useful when
+     * operating Tomcat behind a proxy server, so that redirects get constructed accurately. If not specified, the
+     * server name included in the <code>Host</code> header is used.
      */
     protected String proxyName = null;
 
 
     /**
-     * The server port to which we should pretend requests to this Connector
-     * were directed.  This is useful when operating Tomcat behind a proxy
-     * server, so that redirects get constructed accurately.  If not specified,
-     * the port number specified by the <code>port</code> property is used.
+     * The server port to which we should pretend requests to this Connector were directed. This is useful when
+     * operating Tomcat behind a proxy server, so that redirects get constructed accurately. If not specified, the port
+     * number specified by the <code>port</code> property is used.
      */
     protected int proxyPort = 0;
 
 
     /**
-     * The flag that controls recycling of the facades of the request
-     * processing objects. If set to <code>true</code> the object facades
-     * will be discarded when the request is recycled. If the security
-     * manager is enabled, this setting is ignored and object facades are
-     * always discarded.
+     * The flag that controls recycling of the facades of the request processing objects. If set to <code>true</code>
+     * the object facades will be discarded when the request is recycled. If the security manager is enabled, this
+     * setting is ignored and object facades are always discarded.
      */
     protected boolean discardFacades = true;
 
@@ -190,15 +180,13 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * The request scheme that will be set on all requests received
-     * through this connector.
+     * The request scheme that will be set on all requests received through this connector.
      */
     protected String scheme = "http";
 
 
     /**
-     * The secure connection flag that will be set on all requests received
-     * through this connector.
+     * The secure connection flag that will be set on all requests received through this connector.
      */
     protected boolean secure = false;
 
@@ -210,34 +198,30 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * The maximum number of cookies permitted for a request. Use a value less
-     * than zero for no limit. Defaults to 200.
+     * The maximum number of cookies permitted for a request. Use a value less than zero for no limit. Defaults to 200.
      */
     private int maxCookieCount = 200;
 
     /**
-     * The maximum number of parameters (GET plus POST) which will be
-     * automatically parsed by the container. 10000 by default. A value of less
-     * than 0 means no limit.
+     * The maximum number of parameters (GET plus POST) which will be automatically parsed by the container. 10000 by
+     * default. A value of less than 0 means no limit.
      */
     protected int maxParameterCount = 10000;
 
     /**
-     * Maximum size of a POST which will be automatically parsed by the
-     * container. 2MB by default.
+     * Maximum size of a POST which will be automatically parsed by the container. 2MB by default.
      */
     protected int maxPostSize = 2 * 1024 * 1024;
 
 
     /**
-     * Maximum size of a POST which will be saved by the container
-     * during authentication. 4kB by default
+     * Maximum size of a POST which will be saved by the container during authentication. 4kB by default
      */
     protected int maxSavePostSize = 4 * 1024;
 
     /**
-     * Comma-separated list of HTTP methods that will be parsed according
-     * to POST-style rules for application/x-www-form-urlencoded request bodies.
+     * Comma-separated list of HTTP methods that will be parsed according to POST-style rules for
+     * application/x-www-form-urlencoded request bodies.
      */
     protected String parseBodyMethods = "POST";
 
@@ -254,8 +238,7 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * Coyote Protocol handler class name.
-     * See {@link #Connector()} for current default.
+     * Coyote Protocol handler class name. See {@link #Connector()} for current default.
      */
     protected final String protocolHandlerClassName;
 
@@ -305,6 +288,7 @@ public class Connector extends LifecycleMBeanBase  {
      * Return a property from the protocol handler.
      *
      * @param name the property name
+     *
      * @return the property value
      */
     public Object getProperty(String name) {
@@ -318,8 +302,9 @@ public class Connector extends LifecycleMBeanBase  {
     /**
      * Set a property on the protocol handler.
      *
-     * @param name the property name
+     * @param name  the property name
      * @param value the property value
+     *
      * @return <code>true</code> if the property was successfully set
      */
     public boolean setProperty(String name, String value) {
@@ -349,8 +334,7 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return <code>true</code> if backslash characters are allowed in URLs.
-     *   Default value is <code>false</code>.
+     * @return <code>true</code> if backslash characters are allowed in URLs. Default value is <code>false</code>.
      */
     public boolean getAllowBackslash() {
         return allowBackslash;
@@ -359,6 +343,7 @@ public class Connector extends LifecycleMBeanBase  {
 
     /**
      * Set the allowBackslash flag.
+     *
      * @param allowBackslash the new flag value
      */
     public void setAllowBackslash(boolean allowBackslash) {
@@ -367,8 +352,7 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return <code>true</code> if the TRACE method is allowed. Default value
-     *         is <code>false</code>.
+     * @return <code>true</code> if the TRACE method is allowed. Default value is <code>false</code>.
      */
     public boolean getAllowTrace() {
         return this.allowTrace;
@@ -399,14 +383,13 @@ public class Connector extends LifecycleMBeanBase  {
      * @param asyncTimeout The new timeout in ms.
      */
     public void setAsyncTimeout(long asyncTimeout) {
-        this.asyncTimeout= asyncTimeout;
+        this.asyncTimeout = asyncTimeout;
     }
 
 
     /**
-     * @return <code>true</code> if the object facades are discarded, either
-     *   when the discardFacades value is <code>true</code> or when the
-     *   security manager is enabled.
+     * @return <code>true</code> if the object facades are discarded, either when the discardFacades value is
+     *             <code>true</code> or when the security manager is enabled.
      */
     public boolean getDiscardFacades() {
         return discardFacades || Globals.IS_SECURITY_ENABLED;
@@ -415,6 +398,7 @@ public class Connector extends LifecycleMBeanBase  {
 
     /**
      * Set the recycling strategy for the object facades.
+     *
      * @param discardFacades the new value of the flag
      */
     public void setDiscardFacades(boolean discardFacades) {
@@ -441,8 +425,7 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return <code>true</code> if a default character encoding will be set
-     *   when calling Response.getWriter()
+     * @return <code>true</code> if a default character encoding will be set when calling Response.getWriter()
      */
     public boolean getEnforceEncodingInGetWriter() {
         return enforceEncodingInGetWriter;
@@ -451,6 +434,7 @@ public class Connector extends LifecycleMBeanBase  {
 
     /**
      * Set the enforceEncodingInGetWriter flag.
+     *
      * @param enforceEncodingInGetWriter the new flag value
      */
     public void setEnforceEncodingInGetWriter(boolean enforceEncodingInGetWriter) {
@@ -469,9 +453,8 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return the maximum number of parameters (GET plus POST) that will be
-     * automatically parsed by the container. A value of less than 0 means no
-     * limit.
+     * @return the maximum number of parameters (GET plus POST) that will be automatically parsed by the container. A
+     *             value of less than 0 means no limit.
      */
     public int getMaxParameterCount() {
         return maxParameterCount;
@@ -479,9 +462,8 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * Set the maximum number of parameters (GET plus POST) that will be
-     * automatically parsed by the container. A value of less than 0 means no
-     * limit.
+     * Set the maximum number of parameters (GET plus POST) that will be automatically parsed by the container. A value
+     * of less than 0 means no limit.
      *
      * @param maxParameterCount The new setting
      */
@@ -491,8 +473,7 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return the maximum size of a POST which will be automatically
-     * parsed by the container.
+     * @return the maximum size of a POST which will be automatically parsed by the container.
      */
     public int getMaxPostSize() {
         return maxPostSize;
@@ -500,11 +481,9 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * Set the maximum size of a POST which will be automatically
-     * parsed by the container.
+     * Set the maximum size of a POST which will be automatically parsed by the container.
      *
-     * @param maxPostSize The new maximum size in bytes of a POST which will
-     * be automatically parsed by the container
+     * @param maxPostSize The new maximum size in bytes of a POST which will be automatically parsed by the container
      */
     public void setMaxPostSize(int maxPostSize) {
         this.maxPostSize = maxPostSize;
@@ -512,8 +491,7 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return the maximum size of a POST which will be saved by the container
-     * during authentication.
+     * @return the maximum size of a POST which will be saved by the container during authentication.
      */
     public int getMaxSavePostSize() {
         return maxSavePostSize;
@@ -521,11 +499,10 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * Set the maximum size of a POST which will be saved by the container
-     * during authentication.
+     * Set the maximum size of a POST which will be saved by the container during authentication.
      *
-     * @param maxSavePostSize The new maximum size in bytes of a POST which will
-     * be saved by the container during authentication.
+     * @param maxSavePostSize The new maximum size in bytes of a POST which will be saved by the container during
+     *                            authentication.
      */
     public void setMaxSavePostSize(int maxSavePostSize) {
         this.maxSavePostSize = maxSavePostSize;
@@ -542,8 +519,7 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * Set list of HTTP methods which should allow body parameter
-     * parsing. This defaults to <code>POST</code>.
+     * Set list of HTTP methods which should allow body parameter parsing. This defaults to <code>POST</code>.
      *
      * @param methods Comma separated list of HTTP method names
      */
@@ -570,9 +546,8 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return the port number on which this connector is configured to listen
-     * for requests. The special value of 0 means select a random free port
-     * when the socket is bound.
+     * @return the port number on which this connector is configured to listen for requests. The special value of 0
+     *             means select a random free port when the socket is bound.
      */
     public int getPort() {
         // Try shortcut that should work for nearly all uses first as it does
@@ -632,9 +607,8 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return the port number on which this connector is listening to requests.
-     * If the special value for {@link #getPort} of zero is used then this method
-     * will report the actual port bound.
+     * @return the port number on which this connector is listening to requests. If the special value for
+     *             {@link #getPort} of zero is used then this method will report the actual port bound.
      */
     public int getLocalPort() {
         return ((Integer) getProperty("localPort")).intValue();
@@ -680,7 +654,7 @@ public class Connector extends LifecycleMBeanBase  {
      */
     public void setProxyName(String proxyName) {
 
-        if(proxyName != null && proxyName.length() > 0) {
+        if (proxyName != null && proxyName.length() > 0) {
             this.proxyName = proxyName;
         } else {
             this.proxyName = null;
@@ -707,9 +681,8 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return the port number to which a request should be redirected if
-     * it comes in on a non-SSL port and is subject to a security constraint
-     * with a transport guarantee that requires SSL.
+     * @return the port number to which a request should be redirected if it comes in on a non-SSL port and is subject
+     *             to a security constraint with a transport guarantee that requires SSL.
      */
     public int getRedirectPort() {
         return this.redirectPort;
@@ -732,8 +705,7 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return the scheme that will be assigned to requests received
-     * through this connector.  Default value is "http".
+     * @return the scheme that will be assigned to requests received through this connector. Default value is "http".
      */
     public String getScheme() {
         return this.scheme;
@@ -741,8 +713,7 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * Set the scheme that will be assigned to requests received through
-     * this connector.
+     * Set the scheme that will be assigned to requests received through this connector.
      *
      * @param scheme The new scheme
      */
@@ -752,8 +723,8 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return the secure connection flag that will be assigned to requests
-     * received through this connector.  Default value is "false".
+     * @return the secure connection flag that will be assigned to requests received through this connector. Default
+     *             value is "false".
      */
     public boolean getSecure() {
         return this.secure;
@@ -761,8 +732,7 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * Set the secure connection flag that will be assigned to requests
-     * received through this connector.
+     * Set the secure connection flag that will be assigned to requests received through this connector.
      *
      * @param secure The new secure connection flag
      */
@@ -773,8 +743,7 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return the name of character encoding to be used for the URI using the
-     * original case.
+     * @return the name of character encoding to be used for the URI using the original case.
      */
     public String getURIEncoding() {
         return uriCharset.name();
@@ -782,8 +751,7 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * @return The Charset to use to convert raw URI bytes (after %nn decoding)
-     *         to characters. This will never be null
+     * @return The Charset to use to convert raw URI bytes (after %nn decoding) to characters. This will never be null
      */
     public Charset getURICharset() {
         return uriCharset;
@@ -796,12 +764,12 @@ public class Connector extends LifecycleMBeanBase  {
      */
     public void setURIEncoding(String URIEncoding) {
         try {
-             Charset charset = B2CConverter.getCharset(URIEncoding);
-             if (!CharsetUtil.isAsciiSuperset(charset)) {
-                 log.error(sm.getString("coyoteConnector.notAsciiSuperset", URIEncoding, uriCharset.name()));
-                 return;
-             }
-             uriCharset = charset;
+            Charset charset = B2CConverter.getCharset(URIEncoding);
+            if (!CharsetUtil.isAsciiSuperset(charset)) {
+                log.error(sm.getString("coyoteConnector.notAsciiSuperset", URIEncoding, uriCharset.name()));
+                return;
+            }
+            uriCharset = charset;
         } catch (UnsupportedEncodingException e) {
             log.error(sm.getString("coyoteConnector.invalidEncoding", URIEncoding, uriCharset.name()), e);
         }
@@ -826,11 +794,10 @@ public class Connector extends LifecycleMBeanBase  {
     }
 
     /**
-     * Indicates whether the generation of an X-Powered-By response header for
-     * Servlet-generated responses is enabled or disabled for this Connector.
+     * Indicates whether the generation of an X-Powered-By response header for Servlet-generated responses is enabled or
+     * disabled for this Connector.
      *
-     * @return <code>true</code> if generation of X-Powered-By response header is enabled,
-     * false otherwise
+     * @return <code>true</code> if generation of X-Powered-By response header is enabled, false otherwise
      */
     public boolean getXpoweredBy() {
         return xpoweredBy;
@@ -838,12 +805,10 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * Enables or disables the generation of an X-Powered-By header (with value
-     * Servlet/2.5) for all servlet-generated responses returned by this
-     * Connector.
+     * Enables or disables the generation of an X-Powered-By header (with value Servlet/2.5) for all servlet-generated
+     * responses returned by this Connector.
      *
-     * @param xpoweredBy true if generation of X-Powered-By response header is
-     * to be enabled, false otherwise
+     * @param xpoweredBy true if generation of X-Powered-By response header is to be enabled, false otherwise
      */
     public void setXpoweredBy(boolean xpoweredBy) {
         this.xpoweredBy = xpoweredBy;
@@ -853,8 +818,8 @@ public class Connector extends LifecycleMBeanBase  {
     /**
      * Enable the use of IP-based virtual hosting.
      *
-     * @param useIPVHosts <code>true</code> if Hosts are identified by IP,
-     *                    <code>false</code> if Hosts are identified by name.
+     * @param useIPVHosts <code>true</code> if Hosts are identified by IP, <code>false</code> if Hosts are identified by
+     *                        name.
      */
     public void setUseIPVHosts(boolean useIPVHosts) {
         this.useIPVHosts = useIPVHosts;
@@ -928,8 +893,8 @@ public class Connector extends LifecycleMBeanBase  {
     // --------------------------------------------------------- Public Methods
 
     /**
-     * Create (or allocate) and return a Request object suitable for
-     * specifying the contents of a Request to the responsible Container.
+     * Create (or allocate) and return a Request object suitable for specifying the contents of a Request to the
+     * responsible Container.
      *
      * @return a new Servlet request object
      */
@@ -939,8 +904,8 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * Create (or allocate) and return a Response object suitable for
-     * receiving the contents of a Response from the responsible Container.
+     * Create (or allocate) and return a Response object suitable for receiving the contents of a Response from the
+     * responsible Container.
      *
      * @return a new Servlet response object
      */
@@ -1023,8 +988,7 @@ public class Connector extends LifecycleMBeanBase  {
         super.initInternal();
 
         if (protocolHandler == null) {
-            throw new LifecycleException(
-                    sm.getString("coyoteConnector.protocolHandlerInstantiationFailed"));
+            throw new LifecycleException(sm.getString("coyoteConnector.protocolHandlerInstantiationFailed"));
         }
 
         // Initialize adapter
@@ -1041,10 +1005,8 @@ public class Connector extends LifecycleMBeanBase  {
 
         if (AprStatus.isAprAvailable() && AprStatus.getUseOpenSSL() &&
                 protocolHandler instanceof AbstractHttp11JsseProtocol) {
-            AbstractHttp11JsseProtocol<?> jsseProtocolHandler =
-                    (AbstractHttp11JsseProtocol<?>) protocolHandler;
-            if (jsseProtocolHandler.isSSLEnabled() &&
-                    jsseProtocolHandler.getSslImplementationName() == null) {
+            AbstractHttp11JsseProtocol<?> jsseProtocolHandler = (AbstractHttp11JsseProtocol<?>) protocolHandler;
+            if (jsseProtocolHandler.isSSLEnabled() && jsseProtocolHandler.getSslImplementationName() == null) {
                 // OpenSSL is compatible with the JSSE configuration, so use it if APR is available
                 jsseProtocolHandler.setSslImplementationName(OpenSSLImplementation.class.getName());
             }
@@ -1053,8 +1015,7 @@ public class Connector extends LifecycleMBeanBase  {
         try {
             protocolHandler.init();
         } catch (Exception e) {
-            throw new LifecycleException(
-                    sm.getString("coyoteConnector.protocolHandlerInitializationFailed"), e);
+            throw new LifecycleException(sm.getString("coyoteConnector.protocolHandlerInitializationFailed"), e);
         }
     }
 
@@ -1070,8 +1031,8 @@ public class Connector extends LifecycleMBeanBase  {
         // Validate settings before starting
         String id = (protocolHandler != null) ? protocolHandler.getId() : null;
         if (id == null && getPortWithOffset() < 0) {
-            throw new LifecycleException(sm.getString(
-                    "coyoteConnector.invalidPort", Integer.valueOf(getPortWithOffset())));
+            throw new LifecycleException(
+                    sm.getString("coyoteConnector.invalidPort", Integer.valueOf(getPortWithOffset())));
         }
 
         setState(LifecycleState.STARTING);
@@ -1079,8 +1040,7 @@ public class Connector extends LifecycleMBeanBase  {
         try {
             protocolHandler.start();
         } catch (Exception e) {
-            throw new LifecycleException(
-                    sm.getString("coyoteConnector.protocolHandlerStartFailed"), e);
+            throw new LifecycleException(sm.getString("coyoteConnector.protocolHandlerStartFailed"), e);
         }
     }
 
@@ -1100,8 +1060,7 @@ public class Connector extends LifecycleMBeanBase  {
                 protocolHandler.stop();
             }
         } catch (Exception e) {
-            throw new LifecycleException(
-                    sm.getString("coyoteConnector.protocolHandlerStopFailed"), e);
+            throw new LifecycleException(sm.getString("coyoteConnector.protocolHandlerStopFailed"), e);
         }
     }
 
@@ -1113,8 +1072,7 @@ public class Connector extends LifecycleMBeanBase  {
                 protocolHandler.destroy();
             }
         } catch (Exception e) {
-            throw new LifecycleException(
-                    sm.getString("coyoteConnector.protocolHandlerDestroyFailed"), e);
+            throw new LifecycleException(sm.getString("coyoteConnector.protocolHandlerDestroyFailed"), e);
         }
 
         if (getService() != null) {
@@ -1126,8 +1084,8 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * Provide a useful toString() implementation as it may be used when logging
-     * Lifecycle errors to identify the component.
+     * Provide a useful toString() implementation as it may be used when logging Lifecycle errors to identify the
+     * component.
      */
     @Override
     public String toString() {
@@ -1152,7 +1110,7 @@ public class Connector extends LifecycleMBeanBase  {
     }
 
 
-    // -------------------- JMX registration  --------------------
+    // -------------------- JMX registration --------------------
 
     @Override
     protected String getDomainInternal() {
diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java
index efe8dd61e7..1469631138 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -56,8 +56,7 @@ import org.apache.tomcat.util.res.StringManager;
 
 
 /**
- * Implementation of a request processor which delegates the processing to a
- * Coyote processor.
+ * Implementation of a request processor which delegates the processing to a Coyote processor.
  *
  * @author Craig R. McClanahan
  * @author Remy Maucherat
@@ -68,19 +67,16 @@ public class CoyoteAdapter implements Adapter {
 
     // -------------------------------------------------------------- Constants
 
-    private static final String POWERED_BY = "Servlet/6.0 JSP/3.1 " +
-            "(" + ServerInfo.getServerInfo() + " Java/" +
-            System.getProperty("java.vm.vendor") + "/" +
-            System.getProperty("java.runtime.version") + ")";
+    private static final String POWERED_BY = "Servlet/6.0 JSP/3.1 " + "(" + ServerInfo.getServerInfo() + " Java/" +
+            System.getProperty("java.vm.vendor") + "/" + System.getProperty("java.runtime.version") + ")";
 
-    private static final EnumSet<SessionTrackingMode> SSL_ONLY =
-        EnumSet.of(SessionTrackingMode.SSL);
+    private static final EnumSet<SessionTrackingMode> SSL_ONLY = EnumSet.of(SessionTrackingMode.SSL);
 
     public static final int ADAPTER_NOTES = 1;
 
 
-    private static final ThreadLocal<String> THREAD_NAME =
-            ThreadLocal.withInitial(() -> Thread.currentThread().getName());
+    private static final ThreadLocal<String> THREAD_NAME = ThreadLocal
+            .withInitial(() -> Thread.currentThread().getName());
 
     // ----------------------------------------------------------- Constructors
 
@@ -116,8 +112,8 @@ public class CoyoteAdapter implements Adapter {
     // -------------------------------------------------------- Adapter Methods
 
     @Override
-    public boolean asyncDispatch(org.apache.coyote.Request req, org.apache.coyote.Response res,
-            SocketEvent status) throws Exception {
+    public boolean asyncDispatch(org.apache.coyote.Request req, org.apache.coyote.Response res, SocketEvent status)
+            throws Exception {
 
         Request request = (Request) req.getNote(ADAPTER_NOTES);
         Response response = (Response) res.getNote(ADAPTER_NOTES);
@@ -140,16 +136,16 @@ public class CoyoteAdapter implements Adapter {
                 response.setSuspended(false);
             }
 
-            if (status==SocketEvent.TIMEOUT) {
+            if (status == SocketEvent.TIMEOUT) {
                 if (!asyncConImpl.timeout()) {
                     asyncConImpl.setErrorState(null, false);
                 }
-            } else if (status==SocketEvent.ERROR) {
+            } else if (status == SocketEvent.ERROR) {
                 // An I/O error occurred on a non-container thread which means
                 // that the socket needs to be closed so set success to false to
                 // trigger a close
                 success = false;
-                Throwable t = (Throwable)req.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
+                Throwable t = (Throwable) req.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
                 Context context = request.getContext();
                 ClassLoader oldCL = null;
                 try {
@@ -177,8 +173,7 @@ public class CoyoteAdapter implements Adapter {
                     try {
                         oldCL = context.bind(false, null);
                         res.onWritePossible();
-                        if (request.isFinished() && req.sendAllDataReadEvent() &&
-                                readListener != null) {
+                        if (request.isFinished() && req.sendAllDataReadEvent() && readListener != null) {
                             readListener.onAllDataRead();
                         }
                         // User code may have swallowed an IOException
@@ -237,15 +232,12 @@ public class CoyoteAdapter implements Adapter {
             // Has an error occurred during async processing that needs to be
             // processed by the application's error page mechanism (or Tomcat's
             // if the application doesn't define one)?
-            if (!request.isAsyncDispatching() && request.isAsync() &&
-                    response.isErrorReportRequired()) {
-                connector.getService().getContainer().getPipeline().getFirst().invoke(
-                        request, response);
+            if (!request.isAsyncDispatching() && request.isAsync() && response.isErrorReportRequired()) {
+                connector.getService().getContainer().getPipeline().getFirst().invoke(request, response);
             }
 
             if (request.isAsyncDispatching()) {
-                connector.getService().getContainer().getPipeline().getFirst().invoke(
-                        request, response);
+                connector.getService().getContainer().getPipeline().getFirst().invoke(request, response);
                 Throwable t = (Throwable) request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
                 if (t != null) {
                     asyncConImpl.setErrorState(t, true);
@@ -266,7 +258,7 @@ public class CoyoteAdapter implements Adapter {
                     // Connection will be forcibly closed which will prevent
                     // completion happening at the usual point. Need to trigger
                     // call to onComplete() here.
-                    res.action(ActionCode.ASYNC_POST_PROCESS,  null);
+                    res.action(ActionCode.ASYNC_POST_PROCESS, null);
                 }
                 success = false;
             }
@@ -310,8 +302,7 @@ public class CoyoteAdapter implements Adapter {
 
 
     @Override
-    public void service(org.apache.coyote.Request req, org.apache.coyote.Response res)
-            throws Exception {
+    public void service(org.apache.coyote.Request req, org.apache.coyote.Response res) throws Exception {
 
         Request request = (Request) req.getNote(ADAPTER_NOTES);
         Response response = (Response) res.getNote(ADAPTER_NOTES);
@@ -350,12 +341,10 @@ public class CoyoteAdapter implements Adapter {
             // request parameters
             postParseSuccess = postParseRequest(req, request, res, response);
             if (postParseSuccess) {
-                //check valves if we support async
-                request.setAsyncSupported(
-                        connector.getService().getContainer().getPipeline().isAsyncSupported());
+                // check valves if we support async
+                request.setAsyncSupported(connector.getService().getContainer().getPipeline().isAsyncSupported());
                 // Calling the container
-                connector.getService().getContainer().getPipeline().getFirst().invoke(
-                        request, response);
+                connector.getService().getContainer().getPipeline().getFirst().invoke(request, response);
             }
             if (request.isAsync()) {
                 async = true;
@@ -374,8 +363,7 @@ public class CoyoteAdapter implements Adapter {
                     }
                 }
 
-                Throwable throwable =
-                        (Throwable) request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
+                Throwable throwable = (Throwable) request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
 
                 // If an async request was started, is not going to end once
                 // this container thread finishes and an error occurred, trigger
@@ -398,7 +386,7 @@ public class CoyoteAdapter implements Adapter {
                 // Connection will be forcibly closed which will prevent
                 // completion happening at the usual point. Need to trigger
                 // call to onComplete() here.
-                res.action(ActionCode.ASYNC_POST_PROCESS,  null);
+                res.action(ActionCode.ASYNC_POST_PROCESS, null);
                 async = false;
             }
 
@@ -423,8 +411,7 @@ public class CoyoteAdapter implements Adapter {
                     if (host != null) {
                         host.logAccess(request, response, time, false);
                     } else {
-                        connector.getService().getContainer().logAccess(
-                                request, response, time, false);
+                        connector.getService().getContainer().logAccess(request, response, time, false);
                     }
                 }
             }
@@ -463,8 +450,7 @@ public class CoyoteAdapter implements Adapter {
 
 
     @Override
-    public void log(org.apache.coyote.Request req,
-            org.apache.coyote.Response res, long time) {
+    public void log(org.apache.coyote.Request req, org.apache.coyote.Response res, long time) {
 
         Request request = (Request) req.getNote(ADAPTER_NOTES);
         Response response = (Response) res.getNote(ADAPTER_NOTES);
@@ -520,8 +506,7 @@ public class CoyoteAdapter implements Adapter {
     }
 
     @Override
-    public void checkRecycled(org.apache.coyote.Request req,
-            org.apache.coyote.Response res) {
+    public void checkRecycled(org.apache.coyote.Request req, org.apache.coyote.Response res) {
         Request request = (Request) req.getNote(ADAPTER_NOTES);
         Response response = (Response) res.getNote(ADAPTER_NOTES);
         String messageKey = null;
@@ -537,16 +522,14 @@ public class CoyoteAdapter implements Adapter {
 
             if (connector.getState().isAvailable()) {
                 if (log.isInfoEnabled()) {
-                    log.info(sm.getString(messageKey),
-                            new RecycleRequiredException());
+                    log.info(sm.getString(messageKey), new RecycleRequiredException());
                 }
             } else {
                 // There may be some aborted requests.
                 // When connector shuts down, the request and response will not
                 // be reused, so there is no issue to warn about here.
                 if (log.isDebugEnabled()) {
-                    log.debug(sm.getString(messageKey),
-                            new RecycleRequiredException());
+                    log.debug(sm.getString(messageKey), new RecycleRequiredException());
                 }
             }
         }
@@ -562,25 +545,22 @@ public class CoyoteAdapter implements Adapter {
     // ------------------------------------------------------ Protected Methods
 
     /**
-     * Perform the necessary processing after the HTTP headers have been parsed
-     * to enable the request/response pair to be passed to the start of the
-     * container pipeline for processing.
+     * Perform the necessary processing after the HTTP headers have been parsed to enable the request/response pair to
+     * be passed to the start of the container pipeline for processing.
      *
      * @param req      The coyote request object
      * @param request  The catalina request object
      * @param res      The coyote response object
      * @param response The catalina response object
      *
-     * @return <code>true</code> if the request should be passed on to the start
-     *         of the container pipeline, otherwise <code>false</code>
+     * @return <code>true</code> if the request should be passed on to the start of the container pipeline, otherwise
+     *             <code>false</code>
      *
-     * @throws IOException If there is insufficient space in a buffer while
-     *                     processing headers
-     * @throws ServletException If the supported methods of the target servlet
-     *                          cannot be determined
+     * @throws IOException      If there is insufficient space in a buffer while processing headers
+     * @throws ServletException If the supported methods of the target servlet cannot be determined
      */
-    protected boolean postParseRequest(org.apache.coyote.Request req, Request request,
-            org.apache.coyote.Response res, Response response) throws IOException, ServletException {
+    protected boolean postParseRequest(org.apache.coyote.Request req, Request request, org.apache.coyote.Response res,
+            Response response) throws IOException, ServletException {
 
         // If the processor has set the scheme (AJP does this, HTTP does this if
         // SSL is enabled) use this to set the secure flag as well. If the
@@ -656,7 +636,8 @@ public class CoyoteAdapter implements Adapter {
                 // URI decoding
                 // %xx decoding of the URL
                 try {
-                    req.getURLDecoder().convert(decodedURI.getByteChunk(), connector.getEncodedSolidusHandlingInternal());
+                    req.getURLDecoder().convert(decodedURI.getByteChunk(),
+                            connector.getEncodedSolidusHandlingInternal());
                 } catch (IOException ioe) {
                     response.sendError(400, sm.getString("coyoteAdapter.invalidURIWithMessage", ioe.getMessage()));
                 }
@@ -671,14 +652,11 @@ public class CoyoteAdapter implements Adapter {
                     response.sendError(400, sm.getString("coyoteAdapter.invalidURI"));
                 }
             } else {
-                /* The URI is chars or String, and has been sent using an in-memory
-                 * protocol handler. The following assumptions are made:
-                 * - req.requestURI() has been set to the 'original' non-decoded,
-                 *   non-normalized URI
-                 * - req.decodedURI() has been set to the decoded, normalized form
-                 *   of req.requestURI()
-                 * - 'suspicious' URI filtering - if required - has already been
-                 *   performed
+                /*
+                 * The URI is chars or String, and has been sent using an in-memory protocol handler. The following
+                 * assumptions are made: - req.requestURI() has been set to the 'original' non-decoded, non-normalized
+                 * URI - req.decodedURI() has been set to the decoded, normalized form of req.requestURI() -
+                 * 'suspicious' URI filtering - if required - has already been performed
                  */
                 decodedURI.toChars();
                 // Remove all path parameters; any needed path parameter should be set
@@ -718,8 +696,7 @@ public class CoyoteAdapter implements Adapter {
 
         while (mapRequired) {
             // This will map the the latest version by default
-            connector.getService().getMapper().map(serverName, decodedURI,
-                    version, request.getMappingData());
+            connector.getService().getMapper().map(serverName, decodedURI, version, request.getMappingData());
 
             // If there is no context at this point, either this is a 404
             // because no ROOT context has been deployed or the URI was invalid
@@ -739,13 +716,10 @@ public class CoyoteAdapter implements Adapter {
             // (if any). Need to do this before we redirect in case we need to
             // include the session id in the redirect
             String sessionID;
-            if (request.getServletContext().getEffectiveSessionTrackingModes()
-                    .contains(SessionTrackingMode.URL)) {
+            if (request.getServletContext().getEffectiveSessionTrackingModes().contains(SessionTrackingMode.URL)) {
 
                 // Get the session ID if there was one
-                sessionID = request.getPathParameter(
-                        SessionConfig.getSessionUriParamName(
-                                request.getContext()));
+                sessionID = request.getPathParameter(SessionConfig.getSessionUriParamName(request.getContext()));
                 if (sessionID != null) {
                     request.setRequestedSessionId(sessionID);
                     request.setRequestedSessionURL(true);
@@ -822,16 +796,13 @@ public class CoyoteAdapter implements Adapter {
         // Possible redirect
         MessageBytes redirectPathMB = request.getMappingData().redirectPath;
         if (!redirectPathMB.isNull()) {
-            String redirectPath = URLEncoder.DEFAULT.encode(
-                    redirectPathMB.toString(), StandardCharsets.UTF_8);
+            String redirectPath = URLEncoder.DEFAULT.encode(redirectPathMB.toString(), StandardCharsets.UTF_8);
             String query = request.getQueryString();
             if (request.isRequestedSessionIdFromURL()) {
                 // This is not optimal, but as this is not very common, it
                 // shouldn't matter
-                redirectPath = redirectPath + ";" +
-                        SessionConfig.getSessionUriParamName(
-                            request.getContext()) +
-                    "=" + request.getRequestedSessionId();
+                redirectPath = redirectPath + ";" + SessionConfig.getSessionUriParamName(request.getContext()) + "=" +
+                        request.getRequestedSessionId();
             }
             if (query != null) {
                 // This is not optimal, but as this is not very common, it
@@ -844,8 +815,7 @@ public class CoyoteAdapter implements Adapter {
         }
 
         // Filter TRACE method
-        if (!connector.getAllowTrace()
-                && req.method().equalsIgnoreCase("TRACE")) {
+        if (!connector.getAllowTrace() && req.method().equalsIgnoreCase("TRACE")) {
             Wrapper wrapper = request.getWrapper();
             String header = null;
             if (wrapper != null) {
@@ -892,8 +862,7 @@ public class CoyoteAdapter implements Adapter {
                     }
                     // Custom authenticator that may not trigger authorization.
                     // Do the authorization here to make sure it is done.
-                    request.setUserPrincipal(
-                            request.getContext().getRealm().authenticate(username));
+                    request.setUserPrincipal(request.getContext().getRealm().authenticate(username));
                 }
                 // If the Authenticator is an instance of AuthenticatorBase then
                 // it will check req.getRemoteUserNeedsAuthorization() and
@@ -915,16 +884,14 @@ public class CoyoteAdapter implements Adapter {
 
 
     /**
-     * Extract the path parameters from the request. This assumes parameters are
-     * of the form /path;name=value;name2=value2/ etc. Currently only really
-     * interested in the session ID that will be in this form. Other parameters
-     * can safely be ignored.
+     * Extract the path parameters from the request. This assumes parameters are of the form
+     * /path;name=value;name2=value2/ etc. Currently only really interested in the session ID that will be in this form.
+     * Other parameters can safely be ignored.
      *
-     * @param req The Coyote request object
+     * @param req     The Coyote request object
      * @param request The Servlet request object
      */
-    protected void parsePathParameters(org.apache.coyote.Request req,
-            Request request) {
+    protected void parsePathParameters(org.apache.coyote.Request req, Request request) {
 
         // Process in bytes (this is default format so this is normally a NO-OP
         req.decodedURI().toBytes();
@@ -945,10 +912,8 @@ public class CoyoteAdapter implements Adapter {
         Charset charset = connector.getURICharset();
 
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("coyoteAdapter.debug", "uriBC",
-                    uriBC.toString()));
-            log.debug(sm.getString("coyoteAdapter.debug", "semicolon",
-                    String.valueOf(semicolon)));
+            log.debug(sm.getString("coyoteAdapter.debug", "uriBC", uriBC.toString()));
+            log.debug(sm.getString("coyoteAdapter.debug", "semicolon", String.valueOf(semicolon)));
             log.debug(sm.getString("coyoteAdapter.debug", "enc", charset.name()));
         }
 
@@ -958,38 +923,31 @@ public class CoyoteAdapter implements Adapter {
             int end = uriBC.getEnd();
 
             int pathParamStart = semicolon + 1;
-            int pathParamEnd = ByteChunk.findBytes(uriBC.getBuffer(),
-                    start + pathParamStart, end,
-                    new byte[] {';', '/'});
+            int pathParamEnd = ByteChunk.findBytes(uriBC.getBuffer(), start + pathParamStart, end,
+                    new byte[] { ';', '/' });
 
             String pv = null;
 
             if (pathParamEnd >= 0) {
                 if (charset != null) {
-                    pv = new String(uriBC.getBuffer(), start + pathParamStart,
-                                pathParamEnd - pathParamStart, charset);
+                    pv = new String(uriBC.getBuffer(), start + pathParamStart, pathParamEnd - pathParamStart, charset);
                 }
                 // Extract path param from decoded request URI
                 byte[] buf = uriBC.getBuffer();
                 for (int i = 0; i < end - start - pathParamEnd; i++) {
-                    buf[start + semicolon + i]
-                        = buf[start + i + pathParamEnd];
+                    buf[start + semicolon + i] = buf[start + i + pathParamEnd];
                 }
-                uriBC.setBytes(buf, start,
-                        end - start - pathParamEnd + semicolon);
+                uriBC.setBytes(buf, start, end - start - pathParamEnd + semicolon);
             } else {
                 if (charset != null) {
-                    pv = new String(uriBC.getBuffer(), start + pathParamStart,
-                                (end - start) - pathParamStart, charset);
+                    pv = new String(uriBC.getBuffer(), start + pathParamStart, (end - start) - pathParamStart, charset);
                 }
                 uriBC.setEnd(start + semicolon);
             }
 
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("coyoteAdapter.debug", "pathParamStart",
-                        String.valueOf(pathParamStart)));
-                log.debug(sm.getString("coyoteAdapter.debug", "pathParamEnd",
-                        String.valueOf(pathParamEnd)));
+                log.debug(sm.getString("coyoteAdapter.debug", "pathParamStart", String.valueOf(pathParamStart)));
+                log.debug(sm.getString("coyoteAdapter.debug", "pathParamEnd", String.valueOf(pathParamEnd)));
                 log.debug(sm.getString("coyoteAdapter.debug", "pv", pv));
             }
 
@@ -1000,12 +958,9 @@ public class CoyoteAdapter implements Adapter {
                     String value = pv.substring(equals + 1);
                     request.addPathParameter(name, value);
                     if (log.isDebugEnabled()) {
-                        log.debug(sm.getString("coyoteAdapter.debug", "equals",
-                                String.valueOf(equals)));
-                        log.debug(sm.getString("coyoteAdapter.debug", "name",
-                                name));
-                        log.debug(sm.getString("coyoteAdapter.debug", "value",
-                                value));
+                        log.debug(sm.getString("coyoteAdapter.debug", "equals", String.valueOf(equals)));
+                        log.debug(sm.getString("coyoteAdapter.debug", "name", name));
+                        log.debug(sm.getString("coyoteAdapter.debug", "value", value));
                     }
                 }
             }
@@ -1016,16 +971,14 @@ public class CoyoteAdapter implements Adapter {
 
 
     /**
-     * Look for SSL session ID if required. Only look for SSL Session ID if it
-     * is the only tracking method enabled.
+     * Look for SSL session ID if required. Only look for SSL Session ID if it is the only tracking method enabled.
      *
      * @param request The Servlet request object
      */
     protected void parseSessionSslId(Request request) {
         if (request.getRequestedSessionId() == null &&
-                SSL_ONLY.equals(request.getServletContext()
-                        .getEffectiveSessionTrackingModes()) &&
-                        request.connector.secure) {
+                SSL_ONLY.equals(request.getServletContext().getEffectiveSessionTrackingModes()) &&
+                request.connector.secure) {
             String sessionId = (String) request.getAttribute(SSLSupport.SESSION_ID_KEY);
             if (sessionId != null) {
                 request.setRequestedSessionId(sessionId);
@@ -1047,9 +1000,8 @@ public class CoyoteAdapter implements Adapter {
         // from a parent context with a session ID may be present which would
         // overwrite the valid session ID encoded in the URL
         Context context = request.getMappingData().context;
-        if (context != null && !context.getServletContext()
-                .getEffectiveSessionTrackingModes().contains(
-                        SessionTrackingMode.COOKIE)) {
+        if (context != null &&
+                !context.getServletContext().getEffectiveSessionTrackingModes().contains(SessionTrackingMode.COOKIE)) {
             return;
         }
 
@@ -1069,20 +1021,17 @@ public class CoyoteAdapter implements Adapter {
                 if (!request.isRequestedSessionIdFromCookie()) {
                     // Accept only the first session id cookie
                     convertMB(scookie.getValue());
-                    request.setRequestedSessionId
-                        (scookie.getValue().toString());
+                    request.setRequestedSessionId(scookie.getValue().toString());
                     request.setRequestedSessionCookie(true);
                     request.setRequestedSessionURL(false);
                     if (log.isDebugEnabled()) {
-                        log.debug(" Requested cookie session id is " +
-                            request.getRequestedSessionId());
+                        log.debug(" Requested cookie session id is " + request.getRequestedSessionId());
                     }
                 } else {
                     if (!request.isRequestedSessionIdValid()) {
                         // Replace the session id until one is valid
                         convertMB(scookie.getValue());
-                        request.setRequestedSessionId
-                            (scookie.getValue().toString());
+                        request.setRequestedSessionId(scookie.getValue().toString());
                     }
                 }
             }
@@ -1094,8 +1043,9 @@ public class CoyoteAdapter implements Adapter {
     /**
      * Character conversion of the URI.
      *
-     * @param uri MessageBytes object containing the URI
+     * @param uri     MessageBytes object containing the URI
      * @param request The Servlet request object
+     *
      * @throws IOException if a IO exception occurs sending an error to the client
      */
     protected void convertURI(MessageBytes uri, Request request) throws IOException {
@@ -1158,12 +1108,11 @@ public class CoyoteAdapter implements Adapter {
     /**
      * This method normalizes "\", "//", "/./" and "/../".
      *
-     * @param uriMB URI to be normalized
+     * @param uriMB          URI to be normalized
      * @param allowBackslash <code>true</code> if backslash characters are allowed in URLs
      *
-     * @return <code>false</code> if normalizing this URI would require going
-     *         above the root, or if the URI contains a null byte, otherwise
-     *         <code>true</code>
+     * @return <code>false</code> if normalizing this URI would require going above the root, or if the URI contains a
+     *             null byte, otherwise <code>true</code>
      */
     public static boolean normalize(MessageBytes uriMB, boolean allowBackslash) {
 
@@ -1215,9 +1164,7 @@ public class CoyoteAdapter implements Adapter {
         // Note: It is possible to extend the URI by 1 without any side effect
         // as the next character is a non-significant WS.
         if (((end - start) >= 2) && (b[end - 1] == (byte) '.')) {
-            if ((b[end - 2] == (byte) '/')
-                || ((b[end - 2] == (byte) '.')
-                    && (b[end - 3] == (byte) '/'))) {
+            if ((b[end - 2] == (byte) '/') || ((b[end - 2] == (byte) '.') && (b[end - 3] == (byte) '/'))) {
                 b[end] = (byte) '/';
                 end++;
                 appendedSlash = true;
@@ -1234,8 +1181,7 @@ public class CoyoteAdapter implements Adapter {
             if (index < 0) {
                 break;
             }
-            copyBytes(b, start + index, start + index + 2,
-                      end - start - index - 2);
+            copyBytes(b, start + index, start + index + 2, end - start - index - 2);
             end = end - 2;
             uriBC.setEnd(end);
         }
@@ -1253,13 +1199,12 @@ public class CoyoteAdapter implements Adapter {
                 return false;
             }
             int index2 = -1;
-            for (pos = start + index - 1; (pos >= 0) && (index2 < 0); pos --) {
+            for (pos = start + index - 1; (pos >= 0) && (index2 < 0); pos--) {
                 if (b[pos] == (byte) '/') {
                     index2 = pos;
                 }
             }
-            copyBytes(b, start + index2, start + index + 3,
-                      end - start - index - 3);
+            copyBytes(b, start + index2, start + index + 3, end - start - index - 3);
             end = end + index2 - index - 3;
             uriBC.setEnd(end);
             index = index2;
@@ -1267,8 +1212,8 @@ public class CoyoteAdapter implements Adapter {
 
         // If a slash was appended to help normalize "/." or "/.." then remove
         // any trailing "/" from the result unless the result is "/".
-        if (appendedSlash && end > 1 && b[end - 1]== '/') {
-            uriBC.setEnd(end -1);
+        if (appendedSlash && end > 1 && b[end - 1] == '/') {
+            uriBC.setEnd(end - 1);
         }
 
         return true;
@@ -1276,13 +1221,12 @@ public class CoyoteAdapter implements Adapter {
 
 
     /**
-     * Copy an array of bytes to a different position. Used during
-     * normalization.
+     * Copy an array of bytes to a different position. Used during normalization.
      *
-     * @param b The bytes that should be copied
+     * @param b    The bytes that should be copied
      * @param dest Destination offset
-     * @param src Source offset
-     * @param len Length
+     * @param src  Source offset
+     * @param len  Length
      */
     protected static void copyBytes(byte[] b, int dest, int src, int len) {
         System.arraycopy(b, src, b, dest, len);
@@ -1320,7 +1264,8 @@ public class CoyoteAdapter implements Adapter {
                 if (bytes[pos] == '.') {
                     dotCount++;
                     pos++;
-                } else if (pos + 2 < end && bytes[pos] == '%' && bytes[pos + 1] == '2' && (bytes[pos+2] == 'e' || bytes[pos+2] == 'E')) {
+                } else if (pos + 2 < end && bytes[pos] == '%' && bytes[pos + 1] == '2' &&
+                        (bytes[pos + 2] == 'e' || bytes[pos + 2] == 'E')) {
                     encodedDot = true;
                     dotCount++;
                     pos += 3;
diff --git a/java/org/apache/catalina/connector/CoyoteInputStream.java b/java/org/apache/catalina/connector/CoyoteInputStream.java
index a1588d455d..4921119852 100644
--- a/java/org/apache/catalina/connector/CoyoteInputStream.java
+++ b/java/org/apache/catalina/connector/CoyoteInputStream.java
@@ -117,8 +117,7 @@ public class CoyoteInputStream extends ServletInputStream {
 
         if (SecurityUtil.isPackageProtectionEnabled()) {
             try {
-                Integer result = AccessController.doPrivileged(
-                        new PrivilegedReadArray(ib, b, off, len));
+                Integer result = AccessController.doPrivileged(new PrivilegedReadArray(ib, b, off, len));
                 return result.intValue();
             } catch (PrivilegedActionException pae) {
                 Exception e = pae.getException();
@@ -135,14 +134,14 @@ public class CoyoteInputStream extends ServletInputStream {
 
 
     /**
-     * Transfers bytes from the buffer to the specified ByteBuffer. After the
-     * operation the position of the ByteBuffer will be returned to the one
-     * before the operation, the limit will be the position incremented by
-     * the number of the transferred bytes.
+     * Transfers bytes from the buffer to the specified ByteBuffer. After the operation the position of the ByteBuffer
+     * will be returned to the one before the operation, the limit will be the position incremented by the number of the
+     * transferred bytes.
      *
      * @param b the ByteBuffer into which bytes are to be written.
-     * @return an integer specifying the actual number of bytes read, or -1 if
-     *         the end of the stream is reached
+     *
+     * @return an integer specifying the actual number of bytes read, or -1 if the end of the stream is reached
+     *
      * @throws IOException if an input or output exception has occurred
      */
     public int read(final ByteBuffer b) throws IOException {
@@ -167,9 +166,7 @@ public class CoyoteInputStream extends ServletInputStream {
 
 
     /**
-     * Close the stream
-     * Since we re-cycle, we can't allow the call to super.close()
-     * which would permanently disable us.
+     * Close the stream Since we re-cycle, we can't allow the call to super.close() which would permanently disable us.
      */
     @Override
     public void close() throws IOException {
diff --git a/java/org/apache/catalina/connector/CoyoteOutputStream.java b/java/org/apache/catalina/connector/CoyoteOutputStream.java
index ee005387b3..a2c570d4cd 100644
--- a/java/org/apache/catalina/connector/CoyoteOutputStream.java
+++ b/java/org/apache/catalina/connector/CoyoteOutputStream.java
@@ -123,12 +123,10 @@ public class CoyoteOutputStream extends ServletOutputStream {
 
 
     /**
-     * Checks for concurrent writes which are not permitted. This object has no
-     * state information so the call chain is
+     * Checks for concurrent writes which are not permitted. This object has no state information so the call chain is
      * CoyoteOutputStream->OutputBuffer->CoyoteResponse.
      *
-     * @return <code>true</code> if this OutputStream is currently in
-     *         non-blocking mode.
+     * @return <code>true</code> if this OutputStream is currently in non-blocking mode.
      */
     private boolean checkNonBlockingWrite() {
         boolean nonBlocking = !ob.isBlocking();
@@ -140,12 +138,10 @@ public class CoyoteOutputStream extends ServletOutputStream {
 
 
     /**
-     * Checks to see if there is data left in the Coyote output buffers (NOT the
-     * servlet output buffer) and if so registers the associated socket for
-     * write so the buffers will be emptied. The container will take care of
-     * this. As far as the app is concerned, there is a non-blocking write in
-     * progress. It doesn't have visibility of whether the data is buffered in
-     * the socket buffer or the Coyote buffers.
+     * Checks to see if there is data left in the Coyote output buffers (NOT the servlet output buffer) and if so
+     * registers the associated socket for write so the buffers will be emptied. The container will take care of this.
+     * As far as the app is concerned, there is a non-blocking write in progress. It doesn't have visibility of whether
+     * the data is buffered in the socket buffer or the Coyote buffers.
      */
     private void checkRegisterForWrite() {
         ob.checkRegisterForWrite();
diff --git a/java/org/apache/catalina/connector/CoyotePrincipal.java b/java/org/apache/catalina/connector/CoyotePrincipal.java
index c20db11c9f..30b69252c6 100644
--- a/java/org/apache/catalina/connector/CoyotePrincipal.java
+++ b/java/org/apache/catalina/connector/CoyotePrincipal.java
@@ -20,8 +20,8 @@ import java.io.Serializable;
 import java.security.Principal;
 
 /**
- * Generic implementation of <strong>java.security.Principal</strong> that
- * is used to represent principals authenticated at the protocol handler level.
+ * Generic implementation of <strong>java.security.Principal</strong> that is used to represent principals authenticated
+ * at the protocol handler level.
  *
  * @author Remy Maucherat
  */
@@ -57,8 +57,7 @@ public class CoyotePrincipal implements Principal, Serializable {
 
 
     /**
-     * Return a String representation of this object, which exposes only
-     * information that should be public.
+     * Return a String representation of this object, which exposes only information that should be public.
      */
     @Override
     public String toString() {
diff --git a/java/org/apache/catalina/connector/CoyoteReader.java b/java/org/apache/catalina/connector/CoyoteReader.java
index 45ce8f7938..194953cdaf 100644
--- a/java/org/apache/catalina/connector/CoyoteReader.java
+++ b/java/org/apache/catalina/connector/CoyoteReader.java
@@ -25,8 +25,7 @@ import java.io.IOException;
  *
  * @author Remy Maucherat
  */
-public class CoyoteReader
-    extends BufferedReader {
+public class CoyoteReader extends BufferedReader {
 
 
     // -------------------------------------------------------------- Constants
@@ -61,8 +60,7 @@ public class CoyoteReader
      * Prevent cloning the facade.
      */
     @Override
-    protected Object clone()
-        throws CloneNotSupportedException {
+    protected Object clone() throws CloneNotSupportedException {
         throw new CloneNotSupportedException();
     }
 
@@ -82,43 +80,37 @@ public class CoyoteReader
 
 
     @Override
-    public void close()
-        throws IOException {
+    public void close() throws IOException {
         ib.close();
     }
 
 
     @Override
-    public int read()
-        throws IOException {
+    public int read() throws IOException {
         return ib.read();
     }
 
 
     @Override
-    public int read(char[] cbuf)
-        throws IOException {
+    public int read(char[] cbuf) throws IOException {
         return ib.read(cbuf, 0, cbuf.length);
     }
 
 
     @Override
-    public int read(char[] cbuf, int off, int len)
-        throws IOException {
+    public int read(char[] cbuf, int off, int len) throws IOException {
         return ib.read(cbuf, off, len);
     }
 
 
     @Override
-    public long skip(long n)
-        throws IOException {
+    public long skip(long n) throws IOException {
         return ib.skip(n);
     }
 
 
     @Override
-    public boolean ready()
-        throws IOException {
+    public boolean ready() throws IOException {
         return ib.ready();
     }
 
@@ -130,26 +122,23 @@ public class CoyoteReader
 
 
     @Override
-    public void mark(int readAheadLimit)
-        throws IOException {
+    public void mark(int readAheadLimit) throws IOException {
         ib.mark(readAheadLimit);
     }
 
 
     @Override
-    public void reset()
-        throws IOException {
+    public void reset() throws IOException {
         ib.reset();
     }
 
 
     @Override
-    public String readLine()
-        throws IOException {
+    public String readLine() throws IOException {
 
         if (lineBuffer == null) {
             lineBuffer = new char[MAX_LINE_LENGTH];
-       }
+        }
 
         String result = null;
 
@@ -176,7 +165,7 @@ public class CoyoteReader
                         if (i == (pos + nRead - 1)) {
                             nextchar = (char) read();
                         } else {
-                            nextchar = lineBuffer[i+1];
+                            nextchar = lineBuffer[i + 1];
                         }
                         if (nextchar == LINE_SEP[1]) {
                             skip++;
diff --git a/java/org/apache/catalina/connector/CoyoteWriter.java b/java/org/apache/catalina/connector/CoyoteWriter.java
index 2be8fb9eb9..6eef35949d 100644
--- a/java/org/apache/catalina/connector/CoyoteWriter.java
+++ b/java/org/apache/catalina/connector/CoyoteWriter.java
@@ -55,8 +55,7 @@ public class CoyoteWriter extends PrintWriter {
      * Prevent cloning the facade.
      */
     @Override
-    protected Object clone()
-        throws CloneNotSupportedException {
+    protected Object clone() throws CloneNotSupportedException {
         throw new CloneNotSupportedException();
     }
 
@@ -106,7 +105,7 @@ public class CoyoteWriter extends PrintWriter {
         // so the stream can be reused. We close ob.
         try {
             ob.close();
-        } catch (IOException ex ) {
+        } catch (IOException ex) {
             // Ignore
         }
         error = false;
diff --git a/java/org/apache/catalina/connector/InputBuffer.java b/java/org/apache/catalina/connector/InputBuffer.java
index da736cc1bd..1e1967b715 100644
--- a/java/org/apache/catalina/connector/InputBuffer.java
+++ b/java/org/apache/catalina/connector/InputBuffer.java
@@ -42,15 +42,13 @@ import org.apache.tomcat.util.net.ApplicationBufferHandler;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * The buffer used by Tomcat request. This is a derivative of the Tomcat 3.3
- * OutputBuffer, adapted to handle input instead of output. This allows
- * complete recycling of the facade objects (the ServletInputStream and the
+ * The buffer used by Tomcat request. This is a derivative of the Tomcat 3.3 OutputBuffer, adapted to handle input
+ * instead of output. This allows complete recycling of the facade objects (the ServletInputStream and the
  * BufferedReader).
  *
  * @author Remy Maucherat
  */
-public class InputBuffer extends Reader
-    implements ByteChunk.ByteInputChannel, ApplicationBufferHandler {
+public class InputBuffer extends Reader implements ByteChunk.ByteInputChannel, ApplicationBufferHandler {
 
     /**
      * The string manager for this package.
@@ -215,8 +213,7 @@ public class InputBuffer extends Reader
     public int available() {
         int available = availableInThisBuffer();
         if (available == 0) {
-            coyoteRequest.action(ActionCode.AVAILABLE,
-                    Boolean.valueOf(coyoteRequest.getReadListener() != null));
+            coyoteRequest.action(ActionCode.AVAILABLE, Boolean.valueOf(coyoteRequest.getReadListener() != null));
             available = (coyoteRequest.getAvailable() > 0) ? 1 : 0;
         }
         return available;
@@ -346,14 +343,14 @@ public class InputBuffer extends Reader
 
 
     /**
-     * Transfers bytes from the buffer to the specified ByteBuffer. After the
-     * operation the position of the ByteBuffer will be returned to the one
-     * before the operation, the limit will be the position incremented by
-     * the number of the transferred bytes.
+     * Transfers bytes from the buffer to the specified ByteBuffer. After the operation the position of the ByteBuffer
+     * will be returned to the one before the operation, the limit will be the position incremented by the number of the
+     * transferred bytes.
      *
      * @param to the ByteBuffer into which bytes are to be written.
-     * @return an integer specifying the actual number of bytes read, or -1 if
-     *         the end of the stream is reached
+     *
+     * @return an integer specifying the actual number of bytes read, or -1 if the end of the stream is reached
+     *
      * @throws IOException if an input or output exception has occurred
      */
     public int read(ByteBuffer to) throws IOException {
@@ -620,17 +617,17 @@ public class InputBuffer extends Reader
 
     private void makeSpace(int count) {
         int desiredSize = cb.limit() + count;
-        if(desiredSize > readLimit) {
+        if (desiredSize > readLimit) {
             desiredSize = readLimit;
         }
 
-        if(desiredSize <= cb.capacity()) {
+        if (desiredSize <= cb.capacity()) {
             return;
         }
 
         int newSize = 2 * cb.capacity();
-        if(desiredSize >= newSize) {
-            newSize= 2 * cb.capacity() + count;
+        if (desiredSize >= newSize) {
+            newSize = 2 * cb.capacity() + count;
         }
 
         if (newSize > readLimit) {
@@ -648,8 +645,7 @@ public class InputBuffer extends Reader
     }
 
 
-    private static class PrivilegedCreateConverter
-            implements PrivilegedExceptionAction<B2CConverter> {
+    private static class PrivilegedCreateConverter implements PrivilegedExceptionAction<B2CConverter> {
 
         private final Charset charset;
 
diff --git a/java/org/apache/catalina/connector/OutputBuffer.java b/java/org/apache/catalina/connector/OutputBuffer.java
index 378d92926b..62966c653b 100644
--- a/java/org/apache/catalina/connector/OutputBuffer.java
+++ b/java/org/apache/catalina/connector/OutputBuffer.java
@@ -40,9 +40,8 @@ import org.apache.tomcat.util.buf.C2BConverter;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * The buffer used by Tomcat response. This is a derivative of the Tomcat 3.3
- * OutputBuffer, with the removal of some of the state handling (which in
- * Coyote is mostly the Processor's responsibility).
+ * The buffer used by Tomcat response. This is a derivative of the Tomcat 3.3 OutputBuffer, with the removal of some of
+ * the state handling (which in Coyote is mostly the Processor's responsibility).
  *
  * @author Costin Manolache
  * @author Remy Maucherat
@@ -213,8 +212,7 @@ public class OutputBuffer extends Writer {
 
 
     /**
-     * Close the output buffer. This tries to calculate the response size if
-     * the response has not been committed yet.
+     * Close the output buffer. This tries to calculate the response size if the response has not been committed yet.
      *
      * @throws IOException An underlying IOException occurred
      */
@@ -274,6 +272,7 @@ public class OutputBuffer extends Writer {
      * Flush bytes or chars contained in the buffer.
      *
      * @param realFlush <code>true</code> if this should also cause a real network flush
+     *
      * @throws IOException An underlying IOException occurred
      */
     protected void doFlush(boolean realFlush) throws IOException {
@@ -313,8 +312,7 @@ public class OutputBuffer extends Writer {
     // ------------------------------------------------- Bytes Handling Methods
 
     /**
-     * Sends the buffer data to the client output, checking the
-     * state of Response and calling the right interceptors.
+     * Sends the buffer data to the client output, checking the state of Response and calling the right interceptors.
      *
      * @param buf the ByteBuffer to be written to the response
      *
@@ -594,7 +592,7 @@ public class OutputBuffer extends Writer {
     }
 
 
-    // --------------------  BufferedOutputStream compatibility
+    // -------------------- BufferedOutputStream compatibility
 
     public long getContentWritten() {
         return bytesWritten + charsWritten;
@@ -603,8 +601,7 @@ public class OutputBuffer extends Writer {
     /**
      * Has this buffer been used at all?
      *
-     * @return true if no chars or bytes have been added to the buffer since the
-     *         last call to {@link #recycle()}
+     * @return true if no chars or bytes have been added to the buffer since the last call to {@link #recycle()}
      */
     public boolean isNew() {
         return (bytesWritten == 0) && (charsWritten == 0);
@@ -644,8 +641,8 @@ public class OutputBuffer extends Writer {
 
 
     /*
-     * All the non-blocking write state information is held in the Response so
-     * it is visible / accessible to all the code that needs it.
+     * All the non-blocking write state information is held in the Response so it is visible / accessible to all the
+     * code that needs it.
      */
 
     public boolean isReady() {
@@ -672,6 +669,7 @@ public class OutputBuffer extends Writer {
      * @param src Bytes array
      * @param off Offset
      * @param len Length
+     *
      * @throws IOException Writing overflow data to the output channel failed
      */
     public void append(byte src[], int off, int len) throws IOException {
@@ -690,14 +688,16 @@ public class OutputBuffer extends Writer {
 
     /**
      * Add data to the buffer.
+     *
      * @param src Char array
      * @param off Offset
      * @param len Length
+     *
      * @throws IOException Writing overflow data to the output channel failed
      */
     public void append(char src[], int off, int len) throws IOException {
         // if we have limit and we're below
-        if(len <= cb.capacity() - cb.limit()) {
+        if (len <= cb.capacity() - cb.limit()) {
             transfer(src, off, len, cb);
             return;
         }
@@ -708,11 +708,11 @@ public class OutputBuffer extends Writer {
         // copy the first part, flush, then copy the second part - 1 write
         // and still have some space for more. We'll still have 2 writes, but
         // we write more on the first.
-        if(len + cb.limit() < 2 * cb.capacity()) {
-            /* If the request length exceeds the size of the output buffer,
-               flush the output buffer and then write the data directly.
-               We can't avoid 2 writes, but we can write more on the second
-            */
+        if (len + cb.limit() < 2 * cb.capacity()) {
+            /*
+             * If the request length exceeds the size of the output buffer, flush the output buffer and then write the
+             * data directly. We can't avoid 2 writes, but we can write more on the second
+             */
             int n = transfer(src, off, len, cb);
 
             flushCharBuffer();
@@ -849,19 +849,15 @@ public class OutputBuffer extends Writer {
     }
 
     private void toReadMode(Buffer buffer) {
-        buffer.limit(buffer.position())
-              .reset();
+        buffer.limit(buffer.position()).reset();
     }
 
     private void toWriteMode(Buffer buffer) {
-        buffer.mark()
-              .position(buffer.limit())
-              .limit(buffer.capacity());
+        buffer.mark().position(buffer.limit()).limit(buffer.capacity());
     }
 
 
-    private static class PrivilegedCreateConverter
-            implements PrivilegedExceptionAction<C2BConverter> {
+    private static class PrivilegedCreateConverter implements PrivilegedExceptionAction<C2BConverter> {
 
         private final Charset charset;
 
diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java
index 89d3f8fe70..b645604360 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -134,10 +134,9 @@ public class Request implements HttpServletRequest {
     /**
      * Create a new Request object associated with the given Connector.
      *
-     * @param connector The Connector with which this Request object will always
-     *                  be associated. In normal usage this must be non-null. In
-     *                  some test scenarios, it may be possible to use a null
-     *                  Connector without triggering an NPE.
+     * @param connector The Connector with which this Request object will always be associated. In normal usage this
+     *                      must be non-null. In some test scenarios, it may be possible to use a null Connector without
+     *                      triggering an NPE.
      */
     public Request(Connector connector) {
         this.connector = connector;
@@ -199,9 +198,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Flag that indicates if SSL attributes have been parsed to improve
-     * performance for applications (usually frameworks) that make multiple
-     * calls to {@link Request#getAttributeNames()}.
+     * Flag that indicates if SSL attributes have been parsed to improve performance for applications (usually
+     * frameworks) that make multiple calls to {@link Request#getAttributeNames()}.
      */
     protected boolean sslAttributesParsed = false;
 
@@ -213,8 +211,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Internal notes associated with this request by Catalina components
-     * and event listeners.
+     * Internal notes associated with this request by Catalina components and event listeners.
      */
     private final transient HashMap<String, Object> notes = new HashMap<>();
 
@@ -240,8 +237,7 @@ public class Request implements HttpServletRequest {
     /**
      * ServletInputStream.
      */
-    protected CoyoteInputStream inputStream =
-            new CoyoteInputStream(inputBuffer);
+    protected CoyoteInputStream inputStream = new CoyoteInputStream(inputBuffer);
 
 
     /**
@@ -275,15 +271,13 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Cookie headers parsed flag. Indicates that the cookie headers have been
-     * parsed into ServerCookies.
+     * Cookie headers parsed flag. Indicates that the cookie headers have been parsed into ServerCookies.
      */
     protected boolean cookiesParsed = false;
 
 
     /**
-     * Cookie parsed flag. Indicates that the ServerCookies have been converted
-     * into user facing Cookie objects.
+     * Cookie parsed flag. Indicates that the ServerCookies have been converted into user facing Cookie objects.
      */
     protected boolean cookiesConverted = false;
 
@@ -431,8 +425,7 @@ public class Request implements HttpServletRequest {
     }
 
     /**
-     * Release all object references, and initialize instance variables, in
-     * preparation for reuse of this object.
+     * Release all object references, and initialize instance variables, in preparation for reuse of this object.
      */
     public void recycle() {
 
@@ -447,7 +440,7 @@ public class Request implements HttpServletRequest {
         subject = null;
         parametersParsed = false;
         if (parts != null) {
-            for (Part part: parts) {
+            for (Part part : parts) {
                 try {
                     part.delete();
                 } catch (IOException ignored) {
@@ -502,7 +495,7 @@ public class Request implements HttpServletRequest {
         }
 
         asyncSupported = null;
-        if (asyncContext!=null) {
+        if (asyncContext != null) {
             asyncContext.recycle();
         }
         asyncContext = null;
@@ -554,9 +547,8 @@ public class Request implements HttpServletRequest {
     /**
      * Return the Context within which this Request is being processed.
      * <p>
-     * This is available as soon as the appropriate Context is identified.
-     * Note that availability of a Context allows <code>getContextPath()</code>
-     * to return a value, and thus enables parsing of the request URI.
+     * This is available as soon as the appropriate Context is identified. Note that availability of a Context allows
+     * <code>getContextPath()</code> to return a value, and thus enables parsing of the request URI.
      *
      * @return the Context mapped with the request
      */
@@ -567,8 +559,9 @@ public class Request implements HttpServletRequest {
 
     /**
      * Get the recycling strategy of the facade objects.
-     * @return the value of the flag as set on the connector, or
-     *   <code>true</code> if no connector is associated with this request
+     *
+     * @return the value of the flag as set on the connector, or <code>true</code> if no connector is associated with
+     *             this request
      */
     public boolean getDiscardFacades() {
         return (connector == null) ? true : connector.getDiscardFacades();
@@ -628,8 +621,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the <code>ServletRequest</code> for which this object
-     * is the facade.  This method must be implemented by a subclass.
+     * @return the <code>ServletRequest</code> for which this object is the facade. This method must be implemented by a
+     *             subclass.
      */
     public HttpServletRequest getRequest() {
         if (facade == null) {
@@ -643,10 +636,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Set a wrapped HttpServletRequest to pass to the application. Components
-     * wishing to wrap the request should obtain the request via
-     * {@link #getRequest()}, wrap it and then call this method with the
-     * wrapped request.
+     * Set a wrapped HttpServletRequest to pass to the application. Components wishing to wrap the request should obtain
+     * the request via {@link #getRequest()}, wrap it and then call this method with the wrapped request.
      *
      * @param applicationRequest The wrapped request to pass to the application
      */
@@ -727,14 +718,13 @@ public class Request implements HttpServletRequest {
     // ------------------------------------------------- Request Public Methods
 
     /**
-     * Create and return a ServletInputStream to read the content
-     * associated with this Request.
+     * Create and return a ServletInputStream to read the content associated with this Request.
      *
      * @return the created input stream
+     *
      * @exception IOException if an input/output error occurs
      */
-    public ServletInputStream createInputStream()
-            throws IOException {
+    public ServletInputStream createInputStream() throws IOException {
         if (inputStream == null) {
             inputStream = new CoyoteInputStream(inputBuffer);
         }
@@ -743,8 +733,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Perform whatever actions are required to flush and close the input
-     * stream or reader, in a single operation.
+     * Perform whatever actions are required to flush and close the input stream or reader, in a single operation.
      *
      * @exception IOException if an input/output error occurs
      */
@@ -756,8 +745,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the object bound with the specified name to the internal notes
-     * for this request, or <code>null</code> if no such binding exists.
+     * @return the object bound with the specified name to the internal notes for this request, or <code>null</code> if
+     *             no such binding exists.
      *
      * @param name Name of the note to be returned
      */
@@ -767,8 +756,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Remove any object bound to the specified name in the internal notes
-     * for this request.
+     * Remove any object bound to the specified name in the internal notes for this request.
      *
      * @param name Name of the note to be removed
      */
@@ -787,10 +775,10 @@ public class Request implements HttpServletRequest {
     }
 
     /**
-     * Bind an object to a specified name in the internal notes associated
-     * with this request, replacing any existing binding for this name.
+     * Bind an object to a specified name in the internal notes associated with this request, replacing any existing
+     * binding for this name.
      *
-     * @param name Name to which the object should be bound
+     * @param name  Name to which the object should be bound
      * @param value Object to be bound to the specified name
      */
     public void setNote(String name, Object value) {
@@ -809,8 +797,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Set the fully qualified name of the remote client associated with this
-     * Request.
+     * Set the fully qualified name of the remote client associated with this Request.
      *
      * @param remoteHost The remote host name
      */
@@ -820,8 +807,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Set the value to be returned by <code>isSecure()</code>
-     * for this Request.
+     * Set the value to be returned by <code>isSecure()</code> for this Request.
      *
      * @param secure The new isSecure value
      */
@@ -843,8 +829,7 @@ public class Request implements HttpServletRequest {
     // ------------------------------------------------- ServletRequest Methods
 
     /**
-     * @return the specified request attribute if it exists; otherwise, return
-     * <code>null</code>.
+     * @return the specified request attribute if it exists; otherwise, return <code>null</code>.
      *
      * @param name Name of the request attribute to return
      */
@@ -914,12 +899,10 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Return the names of all request attributes for this Request, or an
-     * empty <code>Enumeration</code> if there are none. Note that 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:
+     * Return the names of all request attributes for this Request, or an empty <code>Enumeration</code> if there are
+     * none. Note that 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>
@@ -931,13 +914,13 @@ public class Request implements HttpServletRequest {
      * <li>{@link Globals#SSL_SESSION_MGR_ATTR} (SSL connections only)</li>
      * <li>{@link Globals#PARAMETER_PARSE_FAILED_ATTR}</li>
      * </ul>
-     * The underlying connector may also expose request attributes. These all
-     * have names starting with "org.apache.tomcat" and include:
+     * The underlying connector may also expose request attributes. These all have names starting with
+     * "org.apache.tomcat" and include:
      * <ul>
      * <li>{@link Globals#SENDFILE_SUPPORTED_ATTR}</li>
      * </ul>
-     * Connector implementations may return some, all or none of these
-     * attributes and may also support additional attributes.
+     * Connector implementations may return some, all or none of these attributes and may also support additional
+     * attributes.
      *
      * @return the attribute names enumeration
      */
@@ -1028,13 +1011,11 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the servlet input stream for this Request.  The default
-     * implementation returns a servlet input stream created by
-     * <code>createInputStream()</code>.
+     * @return the servlet input stream for this Request. The default implementation returns a servlet input stream
+     *             created by <code>createInputStream()</code>.
      *
-     * @exception IllegalStateException if <code>getReader()</code> has
-     *  already been called for this request
-     * @exception IOException if an input/output error occurs
+     * @exception IllegalStateException if <code>getReader()</code> has already been called for this request
+     * @exception IOException           if an input/output error occurs
      */
     @Override
     public ServletInputStream getInputStream() throws IOException {
@@ -1053,10 +1034,9 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the preferred Locale that the client will accept content in,
-     * based on the value for the first <code>Accept-Language</code> header
-     * that was encountered.  If the request did not specify a preferred
-     * language, the server's default Locale is returned.
+     * @return the preferred Locale that the client will accept content in, based on the value for the first
+     *             <code>Accept-Language</code> header that was encountered. If the request did not specify a preferred
+     *             language, the server's default Locale is returned.
      */
     @Override
     public Locale getLocale() {
@@ -1074,10 +1054,9 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the set of preferred Locales that the client will accept
-     * content in, based on the values for any <code>Accept-Language</code>
-     * headers that were encountered.  If the request did not specify a
-     * preferred language, the server's default Locale is returned.
+     * @return the set of preferred Locales that the client will accept content in, based on the values for any
+     *             <code>Accept-Language</code> headers that were encountered. If the request did not specify a
+     *             preferred language, the server's default Locale is returned.
      */
     @Override
     public Enumeration<Locale> getLocales() {
@@ -1097,9 +1076,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the value of the specified request parameter, if any; otherwise,
-     * return <code>null</code>.  If there is more than one value defined,
-     * return only the first one.
+     * @return the value of the specified request parameter, if any; otherwise, return <code>null</code>. If there is
+     *             more than one value defined, return only the first one.
      *
      * @param name Name of the desired request parameter
      */
@@ -1115,15 +1093,11 @@ public class Request implements HttpServletRequest {
     }
 
 
-
     /**
-     * Returns a <code>Map</code> of the parameters of this request.
-     * Request parameters are extra information sent with the request.
-     * For HTTP servlets, parameters are contained in the query string
-     * or posted form data.
+     * Returns a <code>Map</code> of the parameters of this request. Request parameters are extra information sent with
+     * the request. For HTTP servlets, parameters are contained in the query string or posted form data.
      *
-     * @return A <code>Map</code> containing parameter names as keys
-     *  and parameter values as map values.
+     * @return A <code>Map</code> containing parameter names as keys and parameter values as map values.
      */
     @Override
     public Map<String, String[]> getParameterMap() {
@@ -1162,8 +1136,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the defined values for the specified request parameter, if any;
-     * otherwise, return <code>null</code>.
+     * @return the defined values for the specified request parameter, if any; otherwise, return <code>null</code>.
      *
      * @param name Name of the desired request parameter
      */
@@ -1189,14 +1162,13 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Read the Reader wrapping the input stream for this Request.  The
-     * default implementation wraps a <code>BufferedReader</code> around the
-     * servlet input stream returned by <code>createInputStream()</code>.
+     * Read the Reader wrapping the input stream for this Request. The default implementation wraps a
+     * <code>BufferedReader</code> around the servlet input stream returned by <code>createInputStream()</code>.
      *
      * @return a buffered reader for the request
-     * @exception IllegalStateException if <code>getInputStream()</code>
-     *  has already been called for this request
-     * @exception IOException if an input/output error occurs
+     *
+     * @exception IllegalStateException if <code>getInputStream()</code> has already been called for this request
+     * @exception IOException           if an input/output error occurs
      */
     @Override
     public BufferedReader getReader() throws IOException {
@@ -1275,11 +1247,10 @@ public class Request implements HttpServletRequest {
     }
 
     /**
-     * @return the Internet Protocol (IP) source port of the client
-     * or last proxy that sent the request.
+     * @return the Internet Protocol (IP) source port of the client or last proxy that sent the request.
      */
     @Override
-    public int getRemotePort(){
+    public int getRemotePort() {
         if (remotePort == -1) {
             coyoteRequest.action(ActionCode.REQ_REMOTEPORT_ATTRIBUTE, coyoteRequest);
             remotePort = coyoteRequest.getRemotePort();
@@ -1288,11 +1259,10 @@ public class Request implements HttpServletRequest {
     }
 
     /**
-     * @return the host name of the Internet Protocol (IP) interface on
-     * which the request was received.
+     * @return the host name of the Internet Protocol (IP) interface on which the request was received.
      */
     @Override
-    public String getLocalName(){
+    public String getLocalName() {
         if (localName == null) {
             coyoteRequest.action(ActionCode.REQ_LOCAL_NAME_ATTRIBUTE, coyoteRequest);
             localName = coyoteRequest.localName().toString();
@@ -1301,11 +1271,10 @@ public class Request implements HttpServletRequest {
     }
 
     /**
-     * @return the Internet Protocol (IP) address of the interface on
-     * which the request  was received.
+     * @return the Internet Protocol (IP) address of the interface on which the request was received.
      */
     @Override
-    public String getLocalAddr(){
+    public String getLocalAddr() {
         if (localAddr == null) {
             coyoteRequest.action(ActionCode.REQ_LOCAL_ADDR_ATTRIBUTE, coyoteRequest);
             localAddr = coyoteRequest.localAddr().toString();
@@ -1315,12 +1284,11 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the Internet Protocol (IP) port number of the interface
-     * on which the request was received.
+     * @return the Internet Protocol (IP) port number of the interface on which the request was received.
      */
     @Override
-    public int getLocalPort(){
-        if (localPort == -1){
+    public int getLocalPort() {
+        if (localPort == -1) {
             coyoteRequest.action(ActionCode.REQ_LOCALPORT_ATTRIBUTE, coyoteRequest);
             localPort = coyoteRequest.getLocalPort();
         }
@@ -1328,8 +1296,8 @@ public class Request implements HttpServletRequest {
     }
 
     /**
-     * @return a RequestDispatcher that wraps the resource at the specified
-     * path, which may be interpreted as relative to the current request path.
+     * @return a RequestDispatcher that wraps the resource at the specified path, which may be interpreted as relative
+     *             to the current request path.
      *
      * @param path Path of the resource to be wrapped
      */
@@ -1359,25 +1327,19 @@ public class Request implements HttpServletRequest {
         /*
          * Relative to what, exactly?
          *
-         * From the Servlet 4.0 Javadoc:
-         * - The pathname specified may be relative, although it cannot extend
-         *   outside the current servlet context.
-         * - If it is relative, it must be relative against the current servlet
+         * From the Servlet 4.0 Javadoc: - The pathname specified may be relative, although it cannot extend outside the
+         * current servlet context. - If it is relative, it must be relative against the current servlet
          *
-         * From Section 9.1 of the spec:
-         * - The servlet container uses information in the request object to
-         *   transform the given relative path against the current servlet to a
-         *   complete path.
+         * From Section 9.1 of the spec: - The servlet container uses information in the request object to transform the
+         * given relative path against the current servlet to a complete path.
          *
-         * It is undefined whether the requestURI is used or whether servletPath
-         * and pathInfo are used. Given that the RequestURI includes the
-         * contextPath (and extracting that is messy) , using the servletPath and
-         * pathInfo looks to be the more reasonable choice.
+         * It is undefined whether the requestURI is used or whether servletPath and pathInfo are used. Given that the
+         * RequestURI includes the contextPath (and extracting that is messy) , using the servletPath and pathInfo looks
+         * to be the more reasonable choice.
          */
 
         // Convert a request-relative path to a context-relative one
-        String servletPath = (String) getAttribute(
-                RequestDispatcher.INCLUDE_SERVLET_PATH);
+        String servletPath = (String) getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
         if (servletPath == null) {
             servletPath = getServletPath();
         }
@@ -1396,8 +1358,7 @@ public class Request implements HttpServletRequest {
         String relative = null;
         if (context.getDispatchersUseEncodedPaths()) {
             if (pos >= 0) {
-                relative = URLEncoder.DEFAULT.encode(
-                        requestPath.substring(0, pos + 1), StandardCharsets.UTF_8) + path;
+                relative = URLEncoder.DEFAULT.encode(requestPath.substring(0, pos + 1), StandardCharsets.UTF_8) + path;
             } else {
                 relative = URLEncoder.DEFAULT.encode(requestPath, StandardCharsets.UTF_8) + path;
             }
@@ -1476,7 +1437,7 @@ public class Request implements HttpServletRequest {
     /**
      * Set the specified request attribute to the specified value.
      *
-     * @param name Name of the request attribute to set
+     * @param name  Name of the request attribute to set
      * @param value The associated value
      */
     @Override
@@ -1502,16 +1463,14 @@ public class Request implements HttpServletRequest {
 
         // Add or replace the specified attribute
         // Do the security check before any updates are made
-        if (Globals.IS_SECURITY_ENABLED &&
-                name.equals(Globals.SENDFILE_FILENAME_ATTR)) {
+        if (Globals.IS_SECURITY_ENABLED && name.equals(Globals.SENDFILE_FILENAME_ATTR)) {
             // Use the canonical file name to avoid any possible symlink and
             // relative path issues
             String canonicalPath;
             try {
                 canonicalPath = new File(value.toString()).getCanonicalPath();
             } catch (IOException e) {
-                throw new SecurityException(sm.getString(
-                        "coyoteRequest.sendfileNotCanonical", value), e);
+                throw new SecurityException(sm.getString("coyoteRequest.sendfileNotCanonical", value), e);
             }
             // Sendfile is performed in Tomcat's security context so need to
             // check if the web app is permitted to access the file while still
@@ -1536,12 +1495,11 @@ public class Request implements HttpServletRequest {
     /**
      * Notify interested listeners that attribute has been assigned a value.
      *
-     * @param name Attribute name
-     * @param value New attribute value
+     * @param name     Attribute name
+     * @param value    New attribute value
      * @param oldValue Old attribute value
      */
-    private void notifyAttributeAssigned(String name, Object value,
-            Object oldValue) {
+    private void notifyAttributeAssigned(String name, Object value, Object oldValue) {
         Context context = getContext();
         if (context == null) {
             return;
@@ -1553,11 +1511,9 @@ public class Request implements HttpServletRequest {
         boolean replaced = (oldValue != null);
         ServletRequestAttributeEvent event = null;
         if (replaced) {
-            event = new ServletRequestAttributeEvent(
-                    context.getServletContext(), getRequest(), name, oldValue);
+            event = new ServletRequestAttributeEvent(context.getServletContext(), getRequest(), name, oldValue);
         } else {
-            event = new ServletRequestAttributeEvent(
-                    context.getServletContext(), getRequest(), name, value);
+            event = new ServletRequestAttributeEvent(context.getServletContext(), getRequest(), name, value);
         }
 
         for (Object o : listeners) {
@@ -1584,7 +1540,7 @@ public class Request implements HttpServletRequest {
     /**
      * Notify interested listeners that attribute has been removed.
      *
-     * @param name Attribute name
+     * @param name  Attribute name
      * @param value Attribute value
      */
     private void notifyAttributeRemoved(String name, Object value) {
@@ -1593,9 +1549,8 @@ public class Request implements HttpServletRequest {
         if ((listeners == null) || (listeners.length == 0)) {
             return;
         }
-        ServletRequestAttributeEvent event =
-                new ServletRequestAttributeEvent(context.getServletContext(),
-                        getRequest(), name, value);
+        ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(context.getServletContext(), getRequest(),
+                name, value);
         for (Object o : listeners) {
             if (!(o instanceof ServletRequestAttributeListener)) {
                 continue;
@@ -1614,14 +1569,12 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Overrides the name of the character encoding used in the body of
-     * this request.  This method must be called prior to reading request
-     * parameters or reading input using <code>getReader()</code>.
+     * Overrides the name of the character encoding used in the body of this request. This method must be called prior
+     * to reading request parameters or reading input using <code>getReader()</code>.
      *
      * @param enc The character encoding to be used
      *
-     * @exception UnsupportedEncodingException if the specified encoding
-     *  is not supported
+     * @exception UnsupportedEncodingException if the specified encoding is not supported
      *
      * @since Servlet 2.3
      */
@@ -1643,21 +1596,18 @@ public class Request implements HttpServletRequest {
     @Override
     public ServletContext getServletContext() {
         return getContext().getServletContext();
-     }
+    }
 
     @Override
     public AsyncContext startAsync() {
-        return startAsync(getRequest(),response.getResponse());
+        return startAsync(getRequest(), response.getResponse());
     }
 
     @Override
-    public AsyncContext startAsync(ServletRequest request,
-            ServletResponse response) {
+    public AsyncContext startAsync(ServletRequest request, ServletResponse response) {
         if (!isAsyncSupported()) {
-            IllegalStateException ise =
-                    new IllegalStateException(sm.getString("request.asyncNotSupported"));
-            log.warn(sm.getString("coyoteRequest.noAsync",
-                    StringUtils.join(getNonAsyncClassNames())), ise);
+            IllegalStateException ise = new IllegalStateException(sm.getString("request.asyncNotSupported"));
+            log.warn(sm.getString("coyoteRequest.noAsync", StringUtils.join(getNonAsyncClassNames())), ise);
             throw ise;
         }
 
@@ -1666,7 +1616,7 @@ public class Request implements HttpServletRequest {
         }
 
         asyncContext.setStarted(getContext(), request, response,
-                request==getRequest() && response==getResponse().getResponse());
+                request == getRequest() && response == getResponse().getResponse());
         asyncContext.setTimeout(getConnector().getAsyncTimeout());
 
         return asyncContext;
@@ -1815,8 +1765,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Add a Locale to the set of preferred Locales for this Request.  The
-     * first added Locale will be the first one returned by getLocales().
+     * Add a Locale to the set of preferred Locales for this Request. The first added Locale will be the first one
+     * returned by getLocales().
      *
      * @param locale The new preferred Locale
      */
@@ -1844,9 +1794,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Set the authentication type used for this request, if any; otherwise
-     * set the type to <code>null</code>.  Typical values are "BASIC",
-     * "DIGEST", or "SSL".
+     * Set the authentication type used for this request, if any; otherwise set the type to <code>null</code>. Typical
+     * values are "BASIC", "DIGEST", or "SSL".
      *
      * @param type The authentication type used
      */
@@ -1856,9 +1805,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Set the path information for this Request.  This will normally be called
-     * when the associated Context is mapping the Request to a particular
-     * Wrapper.
+     * Set the path information for this Request. This will normally be called when the associated Context is mapping
+     * the Request to a particular Wrapper.
      *
      * @param path The path information
      */
@@ -1868,9 +1816,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Set a flag indicating whether or not the requested session ID for this
-     * request came in through a cookie.  This is normally called by the
-     * HTTP Connector, when it parses the request headers.
+     * Set a flag indicating whether or not the requested session ID for this request came in through a cookie. This is
+     * normally called by the HTTP Connector, when it parses the request headers.
      *
      * @param flag The new flag
      */
@@ -1882,8 +1829,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Set the requested session ID for this request.  This is normally called
-     * by the HTTP Connector, when it parses the request headers.
+     * Set the requested session ID for this request. This is normally called by the HTTP Connector, when it parses the
+     * request headers.
      *
      * @param id The new session id
      */
@@ -1895,9 +1842,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Set a flag indicating whether or not the requested session ID for this
-     * request came in through a URL.  This is normally called by the
-     * HTTP Connector, when it parses the request headers.
+     * Set a flag indicating whether or not the requested session ID for this request came in through a URL. This is
+     * normally called by the HTTP Connector, when it parses the request headers.
      *
      * @param flag The new flag
      */
@@ -1909,9 +1855,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Set a flag indicating whether or not the requested session ID for this
-     * request came in through SSL.  This is normally called by the
-     * HTTP Connector, when it parses the request headers.
+     * Set a flag indicating whether or not the requested session ID for this request came in through SSL. This is
+     * normally called by the HTTP Connector, when it parses the request headers.
      *
      * @param flag The new flag
      */
@@ -1943,9 +1888,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Set the Principal who has been authenticated for this Request.  This
-     * value is also used to calculate the value to be returned by the
-     * <code>getRemoteUser()</code> method.
+     * Set the Principal who has been authenticated for this Request. This value is also used to calculate the value to
+     * be returned by the <code>getRemoteUser()</code> method.
      *
      * @param principal The user Principal
      */
@@ -2018,8 +1962,8 @@ public class Request implements HttpServletRequest {
 
     @SuppressWarnings("unchecked")
     @Override
-    public <T extends HttpUpgradeHandler> T upgrade(
-            Class<T> httpUpgradeHandlerClass) throws java.io.IOException, ServletException {
+    public <T extends HttpUpgradeHandler> T upgrade(Class<T> httpUpgradeHandlerClass)
+            throws java.io.IOException, ServletException {
         T handler;
         InstanceManager instanceManager = null;
         try {
@@ -2031,8 +1975,7 @@ public class Request implements HttpServletRequest {
                 instanceManager = getContext().getInstanceManager();
                 handler = (T) instanceManager.newInstance(httpUpgradeHandlerClass);
             }
-        } catch (ReflectiveOperationException | NamingException | IllegalArgumentException |
-                SecurityException e) {
+        } catch (ReflectiveOperationException | NamingException | IllegalArgumentException | SecurityException e) {
             throw new ServletException(e);
         }
         UpgradeToken upgradeToken = new UpgradeToken(handler, getContext(), instanceManager,
@@ -2080,9 +2023,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Return the portion of the request URI used to select the Context
-     * of the Request. The value returned is not decoded which also implies it
-     * is not normalised.
+     * Return the portion of the request URI used to select the Context of the Request. The value returned is not
+     * decoded which also implies it is not normalised.
      */
     @Override
     public String getContextPath() {
@@ -2150,8 +2092,8 @@ public class Request implements HttpServletRequest {
             }
         } else {
             // Should never happen
-            throw new IllegalStateException(sm.getString(
-                    "coyoteRequest.getContextPath.ise", canonicalContextPath, uri));
+            throw new IllegalStateException(
+                    sm.getString("coyoteRequest.getContextPath.ise", canonicalContextPath, uri));
         }
     }
 
@@ -2189,7 +2131,7 @@ public class Request implements HttpServletRequest {
             if (uri[pos] == '/') {
                 return pos;
             } else if (connector.getEncodedSolidusHandlingInternal() == EncodedSolidusHandling.DECODE &&
-                    uri[pos] == '%' && pos + 2 < len && uri[pos+1] == '2' &&
+                    uri[pos] == '%' && pos + 2 < len && uri[pos + 1] == '2' &&
                     (uri[pos + 2] == 'f' || uri[pos + 2] == 'F')) {
                 return pos;
             }
@@ -2200,9 +2142,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Return the set of Cookies received with this Request. Triggers parsing of
-     * the Cookie HTTP headers followed by conversion to Cookie objects if this
-     * has not already been performed.
+     * Return the set of Cookies received with this Request. Triggers parsing of the Cookie HTTP headers followed by
+     * conversion to Cookie objects if this has not already been performed.
      *
      * @return the array of cookies
      */
@@ -2216,9 +2157,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Return the server representation of the cookies associated with this
-     * request. Triggers parsing of the Cookie HTTP headers (but not conversion
-     * to Cookie objects) if the headers have not yet been parsed.
+     * Return the server representation of the cookies associated with this request. Triggers parsing of the Cookie HTTP
+     * headers (but not conversion to Cookie objects) if the headers have not yet been parsed.
      *
      * @return the server cookies
      */
@@ -2229,14 +2169,13 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Return the value of the specified date header, if any; otherwise
-     * return -1.
+     * Return the value of the specified date header, if any; otherwise return -1.
      *
      * @param name Name of the requested date header
+     *
      * @return the date as a long
      *
-     * @exception IllegalArgumentException if the specified header value
-     *  cannot be converted to a date
+     * @exception IllegalArgumentException if the specified header value cannot be converted to a date
      */
     @Override
     public long getDateHeader(String name) {
@@ -2257,10 +2196,10 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Return the first value of the specified header, if any; otherwise,
-     * return <code>null</code>
+     * Return the first value of the specified header, if any; otherwise, return <code>null</code>
      *
      * @param name Name of the requested header
+     *
      * @return the header value
      */
     @Override
@@ -2270,10 +2209,10 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Return all of the values of the specified header, if any; otherwise,
-     * return an empty enumeration.
+     * Return all of the values of the specified header, if any; otherwise, return an empty enumeration.
      *
      * @param name Name of the requested header
+     *
      * @return the enumeration with the header values
      */
     @Override
@@ -2292,14 +2231,13 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Return the value of the specified header as an integer, or -1 if there
-     * is no such header for this request.
+     * Return the value of the specified header as an integer, or -1 if there is no such header for this request.
      *
      * @param name Name of the requested header
+     *
      * @return the header value as an int
      *
-     * @exception IllegalArgumentException if the specified header value
-     *  cannot be converted to an integer
+     * @exception IllegalArgumentException if the specified header value cannot be converted to an integer
      */
     @Override
     public int getIntHeader(String name) {
@@ -2338,8 +2276,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the extra path information for this request, translated
-     * to a real path.
+     * @return the extra path information for this request, translated to a real path.
      */
     @Override
     public String getPathTranslated() {
@@ -2367,8 +2304,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the name of the remote user that has been authenticated
-     * for this Request.
+     * @return the name of the remote user that has been authenticated for this Request.
      */
     @Override
     public String getRemoteUser() {
@@ -2416,8 +2352,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the portion of the request URI used to select the servlet
-     * that will process this request.
+     * @return the portion of the request URI used to select the servlet that will process this request.
      */
     @Override
     public String getServletPath() {
@@ -2426,8 +2361,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the session associated with this Request, creating one
-     * if necessary.
+     * @return the session associated with this Request, creating one if necessary.
      */
     @Override
     public HttpSession getSession() {
@@ -2441,8 +2375,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the session associated with this Request, creating one
-     * if necessary and requested.
+     * @return the session associated with this Request, creating one if necessary and requested.
      *
      * @param create Create a new session if one does not exist
      */
@@ -2458,8 +2391,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return <code>true</code> if the session identifier included in this
-     * request came from a cookie.
+     * @return <code>true</code> if the session identifier included in this request came from a cookie.
      */
     @Override
     public boolean isRequestedSessionIdFromCookie() {
@@ -2473,8 +2405,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return <code>true</code> if the session identifier included in this
-     * request came from the request URI.
+     * @return <code>true</code> if the session identifier included in this request came from the request URI.
      */
     @Override
     public boolean isRequestedSessionIdFromURL() {
@@ -2488,8 +2419,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return <code>true</code> if the session identifier included in this
-     * request identifies a valid session.
+     * @return <code>true</code> if the session identifier included in this request identifies a valid session.
      */
     @Override
     public boolean isRequestedSessionIdValid() {
@@ -2523,8 +2453,7 @@ public class Request implements HttpServletRequest {
                 for (int i = (getMappingData().contexts.length); i > 0; i--) {
                     Context ctxt = getMappingData().contexts[i - 1];
                     try {
-                        if (ctxt.getManager().findSession(requestedSessionId) !=
-                                null) {
+                        if (ctxt.getManager().findSession(requestedSessionId) != null) {
                             return true;
                         }
                     } catch (IOException e) {
@@ -2540,8 +2469,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return <code>true</code> if the authenticated user principal
-     * possesses the specified role name.
+     * @return <code>true</code> if the authenticated user principal possesses the specified role name.
      *
      * @param role Role name to be validated
      */
@@ -2595,8 +2523,7 @@ public class Request implements HttpServletRequest {
     @Override
     public Principal getUserPrincipal() {
         if (userPrincipal instanceof TomcatPrincipal) {
-            GSSCredential gssCredential =
-                    ((TomcatPrincipal) userPrincipal).getGssCredential();
+            GSSCredential gssCredential = ((TomcatPrincipal) userPrincipal).getGssCredential();
             if (gssCredential != null) {
                 int left = -1;
                 try {
@@ -2612,8 +2539,7 @@ public class Request implements HttpServletRequest {
                     // rare so it is caught and handled rather than avoided.
                     left = gssCredential.getRemainingLifetime();
                 } catch (GSSException | IllegalStateException e) {
-                    log.warn(sm.getString("coyoteRequest.gssLifetimeFail",
-                            userPrincipal.getName()), e);
+                    log.warn(sm.getString("coyoteRequest.gssLifetimeFail", userPrincipal.getName()), e);
                 }
                 // zero is expired. Exception above will mean left == -1
                 // Treat both as expired.
@@ -2636,8 +2562,7 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return the session associated with this Request, creating one
-     * if necessary.
+     * @return the session associated with this Request, creating one if necessary.
      */
     public Session getSessionInternal() {
         return doGetSession(true);
@@ -2645,12 +2570,11 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Change the ID of the session that this request is associated with. There
-     * are several things that may trigger an ID change. These include moving
-     * between nodes in a cluster and session fixation prevention during the
+     * Change the ID of the session that this request is associated with. There are several things that may trigger an
+     * ID change. These include moving between nodes in a cluster and session fixation prevention during the
      * authentication process.
      *
-     * @param newSessionId   The session to change the session ID for
+     * @param newSessionId The session to change the session ID for
      */
     public void changeSessionId(String newSessionId) {
         // This should only ever be called if there was an old session ID but
@@ -2661,15 +2585,12 @@ public class Request implements HttpServletRequest {
 
         Context context = getContext();
         if (context != null &&
-                !context.getServletContext()
-                        .getEffectiveSessionTrackingModes()
-                        .contains(SessionTrackingMode.COOKIE)) {
+                !context.getServletContext().getEffectiveSessionTrackingModes().contains(SessionTrackingMode.COOKIE)) {
             return;
         }
 
         if (response != null) {
-            Cookie newCookie = ApplicationSessionCookieConfig.createSessionCookie(context,
-                    newSessionId, isSecure());
+            Cookie newCookie = ApplicationSessionCookieConfig.createSessionCookie(context, newSessionId, isSecure());
             response.addSessionCookieInternal(newCookie);
         }
     }
@@ -2680,8 +2601,7 @@ public class Request implements HttpServletRequest {
 
         Session session = this.getSessionInternal(false);
         if (session == null) {
-            throw new IllegalStateException(
-                sm.getString("coyoteRequest.changeSessionId"));
+            throw new IllegalStateException(sm.getString("coyoteRequest.changeSessionId"));
         }
 
         Manager manager = this.getContext().getManager();
@@ -2693,8 +2613,7 @@ public class Request implements HttpServletRequest {
     }
 
     /**
-     * @return the session associated with this Request, creating one
-     * if necessary and requested.
+     * @return the session associated with this Request, creating one if necessary and requested.
      *
      * @param create Create a new session if one does not exist
      */
@@ -2712,8 +2631,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * @return <code>true</code> if an attempt has been made to read the request
-     *         body and all of the request body has been read.
+     * @return <code>true</code> if an attempt has been made to read the request body and all of the request body has
+     *             been read.
      */
     public boolean isFinished() {
         return coyoteRequest.isFinished();
@@ -2721,9 +2640,8 @@ public class Request implements HttpServletRequest {
 
 
     /**
-     * Check the configuration for aborted uploads and if configured to do so,
-     * disable the swallowing of any remaining input and close the connection
-     * once the response has been written.
+     * Check the configuration for aborted uploads and if configured to do so, disable the swallowing of any remaining
+     * input and close the connection once the response has been written.
      */
     protected void checkSwallowInput() {
         Context context = getContext();
@@ -2736,11 +2654,9 @@ public class Request implements HttpServletRequest {
      * {@inheritDoc}
      */
     @Override
-    public boolean authenticate(HttpServletResponse response)
-            throws IOException, ServletException {
+    public boolean authenticate(HttpServletResponse response) throws IOException, ServletException {
         if (response.isCommitted()) {
-            throw new IllegalStateException(
-                    sm.getString("coyoteRequest.authenticate.ise"));
+            throw new IllegalStateException(sm.getString("coyoteRequest.authenticate.ise"));
         }
 
         return getContext().getAuthenticator().authenticate(this, response);
@@ -2750,12 +2666,9 @@ public class Request implements HttpServletRequest {
      * {@inheritDoc}
      */
     @Override
-    public void login(String username, String password)
-            throws ServletException {
-        if (getAuthType() != null || getRemoteUser() != null ||
-                getUserPrincipal() != null) {
-            throw new ServletException(
-                    sm.getString("coyoteRequest.alreadyAuthenticated"));
+    public void login(String username, String password) throws ServletException {
+        if (getAuthType() != null || getRemoteUser() != null || getUserPrincipal() != null) {
+            throw new ServletException(sm.getString("coyoteRequest.alreadyAuthenticated"));
         }
 
         getContext().getAuthenticator().login(username, password, this);
@@ -2773,8 +2686,7 @@ public class Request implements HttpServletRequest {
      * {@inheritDoc}
      */
     @Override
-    public Collection<Part> getParts() throws IOException, IllegalStateException,
-            ServletException {
+    public Collection<Part> getParts() throws IOException, IllegalStateException, ServletException {
 
         parseParts(true);
 
@@ -2802,13 +2714,12 @@ public class Request implements HttpServletRequest {
         MultipartConfigElement mce = getWrapper().getMultipartConfigElement();
 
         if (mce == null) {
-            if(context.getAllowCasualMultipartParsing()) {
-                mce = new MultipartConfigElement(null, connector.getMaxPostSize(),
-                        connector.getMaxPostSize(), connector.getMaxPostSize());
+            if (context.getAllowCasualMultipartParsing()) {
+                mce = new MultipartConfigElement(null, connector.getMaxPostSize(), connector.getMaxPostSize(),
+                        connector.getMaxPostSize());
             } else {
                 if (explicit) {
-                    partsParseException = new IllegalStateException(
-                            sm.getString("coyoteRequest.noMultipartConfig"));
+                    partsParseException = new IllegalStateException(sm.getString("coyoteRequest.noMultipartConfig"));
                     return;
                 } else {
                     parts = Collections.emptyList();
@@ -2826,32 +2737,27 @@ public class Request implements HttpServletRequest {
             File location;
             String locationStr = mce.getLocation();
             if (locationStr == null || locationStr.length() == 0) {
-                location = ((File) context.getServletContext().getAttribute(
-                        ServletContext.TEMPDIR));
+                location = ((File) context.getServletContext().getAttribute(ServletContext.TEMPDIR));
             } else {
                 // If relative, it is relative to TEMPDIR
                 location = new File(locationStr);
                 if (!location.isAbsolute()) {
-                    location = new File(
-                            (File) context.getServletContext().getAttribute(ServletContext.TEMPDIR),
+                    location = new File((File) context.getServletContext().getAttribute(ServletContext.TEMPDIR),
                             locationStr).getAbsoluteFile();
                 }
             }
 
             if (!location.exists() && context.getCreateUploadTargets()) {
-                log.warn(sm.getString("coyoteRequest.uploadCreate",
-                        location.getAbsolutePath(), getMappingData().wrapper.getName()));
+                log.warn(sm.getString("coyoteRequest.uploadCreate", location.getAbsolutePath(),
+                        getMappingData().wrapper.getName()));
                 if (!location.mkdirs()) {
-                    log.warn(sm.getString("coyoteRequest.uploadCreateFail",
-                            location.getAbsolutePath()));
+                    log.warn(sm.getString("coyoteRequest.uploadCreateFail", location.getAbsolutePath()));
                 }
             }
 
             if (!location.isDirectory()) {
                 parameters.setParseFailedReason(FailReason.MULTIPART_CONFIG_INVALID);
-                partsParseException = new IOException(
-                        sm.getString("coyoteRequest.uploadLocationInvalid",
-                                location));
+                partsParseException = new IOException(sm.getString("coyoteRequest.uploadLocationInvalid", location));
                 return;
             }
 
@@ -2881,8 +2787,7 @@ public class Request implements HttpServletRequest {
 
             parts = new ArrayList<>();
             try {
-                List<FileItem> items =
-                        upload.parseRequest(new ServletRequestContext(this));
+                List<FileItem> items = upload.parseRequest(new ServletRequestContext(this));
                 int maxPostSize = getConnector().getMaxPostSize();
                 int postSize = 0;
                 Charset charset = getCharset();
@@ -2903,8 +2808,7 @@ public class Request implements HttpServletRequest {
                             postSize++;
                             if (postSize > maxPostSize) {
                                 parameters.setParseFailedReason(FailReason.POST_TOO_LARGE);
-                                throw new IllegalStateException(sm.getString(
-                                        "coyoteRequest.maxPostSizeExceeded"));
+                                throw new IllegalStateException(sm.getString("coyoteRequest.maxPostSizeExceeded"));
                             }
                         }
                         String value = null;
@@ -2949,8 +2853,7 @@ public class Request implements HttpServletRequest {
      * {@inheritDoc}
      */
     @Override
-    public Part getPart(String name) throws IOException, IllegalStateException,
-            ServletException {
+    public Part getPart(String name) throws IOException, IllegalStateException, ServletException {
         for (Part part : getParts()) {
             if (name.equals(part.getName())) {
                 return part;
@@ -2981,7 +2884,7 @@ public class Request implements HttpServletRequest {
         // Return the requested session if it exists and is valid
         Manager manager = context.getManager();
         if (manager == null) {
-            return null;      // Sessions are not supported
+            return null; // Sessions are not supported
         }
         if (requestedSessionId != null) {
             try {
@@ -3007,8 +2910,8 @@ public class Request implements HttpServletRequest {
         if (!create) {
             return null;
         }
-        boolean trackModesIncludesCookie =
-                context.getServletContext().getEffectiveSessionTrackingModes().contains(SessionTrackingMode.COOKIE);
+        boolean trackModesIncludesCookie = context.getServletContext().getEffectiveSessionTrackingModes()
+                .contains(SessionTrackingMode.COOKIE);
         if (trackModesIncludesCookie && response.getResponse().isCommitted()) {
             throw new IllegalStateException(sm.getString("coyoteRequest.sessionCreateCommitted"));
         }
@@ -3019,17 +2922,15 @@ public class Request implements HttpServletRequest {
         if (requestedSessionSSL) {
             // If the session ID has been obtained from the SSL handshake then
             // use it.
-        } else if (("/".equals(context.getSessionCookiePath())
-                && isRequestedSessionIdFromCookie())) {
-            /* This is the common(ish) use case: using the same session ID with
-             * multiple web applications on the same host. Typically this is
-             * used by Portlet implementations. It only works if sessions are
-             * tracked via cookies. The cookie must have a path of "/" else it
-             * won't be provided for requests to all web applications.
+        } else if (("/".equals(context.getSessionCookiePath()) && isRequestedSessionIdFromCookie())) {
+            /*
+             * This is the common(ish) use case: using the same session ID with multiple web applications on the same
+             * host. Typically this is used by Portlet implementations. It only works if sessions are tracked via
+             * cookies. The cookie must have a path of "/" else it won't be provided for requests to all web
+             * applications.
              *
-             * Any session ID provided by the client should be for a session
-             * that already exists somewhere on the host. Check if the context
-             * is configured for this to be confirmed.
+             * Any session ID provided by the client should be for a session that already exists somewhere on the host.
+             * Check if the context is configured for this to be confirmed.
              */
             if (context.getValidateClientProvidedNewSessionId()) {
                 boolean found = false;
@@ -3058,8 +2959,8 @@ public class Request implements HttpServletRequest {
 
         // Creating a new session cookie based on that session
         if (session != null && trackModesIncludesCookie) {
-            Cookie cookie = ApplicationSessionCookieConfig.createSessionCookie(
-                    context, session.getIdInternal(), isSecure());
+            Cookie cookie = ApplicationSessionCookieConfig.createSessionCookie(context, session.getIdInternal(),
+                    isSecure());
 
             response.addSessionCookieInternal(cookie);
         }
@@ -3073,20 +2974,20 @@ public class Request implements HttpServletRequest {
     }
 
     protected String unescape(String s) {
-        if (s==null) {
+        if (s == null) {
             return null;
         }
         if (s.indexOf('\\') == -1) {
             return s;
         }
         StringBuilder buf = new StringBuilder();
-        for (int i=0; i<s.length(); i++) {
+        for (int i = 0; i < s.length(); i++) {
             char c = s.charAt(i);
-            if (c!='\\') {
+            if (c != '\\') {
                 buf.append(c);
             } else {
                 if (++i >= s.length()) {
-                    throw new IllegalArgumentException();//invalid escape, hence invalid cookie
+                    throw new IllegalArgumentException();// invalid escape, hence invalid cookie
                 }
                 c = s.charAt(i);
                 buf.append(c);
@@ -3108,8 +3009,8 @@ public class Request implements HttpServletRequest {
     }
 
     /**
-     * Parse cookies. This only parses the cookies into the memory efficient
-     * ServerCookies structure. It does not populate the Cookie objects.
+     * Parse cookies. This only parses the cookies into the memory efficient ServerCookies structure. It does not
+     * populate the Cookie objects.
      */
     protected void parseCookies() {
         if (cookiesParsed) {
@@ -3124,8 +3025,7 @@ public class Request implements HttpServletRequest {
     }
 
     /**
-     * Converts the parsed cookies (parsing the Cookie headers first if they
-     * have not been parsed) into Cookie objects.
+     * Converts the parsed cookies (parsing the Cookie headers first if they have not been parsed) into Cookie objects.
      */
     protected void convertCookies() {
         if (cookiesConverted) {
@@ -3145,21 +3045,21 @@ public class Request implements HttpServletRequest {
 
         cookies = new Cookie[count];
 
-        int idx=0;
+        int idx = 0;
         for (int i = 0; i < count; i++) {
             ServerCookie scookie = serverCookies.getCookie(i);
             try {
                 // We must unescape the '\\' escape character
-                Cookie cookie = new Cookie(scookie.getName().toString(),null);
+                Cookie cookie = new Cookie(scookie.getName().toString(), null);
                 scookie.getValue().getByteChunk().setCharset(getCookieProcessor().getCharset());
                 cookie.setValue(unescape(scookie.getValue().toString()));
                 cookies[idx++] = cookie;
-            } catch(IllegalArgumentException e) {
+            } catch (IllegalArgumentException e) {
                 // Ignore bad cookie
             }
         }
-        if( idx < count ) {
-            Cookie [] ncookies = new Cookie[idx];
+        if (idx < count) {
+            Cookie[] ncookies = new Cookie[idx];
             System.arraycopy(cookies, 0, ncookies, 0, idx);
             cookies = ncookies;
         }
@@ -3189,7 +3089,7 @@ public class Request implements HttpServletRequest {
                 parameters.setQueryStringCharset(charset);
             }
             // Note: If !useBodyEncodingForURI, the query string encoding is
-            //       that set towards the start of CoyoyeAdapter.service()
+            // that set towards the start of CoyoyeAdapter.service()
 
             parameters.handleQueryParameters();
 
@@ -3215,7 +3115,7 @@ public class Request implements HttpServletRequest {
                 return;
             }
 
-            if( !getConnector().isParseBodyMethod(getMethod()) ) {
+            if (!getConnector().isParseBodyMethod(getMethod())) {
                 success = true;
                 return;
             }
@@ -3232,8 +3132,7 @@ public class Request implements HttpServletRequest {
                 if ((maxPostSize >= 0) && (len > maxPostSize)) {
                     Context context = getContext();
                     if (context != null && context.getLogger().isDebugEnabled()) {
-                        context.getLogger().debug(
-                                sm.getString("coyoteRequest.postTooLarge"));
+                        context.getLogger().debug(sm.getString("coyoteRequest.postTooLarge"));
                     }
                     checkSwallowInput();
                     parameters.setParseFailedReason(FailReason.POST_TOO_LARGE);
@@ -3257,15 +3156,13 @@ public class Request implements HttpServletRequest {
                     // Client disconnect
                     Context context = getContext();
                     if (context != null && context.getLogger().isDebugEnabled()) {
-                        context.getLogger().debug(
-                                sm.getString("coyoteRequest.parseParameters"), e);
+                        context.getLogger().debug(sm.getString("coyoteRequest.parseParameters"), e);
                     }
                     parameters.setParseFailedReason(FailReason.CLIENT_DISCONNECT);
                     return;
                 }
                 parameters.processParameters(formData, 0, len);
-            } else if ("chunked".equalsIgnoreCase(
-                    coyoteRequest.getHeader("transfer-encoding"))) {
+            } else if ("chunked".equalsIgnoreCase(coyoteRequest.getHeader("transfer-encoding"))) {
                 byte[] formData = null;
                 try {
                     formData = readChunkedPostBody();
@@ -3274,9 +3171,7 @@ public class Request implements HttpServletRequest {
                     parameters.setParseFailedReason(FailReason.POST_TOO_LARGE);
                     Context context = getContext();
                     if (context != null && context.getLogger().isDebugEnabled()) {
-                        context.getLogger().debug(
-                                sm.getString("coyoteRequest.parseParameters"),
-                                ise);
+                        context.getLogger().debug(sm.getString("coyoteRequest.parseParameters"), ise);
                     }
                     return;
                 } catch (IOException e) {
@@ -3284,8 +3179,7 @@ public class Request implements HttpServletRequest {
                     parameters.setParseFailedReason(FailReason.CLIENT_DISCONNECT);
                     Context context = getContext();
                     if (context != null && context.getLogger().isDebugEnabled()) {
-                        context.getLogger().debug(
-                                sm.getString("coyoteRequest.parseParameters"), e);
+                        context.getLogger().debug(sm.getString("coyoteRequest.parseParameters"), e);
                     }
                     return;
                 }
@@ -3307,12 +3201,13 @@ public class Request implements HttpServletRequest {
      * Read post body in an array.
      *
      * @param body The bytes array in which the body will be read
-     * @param len The body length
+     * @param len  The body length
+     *
      * @return the bytes count that has been read
+     *
      * @throws IOException if an IO exception occurred
      */
-    protected int readPostBody(byte[] body, int len)
-            throws IOException {
+    protected int readPostBody(byte[] body, int len) throws IOException {
 
         int offset = 0;
         do {
@@ -3331,6 +3226,7 @@ public class Request implements HttpServletRequest {
      * Read chunked post body.
      *
      * @return the post body as a bytes array
+     *
      * @throws IOException if an IO exception occurred
      */
     protected byte[] readChunkedPostBody() throws IOException {
@@ -3341,12 +3237,10 @@ public class Request implements HttpServletRequest {
         int len = 0;
         while (len > -1) {
             len = getStream().read(buffer, 0, CACHED_POST_LEN);
-            if (connector.getMaxPostSize() >= 0 &&
-                    (body.getLength() + len) > connector.getMaxPostSize()) {
+            if (connector.getMaxPostSize() >= 0 && (body.getLength() + len) > connector.getMaxPostSize()) {
                 // Too much data
                 checkSwallowInput();
-                throw new IllegalStateException(
-                        sm.getString("coyoteRequest.chunkedPostTooLarge"));
+                throw new IllegalStateException(sm.getString("coyoteRequest.chunkedPostTooLarge"));
             }
             if (len > 0) {
                 body.append(buffer, 0, len);
@@ -3375,7 +3269,7 @@ public class Request implements HttpServletRequest {
 
         // Store the accumulated languages that have been requested in
         // a local collection, sorted by the quality value (so we can
-        // add Locales in descending order).  The values will be ArrayLists
+        // add Locales in descending order). The values will be ArrayLists
         // containing the corresponding Locales to be added
         TreeMap<Double, ArrayList<Locale>> locales = new TreeMap<>();
 
@@ -3399,7 +3293,7 @@ public class Request implements HttpServletRequest {
     /**
      * Parse accept-language header value.
      *
-     * @param value the header value
+     * @param value   the header value
      * @param locales the map that will hold the result
      */
     protected void parseLocalesHeader(String value, TreeMap<Double, ArrayList<Locale>> locales) {
@@ -3415,7 +3309,7 @@ public class Request implements HttpServletRequest {
 
         for (AcceptLanguage acceptLanguage : acceptLanguages) {
             // Add a new Locale to the list of Locales for this quality level
-            Double key = Double.valueOf(-acceptLanguage.getQuality());  // Reverse the order
+            Double key = Double.valueOf(-acceptLanguage.getQuality()); // Reverse the order
             locales.computeIfAbsent(key, k -> new ArrayList<>()).add(acceptLanguage.getLocale());
         }
     }
@@ -3435,117 +3329,106 @@ public class Request implements HttpServletRequest {
     private static final Map<String, SpecialAttributeAdapter> specialAttributes = new HashMap<>();
 
     static {
-        specialAttributes.put(Globals.DISPATCHER_TYPE_ATTR,
-                new SpecialAttributeAdapter() {
-                    @Override
-                    public Object get(Request request, String name) {
-                        return (request.internalDispatcherType == null) ? DispatcherType.REQUEST
-                                : request.internalDispatcherType;
-                    }
+        specialAttributes.put(Globals.DISPATCHER_TYPE_ATTR, new SpecialAttributeAdapter() {
+            @Override
+            public Object get(Request request, String name) {
+                return (request.internalDispatcherType == null) ? DispatcherType.REQUEST
+                        : request.internalDispatcherType;
+            }
 
-                    @Override
-                    public void set(Request request, String name, Object value) {
-                        request.internalDispatcherType = (DispatcherType) value;
-                    }
-                });
-        specialAttributes.put(Globals.DISPATCHER_REQUEST_PATH_ATTR,
-                new SpecialAttributeAdapter() {
-                    @Override
-                    public Object get(Request request, String name) {
-                        return (request.requestDispatcherPath == null) ? request
-                                .getRequestPathMB().toString()
-                                : request.requestDispatcherPath.toString();
-                    }
+            @Override
+            public void set(Request request, String name, Object value) {
+                request.internalDispatcherType = (DispatcherType) value;
+            }
+        });
+        specialAttributes.put(Globals.DISPATCHER_REQUEST_PATH_ATTR, new SpecialAttributeAdapter() {
+            @Override
+            public Object get(Request request, String name) {
+                return (request.requestDispatcherPath == null) ? request.getRequestPathMB().toString()
+                        : request.requestDispatcherPath.toString();
+            }
 
-                    @Override
-                    public void set(Request request, String name, Object value) {
-                        request.requestDispatcherPath = value;
-                    }
-                });
-        specialAttributes.put(Globals.ASYNC_SUPPORTED_ATTR,
-                new SpecialAttributeAdapter() {
-                    @Override
-                    public Object get(Request request, String name) {
-                        return request.asyncSupported;
-                    }
+            @Override
+            public void set(Request request, String name, Object value) {
+                request.requestDispatcherPath = value;
+            }
+        });
+        specialAttributes.put(Globals.ASYNC_SUPPORTED_ATTR, new SpecialAttributeAdapter() {
+            @Override
+            public Object get(Request request, String name) {
+                return request.asyncSupported;
+            }
 
-                    @Override
-                    public void set(Request request, String name, Object value) {
-                        Boolean oldValue = request.asyncSupported;
-                        request.asyncSupported = (Boolean)value;
-                        request.notifyAttributeAssigned(name, value, oldValue);
-                    }
-                });
-        specialAttributes.put(Globals.GSS_CREDENTIAL_ATTR,
-                new SpecialAttributeAdapter() {
-                    @Override
-                    public Object get(Request request, String name) {
-                        if (request.userPrincipal instanceof TomcatPrincipal) {
-                            return ((TomcatPrincipal) request.userPrincipal)
-                                    .getGssCredential();
-                        }
-                        return null;
-                    }
+            @Override
+            public void set(Request request, String name, Object value) {
+                Boolean oldValue = request.asyncSupported;
+                request.asyncSupported = (Boolean) value;
+                request.notifyAttributeAssigned(name, value, oldValue);
+            }
+        });
+        specialAttributes.put(Globals.GSS_CREDENTIAL_ATTR, new SpecialAttributeAdapter() {
+            @Override
+            public Object get(Request request, String name) {
+                if (request.userPrincipal instanceof TomcatPrincipal) {
+                    return ((TomcatPrincipal) request.userPrincipal).getGssCredential();
+                }
+                return null;
+            }
 
-                    @Override
-                    public void set(Request request, String name, Object value) {
-                        // NO-OP
-                    }
-                });
-        specialAttributes.put(Globals.PARAMETER_PARSE_FAILED_ATTR,
-                new SpecialAttributeAdapter() {
-                    @Override
-                    public Object get(Request request, String name) {
-                        if (request.getCoyoteRequest().getParameters()
-                                .isParseFailed()) {
-                            return Boolean.TRUE;
-                        }
-                        return null;
-                    }
+            @Override
+            public void set(Request request, String name, Object value) {
+                // NO-OP
+            }
+        });
+        specialAttributes.put(Globals.PARAMETER_PARSE_FAILED_ATTR, new SpecialAttributeAdapter() {
+            @Override
+            public Object get(Request request, String name) {
+                if (request.getCoyoteRequest().getParameters().isParseFailed()) {
+                    return Boolean.TRUE;
+                }
+                return null;
+            }
 
-                    @Override
-                    public void set(Request request, String name, Object value) {
-                        // NO-OP
-                    }
-                });
-        specialAttributes.put(Globals.PARAMETER_PARSE_FAILED_REASON_ATTR,
-                new SpecialAttributeAdapter() {
-                    @Override
-                    public Object get(Request request, String name) {
-                        return request.getCoyoteRequest().getParameters().getParseFailedReason();
-                    }
+            @Override
+            public void set(Request request, String name, Object value) {
+                // NO-OP
+            }
+        });
+        specialAttributes.put(Globals.PARAMETER_PARSE_FAILED_REASON_ATTR, new SpecialAttributeAdapter() {
+            @Override
+            public Object get(Request request, String name) {
+                return request.getCoyoteRequest().getParameters().getParseFailedReason();
+            }
 
-                    @Override
-                    public void set(Request request, String name, Object value) {
-                        // NO-OP
-                    }
-                });
-        specialAttributes.put(Globals.SENDFILE_SUPPORTED_ATTR,
-                new SpecialAttributeAdapter() {
-                    @Override
-                    public Object get(Request request, String name) {
-                        return Boolean.valueOf(
-                                request.getConnector().getProtocolHandler(
-                                        ).isSendfileSupported() && request.getCoyoteRequest().getSendfile());
-                    }
-                    @Override
-                    public void set(Request request, String name, Object value) {
-                        // NO-OP
-                    }
-                });
-        specialAttributes.put(Globals.REMOTE_IP_FILTER_SECURE,
-            new SpecialAttributeAdapter() {
-                @Override
-                public Object get(Request request, String name) {
-                    return Boolean.valueOf(request.isSecure());
-                }
+            @Override
+            public void set(Request request, String name, Object value) {
+                // NO-OP
+            }
+        });
+        specialAttributes.put(Globals.SENDFILE_SUPPORTED_ATTR, new SpecialAttributeAdapter() {
+            @Override
+            public Object get(Request request, String name) {
+                return Boolean.valueOf(request.getConnector().getProtocolHandler().isSendfileSupported() &&
+                        request.getCoyoteRequest().getSendfile());
+            }
 
-                @Override
-                public void set(Request request, String name, Object value) {
-                    if (value instanceof Boolean) {
-                        request.setSecure(((Boolean) value).booleanValue());
-                    }
+            @Override
+            public void set(Request request, String name, Object value) {
+                // NO-OP
+            }
+        });
+        specialAttributes.put(Globals.REMOTE_IP_FILTER_SECURE, new SpecialAttributeAdapter() {
+            @Override
+            public Object get(Request request, String name) {
+                return Boolean.valueOf(request.isSecure());
+            }
+
+            @Override
+            public void set(Request request, String name, Object value) {
+                if (value instanceof Boolean) {
+                    request.setSecure(((Boolean) value).booleanValue());
                 }
-            });
+            }
+        });
     }
 }
diff --git a/java/org/apache/catalina/connector/RequestFacade.java b/java/org/apache/catalina/connector/RequestFacade.java
index 006ec2a0ed..ae89d5087a 100644
--- a/java/org/apache/catalina/connector/RequestFacade.java
+++ b/java/org/apache/catalina/connector/RequestFacade.java
@@ -48,8 +48,7 @@ import org.apache.catalina.security.SecurityUtil;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * Facade class that wraps a Coyote request object.
- * All methods are delegated to the wrapped request.
+ * Facade class that wraps a Coyote request object. All methods are delegated to the wrapped request.
  *
  * @author Craig R. McClanahan
  * @author Remy Maucherat
@@ -57,8 +56,7 @@ import org.apache.tomcat.util.res.StringManager;
 public class RequestFacade implements HttpServletRequest {
 
 
-    private final class GetAttributePrivilegedAction
-            implements PrivilegedAction<Enumeration<String>> {
+    private final class GetAttributePrivilegedAction implements PrivilegedAction<Enumeration<String>> {
 
         @Override
         public Enumeration<String> run() {
@@ -67,22 +65,20 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    private final class GetParameterMapPrivilegedAction
-            implements PrivilegedAction<Map<String,String[]>> {
+    private final class GetParameterMapPrivilegedAction implements PrivilegedAction<Map<String, String[]>> {
 
         @Override
-        public Map<String,String[]> run() {
+        public Map<String, String[]> run() {
             return request.getParameterMap();
         }
     }
 
 
-    private final class GetRequestDispatcherPrivilegedAction
-            implements PrivilegedAction<RequestDispatcher> {
+    private final class GetRequestDispatcherPrivilegedAction implements PrivilegedAction<RequestDispatcher> {
 
         private final String path;
 
-        GetRequestDispatcherPrivilegedAction(String path){
+        GetRequestDispatcherPrivilegedAction(String path) {
             this.path = path;
         }
 
@@ -93,12 +89,11 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    private final class GetParameterPrivilegedAction
-            implements PrivilegedAction<String> {
+    private final class GetParameterPrivilegedAction implements PrivilegedAction<String> {
 
         public String name;
 
-        GetParameterPrivilegedAction(String name){
+        GetParameterPrivilegedAction(String name) {
             this.name = name;
         }
 
@@ -109,8 +104,7 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    private final class GetParameterNamesPrivilegedAction
-            implements PrivilegedAction<Enumeration<String>> {
+    private final class GetParameterNamesPrivilegedAction implements PrivilegedAction<Enumeration<String>> {
 
         @Override
         public Enumeration<String> run() {
@@ -119,12 +113,11 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    private final class GetParameterValuePrivilegedAction
-            implements PrivilegedAction<String[]> {
+    private final class GetParameterValuePrivilegedAction implements PrivilegedAction<String[]> {
 
         public String name;
 
-        GetParameterValuePrivilegedAction(String name){
+        GetParameterValuePrivilegedAction(String name) {
             this.name = name;
         }
 
@@ -135,8 +128,7 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    private final class GetCookiesPrivilegedAction
-            implements PrivilegedAction<Cookie[]> {
+    private final class GetCookiesPrivilegedAction implements PrivilegedAction<Cookie[]> {
 
         @Override
         public Cookie[] run() {
@@ -145,8 +137,7 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    private final class GetCharacterEncodingPrivilegedAction
-            implements PrivilegedAction<String> {
+    private final class GetCharacterEncodingPrivilegedAction implements PrivilegedAction<String> {
 
         @Override
         public String run() {
@@ -155,12 +146,11 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    private final class GetHeadersPrivilegedAction
-            implements PrivilegedAction<Enumeration<String>> {
+    private final class GetHeadersPrivilegedAction implements PrivilegedAction<Enumeration<String>> {
 
         private final String name;
 
-        GetHeadersPrivilegedAction(String name){
+        GetHeadersPrivilegedAction(String name) {
             this.name = name;
         }
 
@@ -171,8 +161,7 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    private final class GetHeaderNamesPrivilegedAction
-            implements PrivilegedAction<Enumeration<String>> {
+    private final class GetHeaderNamesPrivilegedAction implements PrivilegedAction<Enumeration<String>> {
 
         @Override
         public Enumeration<String> run() {
@@ -181,8 +170,7 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    private final class GetLocalePrivilegedAction
-            implements PrivilegedAction<Locale> {
+    private final class GetLocalePrivilegedAction implements PrivilegedAction<Locale> {
 
         @Override
         public Locale run() {
@@ -191,8 +179,7 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    private final class GetLocalesPrivilegedAction
-            implements PrivilegedAction<Enumeration<Locale>> {
+    private final class GetLocalesPrivilegedAction implements PrivilegedAction<Enumeration<Locale>> {
 
         @Override
         public Enumeration<Locale> run() {
@@ -200,12 +187,11 @@ public class RequestFacade implements HttpServletRequest {
         }
     }
 
-    private final class GetSessionPrivilegedAction
-            implements PrivilegedAction<HttpSession> {
+    private final class GetSessionPrivilegedAction implements PrivilegedAction<HttpSession> {
 
         private final boolean create;
 
-        GetSessionPrivilegedAction(boolean create){
+        GetSessionPrivilegedAction(boolean create) {
             this.create = create;
         }
 
@@ -219,7 +205,6 @@ public class RequestFacade implements HttpServletRequest {
     private static final StringManager sm = StringManager.getManager(RequestFacade.class);
 
 
-
     /**
      * The wrapped request.
      */
@@ -248,8 +233,7 @@ public class RequestFacade implements HttpServletRequest {
      * Prevent cloning the facade.
      */
     @Override
-    protected Object clone()
-        throws CloneNotSupportedException {
+    protected Object clone() throws CloneNotSupportedException {
         throw new CloneNotSupportedException();
     }
 
@@ -267,9 +251,8 @@ public class RequestFacade implements HttpServletRequest {
     public Enumeration<String> getAttributeNames() {
         checkFacade();
 
-        if (Globals.IS_SECURITY_ENABLED){
-            return AccessController.doPrivileged(
-                new GetAttributePrivilegedAction());
+        if (Globals.IS_SECURITY_ENABLED) {
+            return AccessController.doPrivileged(new GetAttributePrivilegedAction());
         } else {
             return request.getAttributeNames();
         }
@@ -280,9 +263,8 @@ public class RequestFacade implements HttpServletRequest {
     public String getCharacterEncoding() {
         checkFacade();
 
-        if (Globals.IS_SECURITY_ENABLED){
-            return AccessController.doPrivileged(
-                new GetCharacterEncodingPrivilegedAction());
+        if (Globals.IS_SECURITY_ENABLED) {
+            return AccessController.doPrivileged(new GetCharacterEncodingPrivilegedAction());
         } else {
             return request.getCharacterEncoding();
         }
@@ -321,9 +303,8 @@ public class RequestFacade implements HttpServletRequest {
     public String getParameter(String name) {
         checkFacade();
 
-        if (Globals.IS_SECURITY_ENABLED){
-            return AccessController.doPrivileged(
-                new GetParameterPrivilegedAction(name));
+        if (Globals.IS_SECURITY_ENABLED) {
+            return AccessController.doPrivileged(new GetParameterPrivilegedAction(name));
         } else {
             return request.getParameter(name);
         }
@@ -334,9 +315,8 @@ public class RequestFacade implements HttpServletRequest {
     public Enumeration<String> getParameterNames() {
         checkFacade();
 
-        if (Globals.IS_SECURITY_ENABLED){
-            return AccessController.doPrivileged(
-                new GetParameterNamesPrivilegedAction());
+        if (Globals.IS_SECURITY_ENABLED) {
+            return AccessController.doPrivileged(new GetParameterNamesPrivilegedAction());
         } else {
             return request.getParameterNames();
         }
@@ -350,12 +330,11 @@ public class RequestFacade implements HttpServletRequest {
         String[] ret = null;
 
         /*
-         * Clone the returned array only if there is a security manager
-         * in place, so that performance won't suffer in the non-secure case
+         * Clone the returned array only if there is a security manager in place, so that performance won't suffer in
+         * the non-secure case
          */
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            ret = AccessController.doPrivileged(
-                new GetParameterValuePrivilegedAction(name));
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            ret = AccessController.doPrivileged(new GetParameterValuePrivilegedAction(name));
             if (ret != null) {
                 ret = ret.clone();
             }
@@ -368,12 +347,11 @@ public class RequestFacade implements HttpServletRequest {
 
 
     @Override
-    public Map<String,String[]> getParameterMap() {
+    public Map<String, String[]> getParameterMap() {
         checkFacade();
 
-        if (Globals.IS_SECURITY_ENABLED){
-            return AccessController.doPrivileged(
-                new GetParameterMapPrivilegedAction());
+        if (Globals.IS_SECURITY_ENABLED) {
+            return AccessController.doPrivileged(new GetParameterMapPrivilegedAction());
         } else {
             return request.getParameterMap();
         }
@@ -447,9 +425,8 @@ public class RequestFacade implements HttpServletRequest {
     public Locale getLocale() {
         checkFacade();
 
-        if (Globals.IS_SECURITY_ENABLED){
-            return AccessController.doPrivileged(
-                new GetLocalePrivilegedAction());
+        if (Globals.IS_SECURITY_ENABLED) {
+            return AccessController.doPrivileged(new GetLocalePrivilegedAction());
         } else {
             return request.getLocale();
         }
@@ -460,9 +437,8 @@ public class RequestFacade implements HttpServletRequest {
     public Enumeration<Locale> getLocales() {
         checkFacade();
 
-        if (Globals.IS_SECURITY_ENABLED){
-            return AccessController.doPrivileged(
-                new GetLocalesPrivilegedAction());
+        if (Globals.IS_SECURITY_ENABLED) {
+            return AccessController.doPrivileged(new GetLocalesPrivilegedAction());
         } else {
             return request.getLocales();
         }
@@ -480,9 +456,8 @@ public class RequestFacade implements HttpServletRequest {
     public RequestDispatcher getRequestDispatcher(String path) {
         checkFacade();
 
-        if (Globals.IS_SECURITY_ENABLED){
-            return AccessController.doPrivileged(
-                new GetRequestDispatcherPrivilegedAction(path));
+        if (Globals.IS_SECURITY_ENABLED) {
+            return AccessController.doPrivileged(new GetRequestDispatcherPrivilegedAction(path));
         } else {
             return request.getRequestDispatcher(path);
         }
@@ -502,12 +477,11 @@ public class RequestFacade implements HttpServletRequest {
         Cookie[] ret = null;
 
         /*
-         * Clone the returned array only if there is a security manager
-         * in place, so that performance won't suffer in the non-secure case
+         * Clone the returned array only if there is a security manager in place, so that performance won't suffer in
+         * the non-secure case
          */
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            ret = AccessController.doPrivileged(
-                new GetCookiesPrivilegedAction());
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            ret = AccessController.doPrivileged(new GetCookiesPrivilegedAction());
             if (ret != null) {
                 ret = ret.clone();
             }
@@ -537,9 +511,8 @@ public class RequestFacade implements HttpServletRequest {
     public Enumeration<String> getHeaders(String name) {
         checkFacade();
 
-        if (Globals.IS_SECURITY_ENABLED){
-            return AccessController.doPrivileged(
-                new GetHeadersPrivilegedAction(name));
+        if (Globals.IS_SECURITY_ENABLED) {
+            return AccessController.doPrivileged(new GetHeadersPrivilegedAction(name));
         } else {
             return request.getHeaders(name);
         }
@@ -550,9 +523,8 @@ public class RequestFacade implements HttpServletRequest {
     public Enumeration<String> getHeaderNames() {
         checkFacade();
 
-        if (Globals.IS_SECURITY_ENABLED){
-            return AccessController.doPrivileged(
-                new GetHeaderNamesPrivilegedAction());
+        if (Globals.IS_SECURITY_ENABLED) {
+            return AccessController.doPrivileged(new GetHeaderNamesPrivilegedAction());
         } else {
             return request.getHeaderNames();
         }
@@ -661,9 +633,8 @@ public class RequestFacade implements HttpServletRequest {
     public HttpSession getSession(boolean create) {
         checkFacade();
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.
-                doPrivileged(new GetSessionPrivilegedAction(create));
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new GetSessionPrivilegedAction(create));
         } else {
             return request.getSession(create);
         }
@@ -825,8 +796,8 @@ public class RequestFacade implements HttpServletRequest {
 
 
     @Override
-    public <T extends HttpUpgradeHandler> T upgrade(
-            Class<T> httpUpgradeHandlerClass) throws java.io.IOException, ServletException {
+    public <T extends HttpUpgradeHandler> T upgrade(Class<T> httpUpgradeHandlerClass)
+            throws java.io.IOException, ServletException {
         checkFacade();
         return request.upgrade(httpUpgradeHandlerClass);
     }
diff --git a/java/org/apache/catalina/connector/Response.java b/java/org/apache/catalina/connector/Response.java
index 44ce551860..b9945bc5da 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -184,8 +184,8 @@ public class Response implements HttpServletResponse {
 
 
     /*
-     * Not strictly required but it makes generating HTTP/2 push requests a lot
-     * easier if these are retained until the response is recycled.
+     * Not strictly required but it makes generating HTTP/2 push requests a lot easier if these are retained until the
+     * response is recycled.
      */
     private final List<Cookie> cookies = new ArrayList<>();
 
@@ -195,8 +195,7 @@ public class Response implements HttpServletResponse {
     // --------------------------------------------------------- Public Methods
 
     /**
-     * Release all object references, and initialize instance variables, in
-     * preparation for reuse of this object.
+     * Release all object references, and initialize instance variables, in preparation for reuse of this object.
      */
     public void recycle() {
 
@@ -237,9 +236,8 @@ public class Response implements HttpServletResponse {
     // ------------------------------------------------------- Response Methods
 
     /**
-     * @return the number of bytes the application has actually written to the
-     * output stream. This excludes chunking, compression, etc. as well as
-     * headers.
+     * @return the number of bytes the application has actually written to the output stream. This excludes chunking,
+     *             compression, etc. as well as headers.
      */
     public long getContentWritten() {
         return outputBuffer.getContentWritten();
@@ -247,8 +245,9 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * @return the number of bytes the actually written to the socket. This
-     * includes chunking, compression, etc. but excludes headers.
+     * @return the number of bytes the actually written to the socket. This includes chunking, compression, etc. but
+     *             excludes headers.
+     *
      * @param flush if <code>true</code> will perform a buffer flush first
      */
     public long getBytesWritten(boolean flush) {
@@ -278,9 +277,8 @@ public class Response implements HttpServletResponse {
      * @return <code>true</code> if the application has committed the response
      */
     public boolean isAppCommitted() {
-        return this.appCommitted || isCommitted() || isSuspended()
-                || ((getContentLength() > 0)
-                    && (getContentWritten() >= getContentLength()));
+        return this.appCommitted || isCommitted() || isSuspended() ||
+                ((getContentLength() > 0) && (getContentWritten() >= getContentLength()));
     }
 
 
@@ -313,8 +311,7 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * @return the <code>ServletResponse</code> for which this object
-     * is the facade.
+     * @return the <code>ServletResponse</code> for which this object is the facade.
      */
     public HttpServletResponse getResponse() {
         if (facade == null) {
@@ -328,13 +325,10 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * Set a wrapped HttpServletResponse to pass to the application. Components
-     * wishing to wrap the response should obtain the response via
-     * {@link #getResponse()}, wrap it and then call this method with the
-     * wrapped response.
+     * Set a wrapped HttpServletResponse to pass to the application. Components wishing to wrap the response should
+     * obtain the response via {@link #getResponse()}, wrap it and then call this method with the wrapped response.
      *
-     * @param applicationResponse The wrapped response to pass to the
-     *        application
+     * @param applicationResponse The wrapped response to pass to the application
      */
     public void setResponse(HttpServletResponse applicationResponse) {
         // Check the wrapper wraps this request
@@ -410,8 +404,7 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * Perform whatever actions are required to flush and close the output
-     * stream or writer, in a single operation.
+     * Perform whatever actions are required to flush and close the output stream or writer, in a single operation.
      *
      * @exception IOException if an input/output error occurs
      */
@@ -430,8 +423,8 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * @return the content type that was set or calculated for this response,
-     * or <code>null</code> if no content type was set.
+     * @return the content type that was set or calculated for this response, or <code>null</code> if no content type
+     *             was set.
      */
     @Override
     public String getContentType() {
@@ -440,14 +433,12 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * Return a PrintWriter that can be used to render error messages,
-     * regardless of whether a stream or writer has already been acquired.
+     * Return a PrintWriter that can be used to render error messages, regardless of whether a stream or writer has
+     * already been acquired.
      *
-     * @return Writer which can be used for error reports. If the response is
-     * not an error report returned using sendError or triggered by an
-     * unexpected exception thrown during the servlet processing
-     * (and only in that case), null will be returned if the response stream
-     * has already been used.
+     * @return Writer which can be used for error reports. If the response is not an error report returned using
+     *             sendError or triggered by an unexpected exception thrown during the servlet processing (and only in
+     *             that case), null will be returned if the response stream has already been used.
      *
      * @exception IOException if an input/output error occurs
      */
@@ -500,7 +491,7 @@ public class Response implements HttpServletResponse {
         Context context = getContext();
         String result = null;
         if (context != null) {
-            result =  context.getResponseCharacterEncoding();
+            result = context.getResponseCharacterEncoding();
         }
 
         if (result == null) {
@@ -514,17 +505,14 @@ public class Response implements HttpServletResponse {
     /**
      * @return the servlet output stream associated with this Response.
      *
-     * @exception IllegalStateException if <code>getWriter</code> has
-     *  already been called for this response
-     * @exception IOException if an input/output error occurs
+     * @exception IllegalStateException if <code>getWriter</code> has already been called for this response
+     * @exception IOException           if an input/output error occurs
      */
     @Override
-    public ServletOutputStream getOutputStream()
-        throws IOException {
+    public ServletOutputStream getOutputStream() throws IOException {
 
         if (usingWriter) {
-            throw new IllegalStateException
-                (sm.getString("coyoteResponse.getOutputStream.ise"));
+            throw new IllegalStateException(sm.getString("coyoteResponse.getOutputStream.ise"));
         }
 
         usingOutputStream = true;
@@ -548,31 +536,24 @@ public class Response implements HttpServletResponse {
     /**
      * @return the writer associated with this Response.
      *
-     * @exception IllegalStateException if <code>getOutputStream</code> has
-     *  already been called for this response
-     * @exception IOException if an input/output error occurs
+     * @exception IllegalStateException if <code>getOutputStream</code> has already been called for this response
+     * @exception IOException           if an input/output error occurs
      */
     @Override
-    public PrintWriter getWriter()
-        throws IOException {
+    public PrintWriter getWriter() throws IOException {
 
         if (usingOutputStream) {
-            throw new IllegalStateException
-                (sm.getString("coyoteResponse.getWriter.ise"));
+            throw new IllegalStateException(sm.getString("coyoteResponse.getWriter.ise"));
         }
 
         if (request.getConnector().getEnforceEncodingInGetWriter()) {
             /*
-             * If the response's character encoding has not been specified as
-             * described in <code>getCharacterEncoding</code> (i.e., the method
-             * just returns the default value <code>ISO-8859-1</code>),
-             * <code>getWriter</code> updates it to <code>ISO-8859-1</code>
-             * (with the effect that a subsequent call to getContentType() will
-             * include a charset=ISO-8859-1 component which will also be
-             * reflected in the Content-Type response header, thereby satisfying
-             * the Servlet spec requirement that containers must communicate the
-             * character encoding used for the servlet response's writer to the
-             * client).
+             * If the response's character encoding has not been specified as described in
+             * <code>getCharacterEncoding</code> (i.e., the method just returns the default value
+             * <code>ISO-8859-1</code>), <code>getWriter</code> updates it to <code>ISO-8859-1</code> (with the effect
+             * that a subsequent call to getContentType() will include a charset=ISO-8859-1 component which will also be
+             * reflected in the Content-Type response header, thereby satisfying the Servlet spec requirement that
+             * containers must communicate the character encoding used for the servlet response's writer to the client).
              */
             setCharacterEncoding(getCharacterEncoding());
         }
@@ -600,8 +581,7 @@ public class Response implements HttpServletResponse {
     /**
      * Clear any content written to the buffer.
      *
-     * @exception IllegalStateException if this response has already
-     *  been committed
+     * @exception IllegalStateException if this response has already been committed
      */
     @Override
     public void reset() {
@@ -621,8 +601,7 @@ public class Response implements HttpServletResponse {
     /**
      * Reset the data buffer but not any status or header information.
      *
-     * @exception IllegalStateException if the response has already
-     *  been committed
+     * @exception IllegalStateException if the response has already been committed
      */
     @Override
     public void resetBuffer() {
@@ -631,26 +610,23 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * Reset the data buffer and the using Writer/Stream flags but not any
-     * status or header information.
+     * Reset the data buffer and the using Writer/Stream flags but not any status or header information.
      *
-     * @param resetWriterStreamFlags <code>true</code> if the internal
-     *        <code>usingWriter</code>, <code>usingOutputStream</code>,
-     *        <code>isCharacterEncodingSet</code> flags should also be reset
+     * @param resetWriterStreamFlags <code>true</code> if the internal <code>usingWriter</code>,
+     *                                   <code>usingOutputStream</code>, <code>isCharacterEncodingSet</code> flags
+     *                                   should also be reset
      *
-     * @exception IllegalStateException if the response has already
-     *  been committed
+     * @exception IllegalStateException if the response has already been committed
      */
     public void resetBuffer(boolean resetWriterStreamFlags) {
 
         if (isCommitted()) {
-            throw new IllegalStateException
-                (sm.getString("coyoteResponse.resetBuffer.ise"));
+            throw new IllegalStateException(sm.getString("coyoteResponse.resetBuffer.ise"));
         }
 
         outputBuffer.reset(resetWriterStreamFlags);
 
-        if(resetWriterStreamFlags) {
+        if (resetWriterStreamFlags) {
             usingOutputStream = false;
             usingWriter = false;
             isCharacterEncodingSet = false;
@@ -664,15 +640,13 @@ public class Response implements HttpServletResponse {
      *
      * @param size The new buffer size
      *
-     * @exception IllegalStateException if this method is called after
-     *  output has been committed for this response
+     * @exception IllegalStateException if this method is called after output has been committed for this response
      */
     @Override
     public void setBufferSize(int size) {
 
         if (isCommitted() || !outputBuffer.isNew()) {
-            throw new IllegalStateException
-                (sm.getString("coyoteResponse.setBufferSize.ise"));
+            throw new IllegalStateException(sm.getString("coyoteResponse.setBufferSize.ise"));
         }
 
         outputBuffer.setBufferSize(size);
@@ -769,9 +743,8 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * Overrides the name of the character encoding used in the body
-     * of the request. This method must be called prior to reading
-     * request parameters or reading input using getReader().
+     * Overrides the name of the character encoding used in the body of the request. This method must be called prior to
+     * reading request parameters or reading input using getReader().
      *
      * @param charset String containing the name of the character encoding.
      */
@@ -808,8 +781,7 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * Set the Locale that is appropriate for this response, including
-     * setting the appropriate character encoding.
+     * Set the Locale that is appropriate for this response, including setting the appropriate character encoding.
      *
      * @param locale The new locale
      */
@@ -895,8 +867,7 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * @return the error message that was set with <code>sendError()</code>
-     * for this Response.
+     * @return the error message that was set with <code>sendError()</code> for this Response.
      */
     public String getMessage() {
         return getCoyoteResponse().getMessage();
@@ -912,8 +883,7 @@ public class Response implements HttpServletResponse {
     // -------------------------------------------- HttpServletResponse Methods
 
     /**
-     * Add the specified Cookie to those that will be included with
-     * this Response.
+     * Add the specified Cookie to those that will be included with this Response.
      *
      * @param cookie Cookie to be added
      */
@@ -928,13 +898,12 @@ public class Response implements HttpServletResponse {
         cookies.add(cookie);
 
         String header = generateCookieString(cookie);
-        //if we reached here, no exception, cookie is valid
+        // if we reached here, no exception, cookie is valid
         addHeader("Set-Cookie", header, getContext().getCookieProcessor().getCharset());
     }
 
     /**
-     * Special method for adding a session cookie as we should be overriding
-     * any previous.
+     * Special method for adding a session cookie as we should be overriding any previous.
      *
      * @param cookie The new session cookie to add the response
      */
@@ -969,8 +938,8 @@ public class Response implements HttpServletResponse {
         // Web application code can receive a IllegalArgumentException
         // from the generateHeader() invocation
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return AccessController.doPrivileged(
-                    new PrivilegedGenerateCookieString(getContext(), cookie, request.getRequest()));
+            return AccessController
+                    .doPrivileged(new PrivilegedGenerateCookieString(getContext(), cookie, request.getRequest()));
         } else {
             return getContext().getCookieProcessor().generateHeader(cookie, request.getRequest());
         }
@@ -980,7 +949,7 @@ public class Response implements HttpServletResponse {
     /**
      * Add the specified date header to the specified value.
      *
-     * @param name Name of the header to set
+     * @param name  Name of the header to set
      * @param value Date value to be set
      */
     @Override
@@ -1006,7 +975,7 @@ public class Response implements HttpServletResponse {
     /**
      * Add the specified header to the specified value.
      *
-     * @param name Name of the header to set
+     * @param name  Name of the header to set
      * @param value Value to be set
      */
     @Override
@@ -1030,8 +999,8 @@ public class Response implements HttpServletResponse {
             return;
         }
 
-        char cc=name.charAt(0);
-        if (cc=='C' || cc=='c') {
+        char cc = name.charAt(0);
+        if (cc == 'C' || cc == 'c') {
             if (checkSpecialHeader(name, value)) {
                 return;
             }
@@ -1042,12 +1011,10 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * An extended version of this exists in {@link org.apache.coyote.Response}.
-     * This check is required here to ensure that the usingWriter check in
-     * {@link #setContentType(String)} is applied since usingWriter is not
-     * visible to {@link org.apache.coyote.Response}
+     * An extended version of this exists in {@link org.apache.coyote.Response}. This check is required here to ensure
+     * that the usingWriter check in {@link #setContentType(String)} is applied since usingWriter is not visible to
+     * {@link org.apache.coyote.Response} Called from set/addHeader.
      *
-     * Called from set/addHeader.
      * @return <code>true</code> if the header is special, no need to set the header.
      */
     private boolean checkSpecialHeader(String name, String value) {
@@ -1062,7 +1029,7 @@ public class Response implements HttpServletResponse {
     /**
      * Add the specified integer header to the specified value.
      *
-     * @param name Name of the header to set
+     * @param name  Name of the header to set
      * @param value Integer value to be set
      */
     @Override
@@ -1090,19 +1057,20 @@ public class Response implements HttpServletResponse {
      * Has the specified header been set already in this response?
      *
      * @param name Name of the header to check
+     *
      * @return <code>true</code> if the header has been set
      */
     @Override
     public boolean containsHeader(String name) {
         // Need special handling for Content-Type and Content-Length due to
         // special handling of these in coyoteResponse
-        char cc=name.charAt(0);
-        if(cc=='C' || cc=='c') {
-            if(name.equalsIgnoreCase("Content-Type")) {
+        char cc = name.charAt(0);
+        if (cc == 'C' || cc == 'c') {
+            if (name.equalsIgnoreCase("Content-Type")) {
                 // Will return null if this has not been set
                 return (getCoyoteResponse().getContentType() != null);
             }
-            if(name.equalsIgnoreCase("Content-Length")) {
+            if (name.equalsIgnoreCase("Content-Length")) {
                 // -1 means not known and is not sent to client
                 return (getCoyoteResponse().getContentLengthLong() != -1);
             }
@@ -1125,10 +1093,10 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * Encode the session identifier associated with this response
-     * into the specified redirect URL, if necessary.
+     * Encode the session identifier associated with this response into the specified redirect URL, if necessary.
      *
      * @param url URL to be encoded
+     *
      * @return <code>true</code> if the URL was encoded
      */
     @Override
@@ -1142,10 +1110,10 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * Encode the session identifier associated with this response
-     * into the specified URL, if necessary.
+     * Encode the session identifier associated with this response into the specified URL, if necessary.
      *
      * @param url URL to be encoded
+     *
      * @return <code>true</code> if the URL was encoded
      */
     @Override
@@ -1177,9 +1145,8 @@ public class Response implements HttpServletResponse {
     /**
      * Send an acknowledgement of a request.
      *
-     * @param continueResponseTiming Indicates when the request for the ACK
-     *                               originated so it can be compared with the
-     *                               configured timing for ACK responses.
+     * @param continueResponseTiming Indicates when the request for the ACK originated so it can be compared with the
+     *                                   configured timing for ACK responses.
      *
      * @exception IOException if an input/output error occurs
      */
@@ -1199,14 +1166,12 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * Send an error response with the specified status and a
-     * default message.
+     * Send an error response with the specified status and a default message.
      *
      * @param status HTTP status code to send
      *
-     * @exception IllegalStateException if this response has
-     *  already been committed
-     * @exception IOException if an input/output error occurs
+     * @exception IllegalStateException if this response has already been committed
+     * @exception IOException           if an input/output error occurs
      */
     @Override
     public void sendError(int status) throws IOException {
@@ -1217,19 +1182,17 @@ public class Response implements HttpServletResponse {
     /**
      * Send an error response with the specified status and message.
      *
-     * @param status HTTP status code to send
+     * @param status  HTTP status code to send
      * @param message Corresponding message to send
      *
-     * @exception IllegalStateException if this response has
-     *  already been committed
-     * @exception IOException if an input/output error occurs
+     * @exception IllegalStateException if this response has already been committed
+     * @exception IOException           if an input/output error occurs
      */
     @Override
     public void sendError(int status, String message) throws IOException {
 
         if (isCommitted()) {
-            throw new IllegalStateException
-                (sm.getString("coyoteResponse.sendError.ise"));
+            throw new IllegalStateException(sm.getString("coyoteResponse.sendError.ise"));
         }
 
         // Ignore any call from an included servlet
@@ -1255,9 +1218,8 @@ public class Response implements HttpServletResponse {
      *
      * @param location Location URL to redirect to
      *
-     * @exception IllegalStateException if this response has
-     *  already been committed
-     * @exception IOException if an input/output error occurs
+     * @exception IllegalStateException if this response has already been committed
+     * @exception IOException           if an input/output error occurs
      */
     @Override
     public void sendRedirect(String location) throws IOException {
@@ -1266,12 +1228,12 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * Internal method that allows a redirect to be sent with a status other
-     * than {@link HttpServletResponse#SC_FOUND} (302). No attempt is made to
-     * validate the status code.
+     * Internal method that allows a redirect to be sent with a status other than {@link HttpServletResponse#SC_FOUND}
+     * (302). No attempt is made to validate the status code.
      *
      * @param location Location URL to redirect to
-     * @param status HTTP status code that will be sent
+     * @param status   HTTP status code that will be sent
+     *
      * @throws IOException an IO exception occurred
      */
     public void sendRedirect(String location, int status) throws IOException {
@@ -1305,8 +1267,7 @@ public class Response implements HttpServletResponse {
             setHeader("Location", locationUri);
             if (context != null && context.getSendRedirectBody()) {
                 PrintWriter writer = getWriter();
-                writer.print(sm.getString("coyoteResponse.sendRedirect.note",
-                        Escape.htmlElementContent(locationUri)));
+                writer.print(sm.getString("coyoteResponse.sendRedirect.note", Escape.htmlElementContent(locationUri)));
                 flushBuffer();
             }
         } catch (IllegalArgumentException e) {
@@ -1322,7 +1283,7 @@ public class Response implements HttpServletResponse {
     /**
      * Set the specified date header to the specified value.
      *
-     * @param name Name of the header to set
+     * @param name  Name of the header to set
      * @param value Date value to be set
      */
     @Override
@@ -1348,7 +1309,7 @@ public class Response implements HttpServletResponse {
     /**
      * Set the specified header to the specified value.
      *
-     * @param name Name of the header to set
+     * @param name  Name of the header to set
      * @param value Value to be set
      */
     @Override
@@ -1367,8 +1328,8 @@ public class Response implements HttpServletResponse {
             return;
         }
 
-        char cc=name.charAt(0);
-        if (cc=='C' || cc=='c') {
+        char cc = name.charAt(0);
+        if (cc == 'C' || cc == 'c') {
             if (checkSpecialHeader(name, value)) {
                 return;
             }
@@ -1381,7 +1342,7 @@ public class Response implements HttpServletResponse {
     /**
      * Set the specified integer header to the specified value.
      *
-     * @param name Name of the header to set
+     * @param name  Name of the header to set
      * @param value Integer value to be set
      */
     @Override
@@ -1429,17 +1390,16 @@ public class Response implements HttpServletResponse {
     // ------------------------------------------------------ Protected Methods
 
     /**
-     * Return <code>true</code> if the specified URL should be encoded with
-     * a session identifier.  This will be true if all of the following
-     * conditions are met:
+     * Return <code>true</code> if the specified URL should be encoded with a session identifier. This will be true if
+     * all of the following conditions are met:
      * <ul>
      * <li>The request we are responding to asked for a valid session
      * <li>The requested session ID was not received via a cookie
-     * <li>The specified URL points back to somewhere within the web
-     *     application that is responding to this request
+     * <li>The specified URL points back to somewhere within the web application that is responding to this request
      * </ul>
      *
      * @param location Absolute URL to be validated
+     *
      * @return <code>true</code> if the URL should be encoded
      */
     protected boolean isEncodeable(final String location) {
@@ -1464,14 +1424,13 @@ public class Response implements HttpServletResponse {
         }
 
         // Is URL encoding permitted
-        if (!hreq.getServletContext().getEffectiveSessionTrackingModes().
-                contains(SessionTrackingMode.URL)) {
+        if (!hreq.getServletContext().getEffectiveSessionTrackingModes().contains(SessionTrackingMode.URL)) {
             return false;
         }
 
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            Boolean result =  AccessController.doPrivileged(
-                    new PrivilegedDoIsEncodable(getContext(), hreq, session, location));
+            Boolean result = AccessController
+                    .doPrivileged(new PrivilegedDoIsEncodable(getContext(), hreq, session, location));
             return result.booleanValue();
         } else {
             return doIsEncodeable(getContext(), hreq, session, location);
@@ -1479,8 +1438,7 @@ public class Response implements HttpServletResponse {
     }
 
 
-    private static boolean doIsEncodeable(Context context, Request hreq, Session session,
-                                   String location) {
+    private static boolean doIsEncodeable(Context context, Request hreq, Session session, String location) {
         // Is this a valid absolute URL?
         URL url = null;
         try {
@@ -1523,9 +1481,8 @@ public class Response implements HttpServletResponse {
             if (!file.startsWith(contextPath)) {
                 return false;
             }
-            String tok = ";" + SessionConfig.getSessionUriParamName(context) + "=" +
-                    session.getIdInternal();
-            if( file.indexOf(tok, contextPath.length()) >= 0 ) {
+            String tok = ";" + SessionConfig.getSessionUriParamName(context) + "=" + session.getIdInternal();
+            if (file.indexOf(tok, contextPath.length()) >= 0) {
                 return false;
             }
         }
@@ -1537,15 +1494,15 @@ public class Response implements HttpServletResponse {
 
 
     /**
-     * Convert (if necessary) and return the absolute URL that represents the
-     * resource referenced by this possibly relative URL.  If this URL is
-     * already absolute, return it unchanged.
+     * Convert (if necessary) and return the absolute URL that represents the resource referenced by this possibly
+     * relative URL. If this URL is already absolute, return it unchanged.
      *
      * @param location URL to be (possibly) converted and then returned
+     *
      * @return the encoded URL
      *
-     * @exception IllegalArgumentException if a MalformedURLException is
-     *  thrown when converting the relative URL to an absolute one
+     * @exception IllegalArgumentException if a MalformedURLException is thrown when converting the relative URL to an
+     *                                         absolute one
      */
     protected String toAbsolute(String location) {
 
@@ -1581,8 +1538,7 @@ public class Response implements HttpServletResponse {
                 redirectURLCC.append(scheme, 0, scheme.length());
                 redirectURLCC.append("://", 0, 3);
                 redirectURLCC.append(name, 0, name.length());
-                if ((scheme.equals("http") && port != 80)
-                    || (scheme.equals("https") && port != 443)) {
+                if ((scheme.equals("http") && port != 80) || (scheme.equals("https") && port != 443)) {
                     redirectURLCC.append(':');
                     String portS = port + "";
                     redirectURLCC.append(portS, 0, portS.length());
@@ -1591,11 +1547,11 @@ public class Response implements HttpServletResponse {
                     String relativePath = request.getDecodedRequestURI();
                     int pos = relativePath.lastIndexOf('/');
                     CharChunk encodedURI = null;
-                    if (SecurityUtil.isPackageProtectionEnabled() ){
-                        try{
-                            encodedURI = AccessController.doPrivileged(
-                                    new PrivilegedEncodeUrl(urlEncoder, relativePath, pos));
-                        } catch (PrivilegedActionException pae){
+                    if (SecurityUtil.isPackageProtectionEnabled()) {
+                        try {
+                            encodedURI = AccessController
+                                    .doPrivileged(new PrivilegedEncodeUrl(urlEncoder, relativePath, pos));
+                        } catch (PrivilegedActionException pae) {
                             throw new IllegalArgumentException(location, pae.getException());
                         }
                     } else {
@@ -1623,8 +1579,7 @@ public class Response implements HttpServletResponse {
     }
 
     /**
-     * Removes /./ and /../ sequences from absolute URLs.
-     * Code borrowed heavily from CoyoteAdapter.normalize()
+     * Removes /./ and /../ sequences from absolute URLs. Code borrowed heavily from CoyoteAdapter.normalize()
      *
      * @param cc the char chunk containing the chars to normalize
      */
@@ -1637,8 +1592,7 @@ public class Response implements HttpServletResponse {
         }
         char[] truncateCC = null;
         if (truncate > -1) {
-            truncateCC = Arrays.copyOfRange(cc.getBuffer(),
-                    cc.getStart() + truncate, cc.getEnd());
+            truncateCC = Arrays.copyOfRange(cc.getBuffer(), cc.getStart() + truncate, cc.getEnd());
             cc.setEnd(cc.getStart() + truncate);
         }
 
@@ -1670,8 +1624,7 @@ public class Response implements HttpServletResponse {
             if (index < 0) {
                 break;
             }
-            copyChars(c, start + index, start + index + 2,
-                      end - start - index - 2);
+            copyChars(c, start + index, start + index + 2, end - start - index - 2);
             end = end - 2;
             cc.setEnd(end);
         }
@@ -1689,13 +1642,12 @@ public class Response implements HttpServletResponse {
                 throw new IllegalArgumentException();
             }
             int index2 = -1;
-            for (pos = start + index - 1; (pos >= 0) && (index2 < 0); pos --) {
+            for (pos = start + index - 1; (pos >= 0) && (index2 < 0); pos--) {
                 if (c[pos] == (byte) '/') {
                     index2 = pos;
                 }
             }
-            copyChars(c, start + index2, start + index + 3,
-                      end - start - index - 3);
+            copyChars(c, start + index2, start + index + 3, end - start - index - 3);
             end = end + index2 - index - 3;
             cc.setEnd(end);
             index = index2;
@@ -1720,6 +1672,7 @@ public class Response implements HttpServletResponse {
      * Determine if an absolute URL has a path component.
      *
      * @param uri the URL that will be checked
+     *
      * @return <code>true</code> if the URL has a path
      */
     private boolean hasPath(String uri) {
@@ -1735,11 +1688,11 @@ public class Response implements HttpServletResponse {
     }
 
     /**
-     * Return the specified URL with the specified session identifier
-     * suitably encoded.
+     * Return the specified URL with the specified session identifier suitably encoded.
      *
-     * @param url URL to be encoded with the session id
+     * @param url       URL to be encoded with the session id
      * @param sessionId Session id to be included in the encoded URL
+     *
      * @return the encoded URL
      */
     protected String toEncoded(String url, String sessionId) {
@@ -1761,10 +1714,9 @@ public class Response implements HttpServletResponse {
             path = path.substring(0, pound);
         }
         StringBuilder sb = new StringBuilder(path);
-        if( sb.length() > 0 ) { // jsessionid can't be first.
+        if (sb.length() > 0) { // jsessionid can't be first.
             sb.append(';');
-            sb.append(SessionConfig.getSessionUriParamName(
-                    request.getContext()));
+            sb.append(SessionConfig.getSessionUriParamName(request.getContext()));
             sb.append('=');
             sb.append(sessionId);
         }
@@ -1787,7 +1739,7 @@ public class Response implements HttpServletResponse {
         }
 
         @Override
-        public String run(){
+        public String run() {
             return context.getCookieProcessor().generateHeader(cookie, request);
         }
     }
@@ -1800,8 +1752,7 @@ public class Response implements HttpServletResponse {
         private final Session session;
         private final String location;
 
-        PrivilegedDoIsEncodable(Context context, Request hreq, Session session,
-                String location) {
+        PrivilegedDoIsEncodable(Context context, Request hreq, Session session, String location) {
             this.context = context;
             this.hreq = hreq;
             this.session = session;
@@ -1809,7 +1760,7 @@ public class Response implements HttpServletResponse {
         }
 
         @Override
-        public Boolean run(){
+        public Boolean run() {
             return Boolean.valueOf(doIsEncodeable(context, hreq, session, location));
         }
     }
@@ -1828,7 +1779,7 @@ public class Response implements HttpServletResponse {
         }
 
         @Override
-        public CharChunk run() throws IOException{
+        public CharChunk run() throws IOException {
             return urlEncoder.encodeURL(relativePath, 0, end);
         }
     }
diff --git a/java/org/apache/catalina/connector/ResponseFacade.java b/java/org/apache/catalina/connector/ResponseFacade.java
index 02a084659f..49e44e6dbd 100644
--- a/java/org/apache/catalina/connector/ResponseFacade.java
+++ b/java/org/apache/catalina/connector/ResponseFacade.java
@@ -36,8 +36,7 @@ import org.apache.catalina.security.SecurityUtil;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * Facade class that wraps a Coyote response object.
- * All methods are delegated to the wrapped response.
+ * Facade class that wraps a Coyote response object. All methods are delegated to the wrapped response.
  *
  * @author Remy Maucherat
  */
@@ -45,12 +44,11 @@ public class ResponseFacade implements HttpServletResponse {
 
     // ----------------------------------------------------------- DoPrivileged
 
-    private final class SetContentTypePrivilegedAction
-            implements PrivilegedAction<Void> {
+    private final class SetContentTypePrivilegedAction implements PrivilegedAction<Void> {
 
         private final String contentType;
 
-        SetContentTypePrivilegedAction(String contentType){
+        SetContentTypePrivilegedAction(String contentType) {
             this.contentType = contentType;
         }
 
@@ -61,8 +59,7 @@ public class ResponseFacade implements HttpServletResponse {
         }
     }
 
-    private final class DateHeaderPrivilegedAction
-            implements PrivilegedAction<Void> {
+    private final class DateHeaderPrivilegedAction implements PrivilegedAction<Void> {
 
         private final String name;
         private final long value;
@@ -76,7 +73,7 @@ public class ResponseFacade implements HttpServletResponse {
 
         @Override
         public Void run() {
-            if(add) {
+            if (add) {
                 response.addDateHeader(name, value);
             } else {
                 response.setDateHeader(name, value);
@@ -110,7 +107,7 @@ public class ResponseFacade implements HttpServletResponse {
      * @param response The response to be wrapped
      */
     public ResponseFacade(Response response) {
-         this.response = response;
+        this.response = response;
     }
 
 
@@ -224,7 +221,7 @@ public class ResponseFacade implements HttpServletResponse {
             return;
         }
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
+        if (SecurityUtil.isPackageProtectionEnabled()) {
             AccessController.doPrivileged(new SetContentTypePrivilegedAction(type));
         } else {
             response.setContentType(type);
@@ -254,12 +251,12 @@ public class ResponseFacade implements HttpServletResponse {
         }
 
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            try{
+            try {
                 AccessController.doPrivileged(new FlushBufferPrivilegedAction(response));
-            } catch(PrivilegedActionException e) {
+            } catch (PrivilegedActionException e) {
                 Exception ex = e.getException();
                 if (ex instanceof IOException) {
-                    throw (IOException)ex;
+                    throw (IOException) ex;
                 }
             }
         } else {


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


[tomcat] 01/06: Handle CONNECT with deliberate 501 rather than accidental 400

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e4dff72164760179b6340bbc3c74c45c72a5bf9d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Feb 23 16:37:30 2023 +0000

    Handle CONNECT with deliberate 501 rather than accidental 400
---
 .../apache/catalina/connector/CoyoteAdapter.java   | 92 ++++++++++++----------
 .../catalina/connector/LocalStrings.properties     |  1 +
 java/org/apache/coyote/http2/Stream.java           |  3 +-
 .../apache/coyote/http11/TestHttp11Processor.java  | 18 +++++
 .../apache/coyote/http2/TestStreamProcessor.java   | 23 ++++++
 webapps/docs/changelog.xml                         |  4 +
 6 files changed, 97 insertions(+), 44 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java
index 79cff350f0..04afae184f 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -635,53 +635,59 @@ public class CoyoteAdapter implements Adapter {
 
         MessageBytes decodedURI = req.decodedURI();
 
-        if (undecodedURI.getType() == MessageBytes.T_BYTES) {
-            if (connector.getRejectSuspiciousURIs()) {
-                if (checkSuspiciousURIs(undecodedURI.getByteChunk())) {
-                    response.sendError(400, "Invalid URI");
+        // Filter CONNECT method
+        if (req.method().equalsIgnoreCase("CONNECT")) {
+            response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED, sm.getString("coyoteAdapter.connect"));
+        } else {
+            // No URI for CONNECT requests
+            if (undecodedURI.getType() == MessageBytes.T_BYTES) {
+                if (connector.getRejectSuspiciousURIs()) {
+                    if (checkSuspiciousURIs(undecodedURI.getByteChunk())) {
+                        response.sendError(400, "Invalid URI");
+                    }
                 }
-            }
 
-            // Copy the raw URI to the decodedURI
-            decodedURI.duplicate(undecodedURI);
+                // Copy the raw URI to the decodedURI
+                decodedURI.duplicate(undecodedURI);
 
-            // Parse (and strip out) the path parameters
-            parsePathParameters(req, request);
+                // Parse (and strip out) the path parameters
+                parsePathParameters(req, request);
 
-            // URI decoding
-            // %xx decoding of the URL
-            try {
-                req.getURLDecoder().convert(decodedURI.getByteChunk(), connector.getEncodedSolidusHandlingInternal());
-            } catch (IOException ioe) {
-                response.sendError(400, "Invalid URI: " + ioe.getMessage());
-            }
-            // Normalization
-            if (normalize(req.decodedURI(), connector.getAllowBackslash())) {
-                // Character decoding
-                convertURI(decodedURI, request);
-                // URIEncoding values are limited to US-ASCII supersets.
-                // Therefore it is not necessary to check that the URI remains
-                // normalized after character decoding
+                // URI decoding
+                // %xx decoding of the URL
+                try {
+                    req.getURLDecoder().convert(decodedURI.getByteChunk(), connector.getEncodedSolidusHandlingInternal());
+                } catch (IOException ioe) {
+                    response.sendError(400, "Invalid URI: " + ioe.getMessage());
+                }
+                // Normalization
+                if (normalize(req.decodedURI(), connector.getAllowBackslash())) {
+                    // Character decoding
+                    convertURI(decodedURI, request);
+                    // URIEncoding values are limited to US-ASCII supersets.
+                    // Therefore it is not necessary to check that the URI remains
+                    // normalized after character decoding
+                } else {
+                    response.sendError(400, "Invalid URI");
+                }
             } else {
-                response.sendError(400, "Invalid URI");
-            }
-        } else {
-            /* The URI is chars or String, and has been sent using an in-memory
-             * protocol handler. The following assumptions are made:
-             * - req.requestURI() has been set to the 'original' non-decoded,
-             *   non-normalized URI
-             * - req.decodedURI() has been set to the decoded, normalized form
-             *   of req.requestURI()
-             * - 'suspicious' URI filtering - if required - has already been
-             *   performed
-             */
-            decodedURI.toChars();
-            // Remove all path parameters; any needed path parameter should be set
-            // using the request object rather than passing it in the URL
-            CharChunk uriCC = decodedURI.getCharChunk();
-            int semicolon = uriCC.indexOf(';');
-            if (semicolon > 0) {
-                decodedURI.setChars(uriCC.getBuffer(), uriCC.getStart(), semicolon);
+                /* The URI is chars or String, and has been sent using an in-memory
+                 * protocol handler. The following assumptions are made:
+                 * - req.requestURI() has been set to the 'original' non-decoded,
+                 *   non-normalized URI
+                 * - req.decodedURI() has been set to the decoded, normalized form
+                 *   of req.requestURI()
+                 * - 'suspicious' URI filtering - if required - has already been
+                 *   performed
+                 */
+                decodedURI.toChars();
+                // Remove all path parameters; any needed path parameter should be set
+                // using the request object rather than passing it in the URL
+                CharChunk uriCC = decodedURI.getCharChunk();
+                int semicolon = uriCC.indexOf(';');
+                if (semicolon > 0) {
+                    decodedURI.setChars(uriCC.getBuffer(), uriCC.getStart(), semicolon);
+                }
             }
         }
 
@@ -837,7 +843,7 @@ public class CoyoteAdapter implements Adapter {
             return false;
         }
 
-        // Filter trace method
+        // Filter TRACE method
         if (!connector.getAllowTrace()
                 && req.method().equalsIgnoreCase("TRACE")) {
             Wrapper wrapper = request.getWrapper();
diff --git a/java/org/apache/catalina/connector/LocalStrings.properties b/java/org/apache/catalina/connector/LocalStrings.properties
index 6726b4a303..aaf3dd675a 100644
--- a/java/org/apache/catalina/connector/LocalStrings.properties
+++ b/java/org/apache/catalina/connector/LocalStrings.properties
@@ -19,6 +19,7 @@ coyoteAdapter.authenticate=Authenticated user [{0}] provided by connector
 coyoteAdapter.authorize=Authorizing user [{0}] using Tomcat''s Realm
 coyoteAdapter.checkRecycled.request=Encountered a non-recycled request and recycled it forcedly.
 coyoteAdapter.checkRecycled.response=Encountered a non-recycled response and recycled it forcedly.
+coyoteAdapter.connect=HTTP requests using the CONNECT method are not supported
 coyoteAdapter.debug=The variable [{0}] has value [{1}]
 coyoteAdapter.nullRequest=An asynchronous dispatch may only happen on an existing request
 
diff --git a/java/org/apache/coyote/http2/Stream.java b/java/org/apache/coyote/http2/Stream.java
index a8b59538a6..71463b01b5 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -506,7 +506,8 @@ class Stream extends AbstractNonZeroStream implements HeaderEmitter {
 
 
     final boolean receivedEndOfHeaders() throws ConnectionException {
-        if (coyoteRequest.method().isNull() || coyoteRequest.scheme().isNull() || coyoteRequest.requestURI().isNull()) {
+        if (coyoteRequest.method().isNull() || coyoteRequest.scheme().isNull() ||
+                !coyoteRequest.method().equalsIgnoreCase("CONNECT") && coyoteRequest.requestURI().isNull()) {
             throw new ConnectionException(sm.getString("stream.header.required", getConnectionId(), getIdAsString()),
                     Http2Error.PROTOCOL_ERROR);
         }
diff --git a/test/org/apache/coyote/http11/TestHttp11Processor.java b/test/org/apache/coyote/http11/TestHttp11Processor.java
index dfda55b892..9c0c02582c 100644
--- a/test/org/apache/coyote/http11/TestHttp11Processor.java
+++ b/test/org/apache/coyote/http11/TestHttp11Processor.java
@@ -1998,6 +1998,24 @@ public class TestHttp11Processor extends TomcatBaseTest {
     }
 
 
+    @Test
+    public void testConnect() throws Exception {
+        getTomcatInstanceTestWebapp(false, true);
+
+        String request =
+            "CONNECT example.local HTTP/1.1" + SimpleHttpClient.CRLF +
+            "Host: example.local" + SimpleHttpClient.CRLF +
+            SimpleHttpClient.CRLF;
+
+        Client client = new Client(getPort());
+        client.setRequest(new String[] {request});
+
+        client.connect();
+        client.processRequest();
+        Assert.assertTrue(client.isResponse501());
+    }
+
+
     private static class TestPostNoReadServlet extends HttpServlet {
 
         private static final long serialVersionUID = 1L;
diff --git a/test/org/apache/coyote/http2/TestStreamProcessor.java b/test/org/apache/coyote/http2/TestStreamProcessor.java
index 16fa106567..78e84bb57f 100644
--- a/test/org/apache/coyote/http2/TestStreamProcessor.java
+++ b/test/org/apache/coyote/http2/TestStreamProcessor.java
@@ -575,4 +575,27 @@ public class TestStreamProcessor extends Http2TestBase {
             }
         }
     }
+
+
+    @Test
+    public void testConnect() throws Exception {
+        http2Connect();
+
+        List<Header> headers = new ArrayList<>(4);
+        headers.add(new Header(":method", "CONNECT"));
+        headers.add(new Header(":scheme", "http"));
+        headers.add(new Header(":authority", "example.local"));
+
+        byte[] headersFrameHeader = new byte[9];
+        ByteBuffer headersPayload = ByteBuffer.allocate(128);
+
+        buildGetRequest(headersFrameHeader, headersPayload, null, headers , 3);
+
+        writeFrame(headersFrameHeader, headersPayload);
+
+        parser.readFrame();
+
+        String trace = output.getTrace();
+        Assert.assertTrue(trace, trace.contains("3-Header-[:status]-[501]"));
+    }
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 7a87a8f78f..69685c67b3 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -112,6 +112,10 @@
         types from mod_rewrite. Based on a pull request <pr>591</pr>
         provided by Dimitrios Soumis. (markt)
       </update>
+      <update>
+        Provide a more appropriate response (501 rather than 400) when rejecting
+        an HTTP request using the CONNECT method. (markt)
+      </update>
     </changelog>
   </subsection>
   <subsection name="Coyote">


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


[tomcat] 06/06: Clean-up - formatting. No functional change.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 018e5bd7dc3ba440b0f46daffbf1b5f1f3b93d65
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Feb 23 16:50:07 2023 +0000

    Clean-up - formatting. No functional change.
---
 test/org/apache/coyote/http2/Http2TestBase.java    | 215 +++++++--------
 .../apache/coyote/http2/TestAbstractStream.java    | 107 ++++----
 test/org/apache/coyote/http2/TestAsync.java        |  19 +-
 test/org/apache/coyote/http2/TestAsyncFlush.java   |   5 +-
 test/org/apache/coyote/http2/TestAsyncTimeout.java |   3 +-
 .../apache/coyote/http2/TestCancelledUpload.java   |  27 +-
 test/org/apache/coyote/http2/TestFlowControl.java  |  20 +-
 test/org/apache/coyote/http2/TestHpack.java        |   8 +-
 .../coyote/http2/TestHttp2InitialConnection.java   |  40 ++-
 test/org/apache/coyote/http2/TestHttp2Limits.java  | 294 ++++++++++-----------
 .../apache/coyote/http2/TestHttp2Section_3_2.java  |  31 +--
 .../apache/coyote/http2/TestHttp2Section_3_5.java  |   4 +-
 .../apache/coyote/http2/TestHttp2Section_4_1.java  |  10 +-
 .../apache/coyote/http2/TestHttp2Section_4_2.java  |  14 +-
 .../apache/coyote/http2/TestHttp2Section_4_3.java  |  11 +-
 .../apache/coyote/http2/TestHttp2Section_5_1.java  |  55 ++--
 .../apache/coyote/http2/TestHttp2Section_5_2.java  |  13 +-
 .../apache/coyote/http2/TestHttp2Section_5_3.java  |  53 ++--
 .../apache/coyote/http2/TestHttp2Section_5_5.java  |   9 +-
 .../apache/coyote/http2/TestHttp2Section_6_1.java  |  50 ++--
 .../apache/coyote/http2/TestHttp2Section_6_2.java  |  13 +-
 .../apache/coyote/http2/TestHttp2Section_6_3.java  |  10 +-
 .../apache/coyote/http2/TestHttp2Section_6_4.java  |  10 +-
 .../apache/coyote/http2/TestHttp2Section_6_5.java  |  22 +-
 .../apache/coyote/http2/TestHttp2Section_6_6.java  |   5 +-
 .../apache/coyote/http2/TestHttp2Section_6_7.java  |   7 +-
 .../apache/coyote/http2/TestHttp2Section_6_8.java  |  11 +-
 .../apache/coyote/http2/TestHttp2Section_6_9.java  |  63 ++---
 .../apache/coyote/http2/TestHttp2Section_8_1.java  |  72 ++---
 .../org/apache/coyote/http2/TestHttp2Timeouts.java |  10 +-
 .../coyote/http2/TestHttp2UpgradeHandler.java      |  46 +---
 test/org/apache/coyote/http2/TestLargeUpload.java  |  19 +-
 test/org/apache/coyote/http2/TestStream.java       |  32 +--
 .../apache/coyote/http2/TestStreamProcessor.java   |  26 +-
 .../apache/coyote/http2/TestStreamQueryString.java |  45 +---
 .../org/apache/coyote/http2/TesterHttp2Parser.java |   6 +-
 36 files changed, 554 insertions(+), 831 deletions(-)

diff --git a/test/org/apache/coyote/http2/Http2TestBase.java b/test/org/apache/coyote/http2/Http2TestBase.java
index 5747ba9e1a..7bf3dcfe8d 100644
--- a/test/org/apache/coyote/http2/Http2TestBase.java
+++ b/test/org/apache/coyote/http2/Http2TestBase.java
@@ -65,8 +65,7 @@ import org.apache.tomcat.util.http.MimeHeaders;
 import org.apache.tomcat.util.net.TesterSupport;
 
 /**
- * Tests for compliance with the <a href="https://tools.ietf.org/html/rfc7540">
- * HTTP/2 specification</a>.
+ * Tests for compliance with the <a href="https://tools.ietf.org/html/rfc7540"> HTTP/2 specification</a>.
  */
 @RunWith(Parameterized.class)
 public abstract class Http2TestBase extends TomcatBaseTest {
@@ -100,8 +99,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     private static final String HEADER_IGNORED = "x-ignore";
 
     static final String DEFAULT_CONNECTION_HEADER_VALUE = "Upgrade, HTTP2-Settings";
-    private static final byte[] EMPTY_SETTINGS_FRAME =
-        { 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 };
+    private static final byte[] EMPTY_SETTINGS_FRAME = { 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 };
     static final String EMPTY_HTTP2_SETTINGS_HEADER;
 
     static {
@@ -131,8 +129,8 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
     /**
-     * Standard setup. Creates HTTP/2 connection via HTTP upgrade and ensures
-     * that the first response is correctly received.
+     * Standard setup. Creates HTTP/2 connection via HTTP upgrade and ensures that the first response is correctly
+     * received.
      */
     protected void http2Connect() throws Exception {
         http2Connect(false);
@@ -167,12 +165,8 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         parser.readFrame();
         parser.readFrame();
 
-        Assert.assertEquals("0-Settings-[3]-[" + maxConcurrentStreams + "]\n" +
-                "0-Settings-End\n" +
-                "0-Settings-Ack\n" +
-                "0-Ping-[0,0,0,0,0,0,0,1]\n" +
-                getSimpleResponseTrace(1)
-                , output.getTrace());
+        Assert.assertEquals("0-Settings-[3]-[" + maxConcurrentStreams + "]\n" + "0-Settings-End\n" +
+                "0-Settings-Ack\n" + "0-Ping-[0,0,0,0,0,0,0,1]\n" + getSimpleResponseTrace(1), output.getTrace());
         output.clearTrace();
     }
 
@@ -209,14 +203,12 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    protected void buildEmptyGetRequest(byte[] frameHeader, ByteBuffer headersPayload,
-            byte[] padding, int streamId) {
+    protected void buildEmptyGetRequest(byte[] frameHeader, ByteBuffer headersPayload, byte[] padding, int streamId) {
         buildGetRequest(frameHeader, headersPayload, padding, streamId, "/empty");
     }
 
 
-    protected void buildSimpleGetRequest(byte[] frameHeader, ByteBuffer headersPayload,
-            byte[] padding, int streamId) {
+    protected void buildSimpleGetRequest(byte[] frameHeader, ByteBuffer headersPayload, byte[] padding, int streamId) {
         buildGetRequest(frameHeader, headersPayload, padding, streamId, "/simple");
     }
 
@@ -226,8 +218,8 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    protected void buildGetRequest(byte[] frameHeader, ByteBuffer headersPayload, byte[] padding,
-            int streamId, String url) {
+    protected void buildGetRequest(byte[] frameHeader, ByteBuffer headersPayload, byte[] padding, int streamId,
+            String url) {
         List<Header> headers = new ArrayList<>(4);
         headers.add(new Header(":method", "GET"));
         headers.add(new Header(":scheme", "http"));
@@ -238,8 +230,8 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    protected void buildGetRequest(byte[] frameHeader, ByteBuffer headersPayload, byte[] padding,
-            List<Header> headers, int streamId) {
+    protected void buildGetRequest(byte[] frameHeader, ByteBuffer headersPayload, byte[] padding, List<Header> headers,
+            int streamId) {
         if (padding != null) {
             headersPayload.put((byte) (0xFF & padding.length));
         }
@@ -265,8 +257,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    protected void buildSimpleGetRequestPart1(byte[] frameHeader, ByteBuffer headersPayload,
-            int streamId) {
+    protected void buildSimpleGetRequestPart1(byte[] frameHeader, ByteBuffer headersPayload, int streamId) {
         List<Header> headers = new ArrayList<>(3);
         headers.add(new Header(":method", "GET"));
         headers.add(new Header(":scheme", "http"));
@@ -276,8 +267,8 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    protected void buildSimpleGetRequestPart1(byte[] frameHeader, ByteBuffer headersPayload,
-            List<Header> headers, int streamId) {
+    protected void buildSimpleGetRequestPart1(byte[] frameHeader, ByteBuffer headersPayload, List<Header> headers,
+            int streamId) {
         MimeHeaders mimeHeaders = new MimeHeaders();
         for (Header header : headers) {
             mimeHeaders.addValue(header.getName()).setString(header.getValue());
@@ -295,8 +286,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    protected void buildSimpleGetRequestPart2(byte[] frameHeader, ByteBuffer headersPayload,
-            int streamId) {
+    protected void buildSimpleGetRequestPart2(byte[] frameHeader, ByteBuffer headersPayload, int streamId) {
         List<Header> headers = new ArrayList<>(3);
         headers.add(new Header(":authority", "localhost:" + getPort()));
 
@@ -304,8 +294,8 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    protected void buildSimpleGetRequestPart2(byte[] frameHeader, ByteBuffer headersPayload,
-            List<Header> headers, int streamId) {
+    protected void buildSimpleGetRequestPart2(byte[] frameHeader, ByteBuffer headersPayload, List<Header> headers,
+            int streamId) {
         MimeHeaders mimeHeaders = new MimeHeaders();
         for (Header header : headers) {
             mimeHeaders.addValue(header.getName()).setString(header.getValue());
@@ -328,20 +318,19 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    protected void sendSimplePostRequest(int streamId, byte[] padding, boolean writeBody)
-            throws IOException {
+    protected void sendSimplePostRequest(int streamId, byte[] padding, boolean writeBody) throws IOException {
         sendSimplePostRequest(streamId, padding, writeBody, false);
     }
 
-    protected void sendSimplePostRequest(int streamId, byte[] padding, boolean writeBody,
-            boolean useExpectation) throws IOException {
+    protected void sendSimplePostRequest(int streamId, byte[] padding, boolean writeBody, boolean useExpectation)
+            throws IOException {
         byte[] headersFrameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
         byte[] dataFrameHeader = new byte[9];
         ByteBuffer dataPayload = ByteBuffer.allocate(128);
 
-        buildPostRequest(headersFrameHeader, headersPayload, useExpectation,
-                dataFrameHeader, dataPayload, padding, streamId);
+        buildPostRequest(headersFrameHeader, headersPayload, useExpectation, dataFrameHeader, dataPayload, padding,
+                streamId);
         writeFrame(headersFrameHeader, headersPayload);
         if (writeBody) {
             writeFrame(dataFrameHeader, dataPayload);
@@ -349,16 +338,15 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    protected void sendParameterPostRequest(int streamId, byte[] padding, String body,
-            long contentLength, boolean useExpectation) throws IOException {
+    protected void sendParameterPostRequest(int streamId, byte[] padding, String body, long contentLength,
+            boolean useExpectation) throws IOException {
         byte[] headersFrameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
         byte[] dataFrameHeader = new byte[9];
         ByteBuffer dataPayload = ByteBuffer.allocate(128);
 
-        buildPostRequest(headersFrameHeader, headersPayload, useExpectation,
-                "application/x-www-form-urlencoded", contentLength, "/parameter", dataFrameHeader,
-                dataPayload, padding, null, null, streamId);
+        buildPostRequest(headersFrameHeader, headersPayload, useExpectation, "application/x-www-form-urlencoded",
+                contentLength, "/parameter", dataFrameHeader, dataPayload, padding, null, null, streamId);
         writeFrame(headersFrameHeader, headersPayload);
         if (body != null) {
             dataPayload.put(body.getBytes(StandardCharsets.ISO_8859_1));
@@ -367,24 +355,22 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    protected void buildPostRequest(byte[] headersFrameHeader, ByteBuffer headersPayload,
-            boolean useExpectation, byte[] dataFrameHeader, ByteBuffer dataPayload, byte[] padding,
-            int streamId) {
-        buildPostRequest(headersFrameHeader, headersPayload, useExpectation, dataFrameHeader,
-                dataPayload, padding, null, null, streamId);
+    protected void buildPostRequest(byte[] headersFrameHeader, ByteBuffer headersPayload, boolean useExpectation,
+            byte[] dataFrameHeader, ByteBuffer dataPayload, byte[] padding, int streamId) {
+        buildPostRequest(headersFrameHeader, headersPayload, useExpectation, dataFrameHeader, dataPayload, padding,
+                null, null, streamId);
     }
 
-    protected void buildPostRequest(byte[] headersFrameHeader, ByteBuffer headersPayload,
-            boolean useExpectation, byte[] dataFrameHeader, ByteBuffer dataPayload, byte[] padding,
-            byte[] trailersFrameHeader, ByteBuffer trailersPayload, int streamId) {
-        buildPostRequest(headersFrameHeader, headersPayload, useExpectation, null, -1, "/simple",
-                dataFrameHeader, dataPayload, padding, trailersFrameHeader, trailersPayload, streamId);
+    protected void buildPostRequest(byte[] headersFrameHeader, ByteBuffer headersPayload, boolean useExpectation,
+            byte[] dataFrameHeader, ByteBuffer dataPayload, byte[] padding, byte[] trailersFrameHeader,
+            ByteBuffer trailersPayload, int streamId) {
+        buildPostRequest(headersFrameHeader, headersPayload, useExpectation, null, -1, "/simple", dataFrameHeader,
+                dataPayload, padding, trailersFrameHeader, trailersPayload, streamId);
     }
 
-    protected void buildPostRequest(byte[] headersFrameHeader, ByteBuffer headersPayload,
-            boolean useExpectation, String contentType, long contentLength, String path,
-            byte[] dataFrameHeader, ByteBuffer dataPayload, byte[] padding,
-            byte[] trailersFrameHeader, ByteBuffer trailersPayload, int streamId) {
+    protected void buildPostRequest(byte[] headersFrameHeader, ByteBuffer headersPayload, boolean useExpectation,
+            String contentType, long contentLength, String path, byte[] dataFrameHeader, ByteBuffer dataPayload,
+            byte[] padding, byte[] trailersFrameHeader, ByteBuffer trailersPayload, int streamId) {
 
         MimeHeaders headers = new MimeHeaders();
         headers.addValue(":method").setString("POST");
@@ -487,20 +473,17 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    protected void writeFrame(byte[] header, ByteBuffer payload)
-            throws IOException {
+    protected void writeFrame(byte[] header, ByteBuffer payload) throws IOException {
         writeFrame(header, payload, 0, payload.limit());
     }
 
 
-    protected void writeFrame(byte[] header, ByteBuffer payload, int offset, int len)
-            throws IOException {
+    protected void writeFrame(byte[] header, ByteBuffer payload, int offset, int len) throws IOException {
         writeFrame(header, payload, offset, len, 0);
     }
 
 
-    protected void writeFrame(byte[] header, ByteBuffer payload, int offset, int len, int delayms)
-            throws IOException {
+    protected void writeFrame(byte[] header, ByteBuffer payload, int offset, int len, int delayms) throws IOException {
         os.write(header);
         os.write(payload.array(), payload.arrayOffset() + offset, len);
         os.flush();
@@ -524,12 +507,10 @@ public abstract class Http2TestBase extends TomcatBaseTest {
 
     protected void readSimplePostResponse(boolean padding) throws Http2Exception, IOException {
         /*
-         * If there is padding there will always be a window update for the
-         * connection and, depending on timing, there may be an update for the
-         * stream. The Window updates for padding (if present) may appear at any
-         * time. The comments in the code below are only indicative of what the
-         * frames are likely to contain. Actual frame order with padding may be
-         * different.
+         * If there is padding there will always be a window update for the connection and, depending on timing, there
+         * may be an update for the stream. The Window updates for padding (if present) may appear at any time. The
+         * comments in the code below are only indicative of what the frames are likely to contain. Actual frame order
+         * with padding may be different.
          */
 
         // Connection window update after reading request body
@@ -576,8 +557,8 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    protected String getResponseBodyFrameTrace(int streamId, int status, String contentType,
-            String contentLanguage, String body, String cl) {
+    protected String getResponseBodyFrameTrace(int streamId, int status, String contentType, String contentLanguage,
+            String body, String cl) {
         StringBuilder result = new StringBuilder();
         result.append(streamId);
         result.append("-HeadersStart\n");
@@ -705,20 +686,16 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         doHttpUpgrade(DEFAULT_CONNECTION_HEADER_VALUE, "h2c", EMPTY_HTTP2_SETTINGS_HEADER, true);
     }
 
-    protected void doHttpUpgrade(String connection, String upgrade, String settings,
-            boolean validate) throws IOException {
-        byte[] upgradeRequest = ("GET /simple HTTP/1.1\r\n" +
-                "Host: localhost:" + getPort() + "\r\n" +
-                "Connection: "+ connection + "\r\n" +
-                "Upgrade: " + upgrade + "\r\n" +
-                settings +
-                "\r\n").getBytes(StandardCharsets.ISO_8859_1);
+    protected void doHttpUpgrade(String connection, String upgrade, String settings, boolean validate)
+            throws IOException {
+        byte[] upgradeRequest = ("GET /simple HTTP/1.1\r\n" + "Host: localhost:" + getPort() + "\r\n" + "Connection: " +
+                connection + "\r\n" + "Upgrade: " + upgrade + "\r\n" + settings + "\r\n")
+                .getBytes(StandardCharsets.ISO_8859_1);
         os.write(upgradeRequest);
         os.flush();
 
         if (validate) {
-            Assert.assertTrue("Failed to read HTTP Upgrade response",
-                    readHttpUpgradeResponse());
+            Assert.assertTrue("Failed to read HTTP Upgrade response", readHttpUpgradeResponse());
         }
     }
 
@@ -766,24 +743,24 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         while (seen < 4) {
             input.fill(true, singleByte);
             switch (seen) {
-            case 0:
-            case 2: {
-                if (singleByte[0] == '\r') {
-                    seen++;
-                } else {
-                    seen = 0;
+                case 0:
+                case 2: {
+                    if (singleByte[0] == '\r') {
+                        seen++;
+                    } else {
+                        seen = 0;
+                    }
+                    break;
                 }
-                break;
-            }
-            case 1:
-            case 3: {
-                if (singleByte[0] == '\n') {
-                    seen++;
-                } else {
-                    seen = 0;
+                case 1:
+                case 3: {
+                    if (singleByte[0] == '\n') {
+                        seen++;
+                    } else {
+                        seen = 0;
+                    }
+                    break;
                 }
-                break;
-            }
             }
             data.put(singleByte[0]);
         }
@@ -792,8 +769,8 @@ public abstract class Http2TestBase extends TomcatBaseTest {
             throw new IOException("End of headers not found");
         }
 
-        String response = new String(data.array(), data.arrayOffset(),
-                data.arrayOffset() + data.position(), StandardCharsets.ISO_8859_1);
+        String response = new String(data.array(), data.arrayOffset(), data.arrayOffset() + data.position(),
+                StandardCharsets.ISO_8859_1);
 
         return response.split("\r\n");
     }
@@ -994,13 +971,12 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    void handleGoAwayResponse(int lastStream, Http2Error expectedError)
-            throws Http2Exception, IOException {
+    void handleGoAwayResponse(int lastStream, Http2Error expectedError) throws Http2Exception, IOException {
         try {
             parser.readFrame();
 
-            Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
-                    "0-Goaway-[" + lastStream + "]-[" + expectedError.getCode() + "]-["));
+            Assert.assertTrue(output.getTrace(),
+                    output.getTrace().startsWith("0-Goaway-[" + lastStream + "]-[" + expectedError.getCode() + "]-["));
         } catch (SocketException se) {
             // On some platform / Connector combinations (e.g. Windows / NIO2),
             // the TCP connection close will be processed before the client gets
@@ -1011,8 +987,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
             Assume.assumeTrue("This test is only expected to trigger an exception with NIO2",
                     connector.getProtocolHandlerClassName().contains("Nio2"));
 
-            Assume.assumeTrue("This test is only expected to trigger an exception on Windows",
-                    JrePlatform.IS_WINDOWS);
+            Assume.assumeTrue("This test is only expected to trigger an exception on Windows", JrePlatform.IS_WINDOWS);
         }
     }
 
@@ -1132,8 +1107,8 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         @Override
         public void reprioritise(int streamId, int parentStreamId, boolean exclusive, int weight) {
             lastStreamId = Integer.toString(streamId);
-            trace.append(lastStreamId + "-Reprioritise-[" + parentStreamId + "]-[" + exclusive +
-                    "]-[" + weight + "]\n");
+            trace.append(
+                    lastStreamId + "-Reprioritise-[" + parentStreamId + "]-[" + exclusive + "]-[" + weight + "]\n");
         }
 
 
@@ -1201,7 +1176,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
                 trace.append("0-Settings-Ack\n");
             } else {
                 trace.append("0-Settings-End\n");
-                sendSettings(0,  true);
+                sendSettings(0, true);
             }
         }
 
@@ -1296,8 +1271,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             // Generate an empty response
             resp.setContentType("application/octet-stream");
             resp.setContentLength(0);
@@ -1311,8 +1285,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
         }
     }
@@ -1325,8 +1298,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         public static final int CONTENT_LENGTH = 8192;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             // Generate content with a simple known format.
             resp.setContentType("application/octet-stream");
 
@@ -1345,8 +1317,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
 
 
         @Override
-        protected void doPost(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             // Do not do this at home. The unconstrained buffer is a DoS risk.
 
             // Have to read into a buffer because clients typically do not start
@@ -1371,8 +1342,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             // Generate content with a simple known format that will exceed the
             // default flow control window for a stream.
             resp.setContentType("application/octet-stream");
@@ -1397,8 +1367,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             resp.setContentType("text/plain");
             resp.setCharacterEncoding("UTF-8");
             resp.getWriter().print("Cookie count: " + req.getCookies().length);
@@ -1412,8 +1381,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             resp.setContentType("text/plain");
             resp.setCharacterEncoding("UTF-8");
             StringBuilder headerValue = new StringBuilder();
@@ -1432,10 +1400,9 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doPost(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
 
-            Map<String,String[]> params = req.getParameterMap();
+            Map<String, String[]> params = req.getParameterMap();
 
             resp.setContentType("text/plain");
             resp.setCharacterEncoding("UTF-8");
@@ -1450,15 +1417,13 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             // Request bodies are unusual with GET but not illegal
             doPost(req, resp);
         }
 
         @Override
-        protected void doPost(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
 
             long total = 0;
             long read = 0;
diff --git a/test/org/apache/coyote/http2/TestAbstractStream.java b/test/org/apache/coyote/http2/TestAbstractStream.java
index ab58f3cd43..a09b7e80a3 100644
--- a/test/org/apache/coyote/http2/TestAbstractStream.java
+++ b/test/org/apache/coyote/http2/TestAbstractStream.java
@@ -42,8 +42,8 @@ public class TestAbstractStream {
     @Test
     public void testDependenciesFig3() {
         // Setup
-        Http2UpgradeHandler handler =
-                new Http2UpgradeHandler(new Http2Protocol(), null, null, new TesterSocketWrapper());
+        Http2UpgradeHandler handler = new Http2UpgradeHandler(new Http2Protocol(), null, null,
+                new TesterSocketWrapper());
         Stream a = new Stream(Integer.valueOf(1), handler);
         Stream b = new Stream(Integer.valueOf(2), handler);
         Stream c = new Stream(Integer.valueOf(3), handler);
@@ -61,21 +61,21 @@ public class TestAbstractStream {
         Assert.assertEquals(a, d.getParentStream());
 
         // Check children
-        Assert.assertEquals(3,  a.getChildStreams().size());
+        Assert.assertEquals(3, a.getChildStreams().size());
         Assert.assertTrue(a.getChildStreams().contains(b));
         Assert.assertTrue(a.getChildStreams().contains(c));
         Assert.assertTrue(a.getChildStreams().contains(d));
-        Assert.assertEquals(0,  b.getChildStreams().size());
-        Assert.assertEquals(0,  c.getChildStreams().size());
-        Assert.assertEquals(0,  d.getChildStreams().size());
+        Assert.assertEquals(0, b.getChildStreams().size());
+        Assert.assertEquals(0, c.getChildStreams().size());
+        Assert.assertEquals(0, d.getChildStreams().size());
     }
 
 
     @Test
     public void testDependenciesFig4() {
         // Setup
-        Http2UpgradeHandler handler =
-                new Http2UpgradeHandler(new Http2Protocol(), null, null, new TesterSocketWrapper());
+        Http2UpgradeHandler handler = new Http2UpgradeHandler(new Http2Protocol(), null, null,
+                new TesterSocketWrapper());
         Stream a = new Stream(Integer.valueOf(1), handler);
         Stream b = new Stream(Integer.valueOf(2), handler);
         Stream c = new Stream(Integer.valueOf(3), handler);
@@ -93,21 +93,21 @@ public class TestAbstractStream {
         Assert.assertEquals(a, d.getParentStream());
 
         // Check children
-        Assert.assertEquals(1,  a.getChildStreams().size());
+        Assert.assertEquals(1, a.getChildStreams().size());
         Assert.assertTrue(a.getChildStreams().contains(d));
-        Assert.assertEquals(2,  d.getChildStreams().size());
+        Assert.assertEquals(2, d.getChildStreams().size());
         Assert.assertTrue(d.getChildStreams().contains(b));
         Assert.assertTrue(d.getChildStreams().contains(c));
-        Assert.assertEquals(0,  b.getChildStreams().size());
-        Assert.assertEquals(0,  c.getChildStreams().size());
+        Assert.assertEquals(0, b.getChildStreams().size());
+        Assert.assertEquals(0, c.getChildStreams().size());
     }
 
 
     @Test
     public void testDependenciesFig5NonExclusive() {
         // Setup
-        Http2UpgradeHandler handler =
-                new Http2UpgradeHandler(new Http2Protocol(), null, null, new TesterSocketWrapper());
+        Http2UpgradeHandler handler = new Http2UpgradeHandler(new Http2Protocol(), null, null,
+                new TesterSocketWrapper());
         Stream a = new Stream(Integer.valueOf(1), handler);
         Stream b = new Stream(Integer.valueOf(2), handler);
         Stream c = new Stream(Integer.valueOf(3), handler);
@@ -132,25 +132,25 @@ public class TestAbstractStream {
         Assert.assertEquals(c, e.getParentStream());
 
         // Check children
-        Assert.assertEquals(2,  d.getChildStreams().size());
+        Assert.assertEquals(2, d.getChildStreams().size());
         Assert.assertTrue(d.getChildStreams().contains(a));
         Assert.assertTrue(d.getChildStreams().contains(f));
-        Assert.assertEquals(0,  f.getChildStreams().size());
-        Assert.assertEquals(2,  a.getChildStreams().size());
+        Assert.assertEquals(0, f.getChildStreams().size());
+        Assert.assertEquals(2, a.getChildStreams().size());
         Assert.assertTrue(a.getChildStreams().contains(b));
         Assert.assertTrue(a.getChildStreams().contains(c));
-        Assert.assertEquals(0,  b.getChildStreams().size());
-        Assert.assertEquals(1,  c.getChildStreams().size());
+        Assert.assertEquals(0, b.getChildStreams().size());
+        Assert.assertEquals(1, c.getChildStreams().size());
         Assert.assertTrue(c.getChildStreams().contains(e));
-        Assert.assertEquals(0,  e.getChildStreams().size());
+        Assert.assertEquals(0, e.getChildStreams().size());
     }
 
 
     @Test
     public void testDependenciesFig5Exclusive() {
         // Setup
-        Http2UpgradeHandler handler =
-                new Http2UpgradeHandler(new Http2Protocol(), null, null, new TesterSocketWrapper());
+        Http2UpgradeHandler handler = new Http2UpgradeHandler(new Http2Protocol(), null, null,
+                new TesterSocketWrapper());
         Stream a = new Stream(Integer.valueOf(1), handler);
         Stream b = new Stream(Integer.valueOf(2), handler);
         Stream c = new Stream(Integer.valueOf(3), handler);
@@ -175,25 +175,25 @@ public class TestAbstractStream {
         Assert.assertEquals(c, e.getParentStream());
 
         // Check children
-        Assert.assertEquals(1,  d.getChildStreams().size());
+        Assert.assertEquals(1, d.getChildStreams().size());
         Assert.assertTrue(d.getChildStreams().contains(a));
-        Assert.assertEquals(3,  a.getChildStreams().size());
+        Assert.assertEquals(3, a.getChildStreams().size());
         Assert.assertTrue(a.getChildStreams().contains(b));
         Assert.assertTrue(a.getChildStreams().contains(c));
         Assert.assertTrue(a.getChildStreams().contains(f));
-        Assert.assertEquals(0,  b.getChildStreams().size());
-        Assert.assertEquals(0,  f.getChildStreams().size());
-        Assert.assertEquals(1,  c.getChildStreams().size());
+        Assert.assertEquals(0, b.getChildStreams().size());
+        Assert.assertEquals(0, f.getChildStreams().size());
+        Assert.assertEquals(1, c.getChildStreams().size());
         Assert.assertTrue(c.getChildStreams().contains(e));
-        Assert.assertEquals(0,  e.getChildStreams().size());
+        Assert.assertEquals(0, e.getChildStreams().size());
     }
 
 
     @Test
     public void testCircular01() {
         // Setup
-        Http2UpgradeHandler handler =
-                new Http2UpgradeHandler(new Http2Protocol(), null, null, new TesterSocketWrapper());
+        Http2UpgradeHandler handler = new Http2UpgradeHandler(new Http2Protocol(), null, null,
+                new TesterSocketWrapper());
         Stream a = new Stream(Integer.valueOf(1), handler);
         Stream b = new Stream(Integer.valueOf(2), handler);
         Stream c = new Stream(Integer.valueOf(3), handler);
@@ -210,12 +210,12 @@ public class TestAbstractStream {
         Assert.assertEquals(handler, c.getParentStream());
 
         // Check children
-        Assert.assertEquals(1,  handler.getChildStreams().size());
+        Assert.assertEquals(1, handler.getChildStreams().size());
         Assert.assertTrue(handler.getChildStreams().contains(c));
-        Assert.assertEquals(1,  a.getChildStreams().size());
+        Assert.assertEquals(1, a.getChildStreams().size());
         Assert.assertTrue(a.getChildStreams().contains(b));
-        Assert.assertEquals(0,  b.getChildStreams().size());
-        Assert.assertEquals(1,  c.getChildStreams().size());
+        Assert.assertEquals(0, b.getChildStreams().size());
+        Assert.assertEquals(1, c.getChildStreams().size());
         Assert.assertTrue(c.getChildStreams().contains(a));
     }
 
@@ -223,8 +223,8 @@ public class TestAbstractStream {
     @Test
     public void testCircular02() {
         // Setup
-        Http2UpgradeHandler handler =
-                new Http2UpgradeHandler(new Http2Protocol(), null, null, new TesterSocketWrapper());
+        Http2UpgradeHandler handler = new Http2UpgradeHandler(new Http2Protocol(), null, null,
+                new TesterSocketWrapper());
         Stream a = new Stream(Integer.valueOf(1), handler);
         Stream b = new Stream(Integer.valueOf(2), handler);
         Stream c = new Stream(Integer.valueOf(3), handler);
@@ -250,18 +250,18 @@ public class TestAbstractStream {
         Assert.assertEquals(e, f.getParentStream());
 
         // Check children
-        Assert.assertEquals(1,  handler.getChildStreams().size());
+        Assert.assertEquals(1, handler.getChildStreams().size());
         Assert.assertTrue(handler.getChildStreams().contains(c));
-        Assert.assertEquals(1,  a.getChildStreams().size());
+        Assert.assertEquals(1, a.getChildStreams().size());
         Assert.assertTrue(a.getChildStreams().contains(b));
-        Assert.assertEquals(0,  b.getChildStreams().size());
-        Assert.assertEquals(1,  c.getChildStreams().size());
+        Assert.assertEquals(0, b.getChildStreams().size());
+        Assert.assertEquals(1, c.getChildStreams().size());
         Assert.assertTrue(c.getChildStreams().contains(d));
-        Assert.assertEquals(1,  d.getChildStreams().size());
+        Assert.assertEquals(1, d.getChildStreams().size());
         Assert.assertTrue(d.getChildStreams().contains(e));
-        Assert.assertEquals(1,  e.getChildStreams().size());
+        Assert.assertEquals(1, e.getChildStreams().size());
         Assert.assertTrue(e.getChildStreams().contains(f));
-        Assert.assertEquals(1,  f.getChildStreams().size());
+        Assert.assertEquals(1, f.getChildStreams().size());
         Assert.assertTrue(f.getChildStreams().contains(a));
     }
 
@@ -270,8 +270,8 @@ public class TestAbstractStream {
     @Test
     public void testCircular03() {
         // Setup
-        Http2UpgradeHandler handler =
-                new Http2UpgradeHandler(new Http2Protocol(), null, null, new TesterSocketWrapper());
+        Http2UpgradeHandler handler = new Http2UpgradeHandler(new Http2Protocol(), null, null,
+                new TesterSocketWrapper());
         Stream a = new Stream(Integer.valueOf(1), handler);
         Stream b = new Stream(Integer.valueOf(3), handler);
         Stream c = new Stream(Integer.valueOf(5), handler);
@@ -294,15 +294,15 @@ public class TestAbstractStream {
         Assert.assertTrue(c.isDescendant(d));
 
         // Check children
-        Assert.assertEquals(1,  handler.getChildStreams().size());
+        Assert.assertEquals(1, handler.getChildStreams().size());
         Assert.assertTrue(handler.getChildStreams().contains(c));
-        Assert.assertEquals(1,  c.getChildStreams().size());
+        Assert.assertEquals(1, c.getChildStreams().size());
         Assert.assertTrue(c.getChildStreams().contains(a));
-        Assert.assertEquals(1,  a.getChildStreams().size());
+        Assert.assertEquals(1, a.getChildStreams().size());
         Assert.assertTrue(a.getChildStreams().contains(b));
-        Assert.assertEquals(1,  b.getChildStreams().size());
+        Assert.assertEquals(1, b.getChildStreams().size());
         Assert.assertTrue(b.getChildStreams().contains(d));
-        Assert.assertEquals(0,  d.getChildStreams().size());
+        Assert.assertEquals(0, d.getChildStreams().size());
     }
 
 
@@ -396,10 +396,9 @@ public class TestAbstractStream {
         }
 
         @Override
-        protected <A> SocketWrapperBase<NioChannel>.OperationState<A> newOperationState(
-                boolean read, ByteBuffer[] buffers, int offset, int length, BlockingMode block,
-                long timeout, TimeUnit unit, A attachment, CompletionCheck check,
-                CompletionHandler<Long, ? super A> handler, Semaphore semaphore,
+        protected <A> SocketWrapperBase<NioChannel>.OperationState<A> newOperationState(boolean read,
+                ByteBuffer[] buffers, int offset, int length, BlockingMode block, long timeout, TimeUnit unit,
+                A attachment, CompletionCheck check, CompletionHandler<Long, ? super A> handler, Semaphore semaphore,
                 SocketWrapperBase<NioChannel>.VectoredIOCompletionHandler<A> completion) {
             return null;
         }
diff --git a/test/org/apache/coyote/http2/TestAsync.java b/test/org/apache/coyote/http2/TestAsync.java
index 1d497bf09b..43a2506a62 100644
--- a/test/org/apache/coyote/http2/TestAsync.java
+++ b/test/org/apache/coyote/http2/TestAsync.java
@@ -68,11 +68,9 @@ public class TestAsync extends Http2TestBase {
                     for (Boolean streamUnlimited : booleans) {
                         for (Boolean useNonContainerThreadForWrite : booleans) {
                             for (Boolean largeInitialWindow : booleans) {
-                                parameterSets.add(new Object[] {
-                                        base[0], base[1],
-                                        expandConnectionFirst, connectionUnlimited, streamUnlimited,
-                                        useNonContainerThreadForWrite, largeInitialWindow
-                                });
+                                parameterSets.add(
+                                        new Object[] { base[0], base[1], expandConnectionFirst, connectionUnlimited,
+                                                streamUnlimited, useNonContainerThreadForWrite, largeInitialWindow });
                             }
                         }
                     }
@@ -110,8 +108,7 @@ public class TestAsync extends Http2TestBase {
         Context ctxt = tomcat.addContext("", null);
         Tomcat.addServlet(ctxt, "simple", new SimpleServlet());
         ctxt.addServletMappingDecoded("/simple", "simple");
-        Wrapper w = Tomcat.addServlet(ctxt, "async",
-                new AsyncServlet(blockCount, useNonContainerThreadForWrite));
+        Wrapper w = Tomcat.addServlet(ctxt, "async", new AsyncServlet(blockCount, useNonContainerThreadForWrite));
         w.setAsyncSupported(true);
         ctxt.addServletMappingDecoded("/async", "async");
         tomcat.start();
@@ -128,8 +125,7 @@ public class TestAsync extends Http2TestBase {
 
         if (largeInitialWindow) {
             startingWindowSize = ((1 << 17) - 1);
-            SettingValue sv =
-                    new SettingValue(Setting.INITIAL_WINDOW_SIZE.getId(), startingWindowSize);
+            SettingValue sv = new SettingValue(Setting.INITIAL_WINDOW_SIZE.getId(), startingWindowSize);
             sendSettings(0, false, sv);
             // Test code assumes connection window and stream window size are the same at the start
             sendWindowUpdate(0, startingWindowSize - ConnectionSettingsBase.DEFAULT_INITIAL_WINDOW_SIZE);
@@ -217,8 +213,7 @@ public class TestAsync extends Http2TestBase {
          * Not thread-safe. OK for this test. NOt OK for use in the real world.
          */
         @Override
-        protected void doGet(HttpServletRequest request, HttpServletResponse response)
-                throws IOException {
+        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
 
             final AsyncContext asyncContext = request.startAsync();
 
@@ -259,7 +254,7 @@ public class TestAsync extends Http2TestBase {
                     while (output.isReady()) {
                         blockCount.incrementAndGet();
                         output.write(bytes);
-                        if (blockCount.get()  == blockLimit) {
+                        if (blockCount.get() == blockLimit) {
                             asyncContext.complete();
                             scheduler.shutdown();
                             return;
diff --git a/test/org/apache/coyote/http2/TestAsyncFlush.java b/test/org/apache/coyote/http2/TestAsyncFlush.java
index 4c548e4926..26db69beba 100644
--- a/test/org/apache/coyote/http2/TestAsyncFlush.java
+++ b/test/org/apache/coyote/http2/TestAsyncFlush.java
@@ -88,7 +88,7 @@ public class TestAsyncFlush extends Http2TestBase {
         parser.readFrame();
         // Body
 
-        while (output.getBytesRead() < targetSize ) {
+        while (output.getBytesRead() < targetSize) {
             if (output.getBytesRead() == totalWindow) {
                 sendWindowUpdate(3, ConnectionSettingsBase.DEFAULT_INITIAL_WINDOW_SIZE);
                 sendWindowUpdate(0, ConnectionSettingsBase.DEFAULT_INITIAL_WINDOW_SIZE);
@@ -113,8 +113,7 @@ public class TestAsyncFlush extends Http2TestBase {
         }
 
         @Override
-        protected void doGet(HttpServletRequest request, HttpServletResponse response)
-                throws IOException {
+        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
 
             final AsyncContext asyncContext = request.startAsync();
 
diff --git a/test/org/apache/coyote/http2/TestAsyncTimeout.java b/test/org/apache/coyote/http2/TestAsyncTimeout.java
index 8066840924..191a00b1e5 100644
--- a/test/org/apache/coyote/http2/TestAsyncTimeout.java
+++ b/test/org/apache/coyote/http2/TestAsyncTimeout.java
@@ -102,8 +102,7 @@ public class TestAsyncTimeout extends Http2TestBase {
         }
 
         @Override
-        protected void doGet(HttpServletRequest request, HttpServletResponse response)
-                throws IOException {
+        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
 
             // The idea of this test is that the timeout kicks in after 2
             // seconds and stops the async thread early rather than letting it
diff --git a/test/org/apache/coyote/http2/TestCancelledUpload.java b/test/org/apache/coyote/http2/TestCancelledUpload.java
index 2407f1f512..fbe1725c04 100644
--- a/test/org/apache/coyote/http2/TestCancelledUpload.java
+++ b/test/org/apache/coyote/http2/TestCancelledUpload.java
@@ -42,7 +42,8 @@ public class TestCancelledUpload extends Http2TestBase {
 
         LogManager.getLogManager().getLogger("org.apache.coyote.http2").setLevel(Level.ALL);
         try {
-            ((AbstractHttp11Protocol<?>) http2Protocol.getHttp11Protocol()).setAllowedTrailerHeaders(TRAILER_HEADER_NAME);
+            ((AbstractHttp11Protocol<?>) http2Protocol.getHttp11Protocol())
+                    .setAllowedTrailerHeaders(TRAILER_HEADER_NAME);
 
             int bodySize = 8192;
             int bodyCount = 20;
@@ -54,8 +55,8 @@ public class TestCancelledUpload extends Http2TestBase {
             byte[] trailerFrameHeader = new byte[9];
             ByteBuffer trailerPayload = ByteBuffer.allocate(256);
 
-            buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader, dataPayload,
-                    null, trailerFrameHeader, trailerPayload, 3);
+            buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader, dataPayload, null,
+                    trailerFrameHeader, trailerPayload, 3);
 
             // Write the headers
             writeFrame(headersFrameHeader, headersPayload);
@@ -71,7 +72,7 @@ public class TestCancelledUpload extends Http2TestBase {
             // incoming frames.
             // The request processing thread will:
             // - read up to 128 bytes of request body
-            //   (and issue a window update for bytes read)
+            // (and issue a window update for bytes read)
             // - write a 403 response with no response body
             // The connection processing thread will:
             // - read the request body until the flow control window is exhausted
@@ -84,12 +85,8 @@ public class TestCancelledUpload extends Http2TestBase {
             }
 
             // Not window update, not reset, must be the headers
-            Assert.assertEquals("3-HeadersStart\n" +
-                    "3-Header-[:status]-[403]\n" +
-                    "3-Header-[content-length]-[0]\n" +
-                    "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                    "3-HeadersEnd\n",
-                    output.getTrace());
+            Assert.assertEquals("3-HeadersStart\n" + "3-Header-[:status]-[403]\n" + "3-Header-[content-length]-[0]\n" +
+                    "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "3-HeadersEnd\n", output.getTrace());
             output.clearTrace();
             parser.readFrame();
 
@@ -99,9 +96,7 @@ public class TestCancelledUpload extends Http2TestBase {
             }
 
             // Not window update, not reset, must be the response body
-            Assert.assertEquals("3-Body-0\n" +
-                    "3-EndOfStream\n",
-                    output.getTrace());
+            Assert.assertEquals("3-Body-0\n" + "3-EndOfStream\n", output.getTrace());
             output.clearTrace();
             parser.readFrame();
 
@@ -117,11 +112,9 @@ public class TestCancelledUpload extends Http2TestBase {
     /*
      * Looking for a RST frame with error type 3 (flow control error).
      *
-     * If there is a flow control window update for stream 0 it may be followed
-     * by one for stream 3.
+     * If there is a flow control window update for stream 0 it may be followed by one for stream 3.
      *
-     * If there is a flow control window update for stream 3 it will always be
-     * preceded by one for stream 0.
+     * If there is a flow control window update for stream 3 it will always be preceded by one for stream 0.
      */
     private boolean checkReset() throws IOException, Http2Exception {
         int lastConnectionFlowControlWindowUpdate = -1;
diff --git a/test/org/apache/coyote/http2/TestFlowControl.java b/test/org/apache/coyote/http2/TestFlowControl.java
index 8d45ce86d7..2450ffb781 100644
--- a/test/org/apache/coyote/http2/TestFlowControl.java
+++ b/test/org/apache/coyote/http2/TestFlowControl.java
@@ -99,17 +99,11 @@ public class TestFlowControl extends Http2TestBase {
             // Language will depend on locale
             String language = sm.getLocale().toLanguageTag();
 
-            Assert.assertEquals(
-                    "3-HeadersStart\n" +
-                    "3-Header-[:status]-[404]\n" +
-                    "3-Header-[content-type]-[text/html;charset=utf-8]\n" +
-                    "3-Header-[content-language]-[" + language + "]\n" +
-                    "3-Header-[content-length]-[" + contentLength + "]\n" +
-                    "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                    "3-HeadersEnd\n" +
-                    "3-Body-" + contentLength + "\n" +
-                    "3-EndOfStream\n" +
-                    "3-RST-[0]\n", output.getTrace());
+            Assert.assertEquals("3-HeadersStart\n" + "3-Header-[:status]-[404]\n" +
+                    "3-Header-[content-type]-[text/html;charset=utf-8]\n" + "3-Header-[content-language]-[" + language +
+                    "]\n" + "3-Header-[content-length]-[" + contentLength + "]\n" +
+                    "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "3-HeadersEnd\n" + "3-Body-" + contentLength +
+                    "\n" + "3-EndOfStream\n" + "3-RST-[0]\n", output.getTrace());
             output.clearTrace();
 
             // Write 3*16k=48k of request body
@@ -132,8 +126,8 @@ public class TestFlowControl extends Http2TestBase {
 
 
     /*
-     * This might be unnecessary but given the potential for timing differences
-     * across different systems a more robust approach seems prudent.
+     * This might be unnecessary but given the potential for timing differences across different systems a more robust
+     * approach seems prudent.
      */
     private void waitForWindowSize(int streamId) throws Http2Exception, IOException {
         String prefix = streamId + "-WindowSize-";
diff --git a/test/org/apache/coyote/http2/TestHpack.java b/test/org/apache/coyote/http2/TestHpack.java
index 991855417a..0d88ed112c 100644
--- a/test/org/apache/coyote/http2/TestHpack.java
+++ b/test/org/apache/coyote/http2/TestHpack.java
@@ -72,17 +72,21 @@ public class TestHpack {
 
     private static class HeadersListener implements HpackDecoder.HeaderEmitter {
         private final MimeHeaders headers;
+
         HeadersListener(MimeHeaders headers) {
             this.headers = headers;
         }
+
         @Override
         public void emitHeader(String name, String value) {
             headers.setValue(name).setString(value);
         }
+
         @Override
         public void setHeaderException(StreamException streamException) {
             // NO-OP
         }
+
         @Override
         public void validateHeaders() throws StreamException {
             // NO-OP
@@ -100,7 +104,7 @@ public class TestHpack {
             // Skip the control characters except VTAB
             if (i == 9 || i > 31 && i < 127 || i > 127) {
                 try {
-                    doTestHeaderValueBug60451("foo" + Character.toString((char) i)  + "bar");
+                    doTestHeaderValueBug60451("foo" + Character.toString((char) i) + "bar");
                 } catch (Exception e) {
                     e.printStackTrace();
                     Assert.fail(e.getMessage() + "[" + i + "]");
@@ -109,7 +113,7 @@ public class TestHpack {
         }
     }
 
-    @Test(expected=HpackException.class)
+    @Test(expected = HpackException.class)
     public void testExcessiveStringLiteralPadding() throws Exception {
         MimeHeaders headers = new MimeHeaders();
         headers.setValue("X-test").setString("foobar");
diff --git a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
index c11e954121..af62757ee9 100644
--- a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
+++ b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
@@ -67,8 +67,8 @@ public class TestHttp2InitialConnection extends Http2TestBase {
 
 
     @Override
-    protected void doHttpUpgrade(String connection, String upgrade, String settings,
-            boolean validate) throws IOException {
+    protected void doHttpUpgrade(String connection, String upgrade, String settings, boolean validate)
+            throws IOException {
         StringBuilder request = new StringBuilder();
         request.append("GET /simple HTTP/1.1\r\n");
         for (String hostHeader : testData.getHostHeaders()) {
@@ -98,8 +98,7 @@ public class TestHttp2InitialConnection extends Http2TestBase {
         os.flush();
 
         if (validate) {
-            Assert.assertTrue("Failed to read HTTP Upgrade response",
-                    readHttpUpgradeResponse());
+            Assert.assertTrue("Failed to read HTTP Upgrade response", readHttpUpgradeResponse());
         }
     }
 
@@ -110,42 +109,33 @@ public class TestHttp2InitialConnection extends Http2TestBase {
             return super.getResponseBodyFrameTrace(streamId, body);
         } else if (testData.getExpectedStatus() == 400) {
             /*
-             * Need to be careful here. The test wants the exact content length
-             * in bytes.
-             * This will vary depending on where the test is run due to:
-             * - The length of the version string that appears once in the error
-             *   page
-             * - The status header uses a UTF-8 EN dash. When running in an IDE
-             *   the UTF-8 properties files will be used directly rather than
-             *   after native2ascii conversion.
+             * Need to be careful here. The test wants the exact content length in bytes. This will vary depending on
+             * where the test is run due to: - The length of the version string that appears once in the error page -
+             * The status header uses a UTF-8 EN dash. When running in an IDE the UTF-8 properties files will be used
+             * directly rather than after native2ascii conversion.
              *
              * Note: The status header appears twice in the error page.
              */
             int serverInfoLength = ServerInfo.getServerInfo().getBytes().length;
-            StringManager sm = StringManager.getManager(
-                    ErrorReportValve.class.getPackage().getName(), Locale.ENGLISH);
+            StringManager sm = StringManager.getManager(ErrorReportValve.class.getPackage().getName(), Locale.ENGLISH);
             String reason = sm.getString("http." + testData.getExpectedStatus() + ".reason");
             int descriptionLength = sm.getString("http." + testData.getExpectedStatus() + ".desc")
                     .getBytes(StandardCharsets.UTF_8).length;
             int statusHeaderLength = sm
-                    .getString("errorReportValve.statusHeader",
-                            String.valueOf(testData.getExpectedStatus()), reason)
-                    .getBytes(StandardCharsets.UTF_8).length;
-            int typeLabelLength = sm.getString("errorReportValve.type")
+                    .getString("errorReportValve.statusHeader", String.valueOf(testData.getExpectedStatus()), reason)
                     .getBytes(StandardCharsets.UTF_8).length;
+            int typeLabelLength = sm.getString("errorReportValve.type").getBytes(StandardCharsets.UTF_8).length;
             int statusReportLabelLength = sm.getString("errorReportValve.statusReport")
                     .getBytes(StandardCharsets.UTF_8).length;
             int descriptionLabelLength = sm.getString("errorReportValve.description")
                     .getBytes(StandardCharsets.UTF_8).length;
             // 196 bytes is the static length of the pure HTML code from the ErrorReportValve
-            int len = 196 + org.apache.catalina.util.TomcatCSS.TOMCAT_CSS
-                    .getBytes(StandardCharsets.UTF_8).length +
-                    typeLabelLength + statusReportLabelLength + descriptionLabelLength +
-                    descriptionLength + serverInfoLength + statusHeaderLength * 2;
+            int len = 196 + org.apache.catalina.util.TomcatCSS.TOMCAT_CSS.getBytes(StandardCharsets.UTF_8).length +
+                    typeLabelLength + statusReportLabelLength + descriptionLabelLength + descriptionLength +
+                    serverInfoLength + statusHeaderLength * 2;
             String contentLength = String.valueOf(len);
-            return getResponseBodyFrameTrace(streamId,
-                    testData.getExpectedStatus(), "text/html;charset=utf-8",
-                    "en", contentLength, contentLength);
+            return getResponseBodyFrameTrace(streamId, testData.getExpectedStatus(), "text/html;charset=utf-8", "en",
+                    contentLength, contentLength);
         } else {
             Assert.fail();
             // To keep the IDE happy
diff --git a/test/org/apache/coyote/http2/TestHttp2Limits.java b/test/org/apache/coyote/http2/TestHttp2Limits.java
index 1bf08bc1aa..b3214eb012 100644
--- a/test/org/apache/coyote/http2/TestHttp2Limits.java
+++ b/test/org/apache/coyote/http2/TestHttp2Limits.java
@@ -43,8 +43,7 @@ public class TestHttp2Limits extends Http2TestBase {
     @Test
     public void testSettingsOverheadLimits() throws Exception {
         http2Connect();
-        String errMsg = sm.getString("upgradeHandler.tooMuchOverhead", "\\p{XDigit}++")
-            .replace("[", "\\[");
+        String errMsg = sm.getString("upgradeHandler.tooMuchOverhead", "\\p{XDigit}++").replace("[", "\\[");
         String overHeadMsgRegx = "0-Goaway-\\[1]-\\[11]-\\[" + errMsg + "]";
 
         for (int i = 0; i < 100; i++) {
@@ -100,8 +99,7 @@ public class TestHttp2Limits extends Http2TestBase {
     @Test
     public void testHeaderLimits20x32WithLimit10() throws Exception {
         // Check lower count limit is enforced
-        doTestHeaderLimits(20, 32, -1, 10, Constants.DEFAULT_MAX_HEADER_SIZE, 0,
-                FailureMode.STREAM_RESET);
+        doTestHeaderLimits(20, 32, -1, 10, Constants.DEFAULT_MAX_HEADER_SIZE, 0, FailureMode.STREAM_RESET);
     }
 
 
@@ -123,29 +121,28 @@ public class TestHttp2Limits extends Http2TestBase {
     @Test
     public void testHeaderLimits3x1024WithLimit2048() throws Exception {
         // Check lower size limit is enforced
-        doTestHeaderLimits(3, 1024, -1, Constants.DEFAULT_MAX_HEADER_COUNT, 2 * 1024, 0,
-                FailureMode.STREAM_RESET);
+        doTestHeaderLimits(3, 1024, -1, Constants.DEFAULT_MAX_HEADER_COUNT, 2 * 1024, 0, FailureMode.STREAM_RESET);
     }
 
 
     @Test
     public void testHeaderLimits1x12k() throws Exception {
         // Bug 60232
-        doTestHeaderLimits(1, 12*1024, FailureMode.STREAM_RESET);
+        doTestHeaderLimits(1, 12 * 1024, FailureMode.STREAM_RESET);
     }
 
 
     @Test
     public void testHeaderLimits1x12kin1kChunks() throws Exception {
         // Bug 60232
-        doTestHeaderLimits(1, 12*1024, 1024, FailureMode.STREAM_RESET);
+        doTestHeaderLimits(1, 12 * 1024, 1024, FailureMode.STREAM_RESET);
     }
 
 
     @Test
     public void testHeaderLimits1x12kin1kChunksThenNewRequest() throws Exception {
         // Bug 60232
-        doTestHeaderLimits(1, 12*1024, 1024, FailureMode.STREAM_RESET);
+        doTestHeaderLimits(1, 12 * 1024, 1024, FailureMode.STREAM_RESET);
 
         output.clearTrace();
         sendSimpleGetRequest(5);
@@ -158,7 +155,7 @@ public class TestHttp2Limits extends Http2TestBase {
     @Test
     public void testHeaderLimits1x32k() throws Exception {
         // Bug 60232
-        doTestHeaderLimits(1, 32*1024, FailureMode.CONNECTION_RESET);
+        doTestHeaderLimits(1, 32 * 1024, FailureMode.CONNECTION_RESET);
     }
 
 
@@ -168,54 +165,51 @@ public class TestHttp2Limits extends Http2TestBase {
         // 500ms per frame write delay to give server a chance to process the
         // stream reset and the connection reset before the request is fully
         // sent.
-        doTestHeaderLimits(1, 32*1024, 1024, 500, FailureMode.CONNECTION_RESET);
+        doTestHeaderLimits(1, 32 * 1024, 1024, 500, FailureMode.CONNECTION_RESET);
     }
 
 
     @Test
     public void testHeaderLimits1x128k() throws Exception {
         // Bug 60232
-        doTestHeaderLimits(1, 128*1024, FailureMode.CONNECTION_RESET);
+        doTestHeaderLimits(1, 128 * 1024, FailureMode.CONNECTION_RESET);
     }
 
 
     @Test
     public void testHeaderLimits1x512k() throws Exception {
         // Bug 60232
-        doTestHeaderLimits(1, 512*1024, FailureMode.CONNECTION_RESET);
+        doTestHeaderLimits(1, 512 * 1024, FailureMode.CONNECTION_RESET);
     }
 
 
     @Test
     public void testHeaderLimits10x512k() throws Exception {
         // Bug 60232
-        doTestHeaderLimits(10, 512*1024, FailureMode.CONNECTION_RESET);
+        doTestHeaderLimits(10, 512 * 1024, FailureMode.CONNECTION_RESET);
     }
 
 
-    private void doTestHeaderLimits(int headerCount, int headerSize, FailureMode failMode)
-            throws Exception {
+    private void doTestHeaderLimits(int headerCount, int headerSize, FailureMode failMode) throws Exception {
         doTestHeaderLimits(headerCount, headerSize, -1, failMode);
     }
 
 
-    private void doTestHeaderLimits(int headerCount, int headerSize, int maxHeaderPayloadSize,
-            FailureMode failMode) throws Exception {
+    private void doTestHeaderLimits(int headerCount, int headerSize, int maxHeaderPayloadSize, FailureMode failMode)
+            throws Exception {
         doTestHeaderLimits(headerCount, headerSize, maxHeaderPayloadSize, 0, failMode);
     }
 
 
-    private void doTestHeaderLimits(int headerCount, int headerSize, int maxHeaderPayloadSize,
-            int delayms, FailureMode failMode) throws Exception {
-        doTestHeaderLimits(headerCount, headerSize, maxHeaderPayloadSize,
-                Constants.DEFAULT_MAX_HEADER_COUNT, Constants.DEFAULT_MAX_HEADER_SIZE, delayms,
-                failMode);
+    private void doTestHeaderLimits(int headerCount, int headerSize, int maxHeaderPayloadSize, int delayms,
+            FailureMode failMode) throws Exception {
+        doTestHeaderLimits(headerCount, headerSize, maxHeaderPayloadSize, Constants.DEFAULT_MAX_HEADER_COUNT,
+                Constants.DEFAULT_MAX_HEADER_SIZE, delayms, failMode);
     }
 
 
-    private void doTestHeaderLimits(int headerCount, int headerSize, int maxHeaderPayloadSize,
-            int maxHeaderCount, int maxHeaderSize, int delayms, FailureMode failMode)
-            throws Exception {
+    private void doTestHeaderLimits(int headerCount, int headerSize, int maxHeaderPayloadSize, int maxHeaderCount,
+            int maxHeaderSize, int delayms, FailureMode failMode) throws Exception {
 
         // Build the custom headers
         List<String[]> customHeaders = new ArrayList<>();
@@ -228,7 +222,7 @@ public class TestHttp2Limits extends Http2TestBase {
         }
         String v = headerValue.toString();
         for (int i = 0; i < headerCount; i++) {
-            customHeaders.add(new String[] {"X-TomcatTest" + i, v});
+            customHeaders.add(new String[] { "X-TomcatTest" + i, v });
         }
 
         enableHttp2();
@@ -250,8 +244,8 @@ public class TestHttp2Limits extends Http2TestBase {
         byte[] frameHeader = new byte[9];
         // Assumes at least one custom header and that all headers are the same
         // length. These assumptions are valid for these tests.
-        ByteBuffer headersPayload = ByteBuffer.allocate(200 + (int) (customHeaders.size() *
-                customHeaders.iterator().next()[1].length() * 1.2));
+        ByteBuffer headersPayload = ByteBuffer
+                .allocate(200 + (int) (customHeaders.size() * customHeaders.iterator().next()[1].length() * 1.2));
 
         populateHeadersPayload(headersPayload, customHeaders, "/simple");
 
@@ -262,8 +256,7 @@ public class TestHttp2Limits extends Http2TestBase {
             while (left > 0) {
                 int thisTime = Math.min(left, maxHeaderPayloadSize);
                 populateFrameHeader(frameHeader, written, left, thisTime, 3);
-                writeFrame(frameHeader, headersPayload, headersPayload.limit() - left,
-                        thisTime, delayms);
+                writeFrame(frameHeader, headersPayload, headersPayload.limit() - left, thisTime, delayms);
                 left -= thisTime;
                 written += thisTime;
             }
@@ -272,49 +265,49 @@ public class TestHttp2Limits extends Http2TestBase {
         }
 
         switch (failMode) {
-        case NONE: {
-            // Expect a normal response
-            readSimpleGetResponse();
-            Assert.assertEquals(getSimpleResponseTrace(3), output.getTrace());
-            Assert.assertNull(e);
-            break;
-        }
-        case STREAM_RESET: {
-            // Expect a stream reset
-            parser.readFrame();
-            Assert.assertEquals("3-RST-[11]\n", output.getTrace());
-            Assert.assertNull(e);
-            break;
-        }
-        case CONNECTION_RESET: {
-            // This message uses i18n and needs to be used in a regular
-            // expression (since we don't know the connection ID). Generate the
-            // string as a regular expression and then replace '[' and ']' with
-            // the escaped values.
-            String limitMessage = sm.getString("http2Parser.headerLimitSize", "\\p{XDigit}++", "3");
-            limitMessage = limitMessage.replace("[", "\\[").replace("]", "\\]");
-            // Connection reset. Connection ID will vary so use a pattern
-            // On some platform / Connector combinations the TCP connection close
-            // will be processed before the client gets a chance to read the
-            // connection close frame which will trigger an
-            // IOException when we try to read the frame.
-            // Note: Some platforms will allow the read if if the write fails
-            //       above.
-            try {
+            case NONE: {
+                // Expect a normal response
+                readSimpleGetResponse();
+                Assert.assertEquals(getSimpleResponseTrace(3), output.getTrace());
+                Assert.assertNull(e);
+                break;
+            }
+            case STREAM_RESET: {
+                // Expect a stream reset
                 parser.readFrame();
-                MatcherAssert.assertThat(output.getTrace(), RegexMatcher.matchesRegex(
-                        "0-Goaway-\\[1\\]-\\[11\\]-\\[" + limitMessage + "\\]"));
-            } catch (IOException se) {
-                // Expected on some platforms
+                Assert.assertEquals("3-RST-[11]\n", output.getTrace());
+                Assert.assertNull(e);
+                break;
+            }
+            case CONNECTION_RESET: {
+                // This message uses i18n and needs to be used in a regular
+                // expression (since we don't know the connection ID). Generate the
+                // string as a regular expression and then replace '[' and ']' with
+                // the escaped values.
+                String limitMessage = sm.getString("http2Parser.headerLimitSize", "\\p{XDigit}++", "3");
+                limitMessage = limitMessage.replace("[", "\\[").replace("]", "\\]");
+                // Connection reset. Connection ID will vary so use a pattern
+                // On some platform / Connector combinations the TCP connection close
+                // will be processed before the client gets a chance to read the
+                // connection close frame which will trigger an
+                // IOException when we try to read the frame.
+                // Note: Some platforms will allow the read if if the write fails
+                // above.
+                try {
+                    parser.readFrame();
+                    MatcherAssert.assertThat(output.getTrace(),
+                            RegexMatcher.matchesRegex("0-Goaway-\\[1\\]-\\[11\\]-\\[" + limitMessage + "\\]"));
+                } catch (IOException se) {
+                    // Expected on some platforms
+                }
+                break;
             }
-            break;
-        }
         }
     }
 
 
-    private void populateHeadersPayload(ByteBuffer headersPayload, List<String[]> customHeaders,
-            String path) throws Exception {
+    private void populateHeadersPayload(ByteBuffer headersPayload, List<String[]> customHeaders, String path)
+            throws Exception {
         MimeHeaders headers = new MimeHeaders();
         headers.addValue(":method").setString("GET");
         headers.addValue(":scheme").setString("http");
@@ -333,8 +326,8 @@ public class TestHttp2Limits extends Http2TestBase {
     }
 
 
-    private void populateFrameHeader(byte[] frameHeader, int written, int left, int thisTime,
-            int streamId) throws Exception {
+    private void populateFrameHeader(byte[] frameHeader, int written, int left, int thisTime, int streamId)
+            throws Exception {
         ByteUtil.setThreeBytes(frameHeader, 0, thisTime);
         if (written == 0) {
             frameHeader[3] = FrameType.HEADERS.getIdByte();
@@ -394,8 +387,7 @@ public class TestHttp2Limits extends Http2TestBase {
     }
 
 
-    private void doTestCookieLimit(int cookieCount, int maxCookieCount, int failMode)
-            throws Exception {
+    private void doTestCookieLimit(int cookieCount, int maxCookieCount, int failMode) throws Exception {
 
         enableHttp2();
 
@@ -415,7 +407,7 @@ public class TestHttp2Limits extends Http2TestBase {
 
         List<String[]> customHeaders = new ArrayList<>();
         for (int i = 0; i < cookieCount; i++) {
-            customHeaders.add(new String[] {"Cookie", "a" + cookieCount + "=b" + cookieCount});
+            customHeaders.add(new String[] { "Cookie", "a" + cookieCount + "=b" + cookieCount });
         }
 
         populateHeadersPayload(headersPayload, customHeaders, "/cookie");
@@ -424,55 +416,53 @@ public class TestHttp2Limits extends Http2TestBase {
         writeFrame(frameHeader, headersPayload);
 
         switch (failMode) {
-        case 0: {
-            parser.readFrame();
-            parser.readFrame();
-            parser.readFrame();
-            System.out.println(output.getTrace());
-            Assert.assertEquals(getCookieResponseTrace(3, cookieCount), output.getTrace());
-            break;
-        }
-        case 1: {
-            // Check status is 400
-            parser.readFrame();
-            Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
-                    "3-HeadersStart\n3-Header-[:status]-[400]"));
-            output.clearTrace();
-            // Check EOS followed by error page body
-            parser.readFrame();
-            Assert.assertTrue(output.getTrace(), output.getTrace().startsWith("3-EndOfStream\n3-Body-<!doctype"));
-            break;
-        }
-        default: {
-            Assert.fail("Unknown failure mode specified");
-        }
+            case 0: {
+                parser.readFrame();
+                parser.readFrame();
+                parser.readFrame();
+                System.out.println(output.getTrace());
+                Assert.assertEquals(getCookieResponseTrace(3, cookieCount), output.getTrace());
+                break;
+            }
+            case 1: {
+                // Check status is 400
+                parser.readFrame();
+                Assert.assertTrue(output.getTrace(),
+                        output.getTrace().startsWith("3-HeadersStart\n3-Header-[:status]-[400]"));
+                output.clearTrace();
+                // Check EOS followed by error page body
+                parser.readFrame();
+                Assert.assertTrue(output.getTrace(), output.getTrace().startsWith("3-EndOfStream\n3-Body-<!doctype"));
+                break;
+            }
+            default: {
+                Assert.fail("Unknown failure mode specified");
+            }
         }
     }
 
 
     @Test
-    public void testPostWithTrailerHeadersDefaultLimit() throws Exception{
-        doTestPostWithTrailerHeaders(Constants.DEFAULT_MAX_TRAILER_COUNT,
-                Constants.DEFAULT_MAX_TRAILER_SIZE, FailureMode.NONE);
+    public void testPostWithTrailerHeadersDefaultLimit() throws Exception {
+        doTestPostWithTrailerHeaders(Constants.DEFAULT_MAX_TRAILER_COUNT, Constants.DEFAULT_MAX_TRAILER_SIZE,
+                FailureMode.NONE);
     }
 
 
     @Test
-    public void testPostWithTrailerHeadersCount0() throws Exception{
-        doTestPostWithTrailerHeaders(0, Constants.DEFAULT_MAX_TRAILER_SIZE,
-                FailureMode.STREAM_RESET);
+    public void testPostWithTrailerHeadersCount0() throws Exception {
+        doTestPostWithTrailerHeaders(0, Constants.DEFAULT_MAX_TRAILER_SIZE, FailureMode.STREAM_RESET);
     }
 
 
     @Test
-    public void testPostWithTrailerHeadersSize0() throws Exception{
-        doTestPostWithTrailerHeaders(Constants.DEFAULT_MAX_TRAILER_COUNT, 0,
-                FailureMode.CONNECTION_RESET);
+    public void testPostWithTrailerHeadersSize0() throws Exception {
+        doTestPostWithTrailerHeaders(Constants.DEFAULT_MAX_TRAILER_COUNT, 0, FailureMode.CONNECTION_RESET);
     }
 
 
-    private void doTestPostWithTrailerHeaders(int maxTrailerCount, int maxTrailerSize,
-            FailureMode failMode) throws Exception {
+    private void doTestPostWithTrailerHeaders(int maxTrailerCount, int maxTrailerSize, FailureMode failMode)
+            throws Exception {
         enableHttp2();
 
         ((AbstractHttp11Protocol<?>) http2Protocol.getHttp11Protocol()).setAllowedTrailerHeaders(TRAILER_HEADER_NAME);
@@ -494,8 +484,8 @@ public class TestHttp2Limits extends Http2TestBase {
         byte[] trailerFrameHeader = new byte[9];
         ByteBuffer trailerPayload = ByteBuffer.allocate(256);
 
-        buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader, dataPayload,
-                null, trailerFrameHeader, trailerPayload, 3);
+        buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader, dataPayload, null,
+                trailerFrameHeader, trailerPayload, 3);
 
         // Write the headers
         writeFrame(headersFrameHeader, headersPayload);
@@ -505,56 +495,48 @@ public class TestHttp2Limits extends Http2TestBase {
         writeFrame(trailerFrameHeader, trailerPayload);
 
         switch (failMode) {
-        case NONE: {
-            parser.readFrame();
-            parser.readFrame();
-            parser.readFrame();
-            parser.readFrame();
-
-            String len = Integer.toString(256 + TRAILER_HEADER_VALUE.length());
-
-            Assert.assertEquals("0-WindowSize-[256]\n" +
-                    "3-WindowSize-[256]\n" +
-                    "3-HeadersStart\n" +
-                    "3-Header-[:status]-[200]\n" +
-                    "3-Header-[content-length]-[" + len + "]\n" +
-                    "3-Header-[date]-["+ DEFAULT_DATE + "]\n" +
-                    "3-HeadersEnd\n" +
-                    "3-Body-" +
-                    len +
-                    "\n" +
-                    "3-EndOfStream\n",
-                    output.getTrace());
-            break;
-        }
-        case STREAM_RESET: {
-            // NIO2 can sometimes send window updates depending timing
-            skipWindowSizeFrames();
-
-            // Async I/O can sometimes result in a stream closed reset before
-            // the enhance your calm reset
-            if ("3-RST-[5]\n".equals(output.getTrace())) {
-                output.clearTrace();
+            case NONE: {
+                parser.readFrame();
+                parser.readFrame();
+                parser.readFrame();
                 parser.readFrame();
-            }
 
-            Assert.assertEquals("3-RST-[11]\n", output.getTrace());
-            break;
-        }
-        case CONNECTION_RESET: {
-            // NIO2 can sometimes send window updates depending timing
-            skipWindowSizeFrames();
-
-            // This message uses i18n and needs to be used in a regular
-            // expression (since we don't know the connection ID). Generate the
-            // string as a regular expression and then replace '[' and ']' with
-            // the escaped values.
-            String limitMessage = sm.getString("http2Parser.headerLimitSize", "\\p{XDigit}++", "3");
-            limitMessage = limitMessage.replace("[", "\\[").replace("]", "\\]");
-            MatcherAssert.assertThat(output.getTrace(), RegexMatcher.matchesRegex(
-                    "0-Goaway-\\[3\\]-\\[11\\]-\\[" + limitMessage + "\\]"));
-            break;
-        }
+                String len = Integer.toString(256 + TRAILER_HEADER_VALUE.length());
+
+                Assert.assertEquals("0-WindowSize-[256]\n" + "3-WindowSize-[256]\n" + "3-HeadersStart\n" +
+                        "3-Header-[:status]-[200]\n" + "3-Header-[content-length]-[" + len + "]\n" +
+                        "3-Header-[date]-[" + DEFAULT_DATE + "]\n" + "3-HeadersEnd\n" + "3-Body-" + len + "\n" +
+                        "3-EndOfStream\n", output.getTrace());
+                break;
+            }
+            case STREAM_RESET: {
+                // NIO2 can sometimes send window updates depending timing
+                skipWindowSizeFrames();
+
+                // Async I/O can sometimes result in a stream closed reset before
+                // the enhance your calm reset
+                if ("3-RST-[5]\n".equals(output.getTrace())) {
+                    output.clearTrace();
+                    parser.readFrame();
+                }
+
+                Assert.assertEquals("3-RST-[11]\n", output.getTrace());
+                break;
+            }
+            case CONNECTION_RESET: {
+                // NIO2 can sometimes send window updates depending timing
+                skipWindowSizeFrames();
+
+                // This message uses i18n and needs to be used in a regular
+                // expression (since we don't know the connection ID). Generate the
+                // string as a regular expression and then replace '[' and ']' with
+                // the escaped values.
+                String limitMessage = sm.getString("http2Parser.headerLimitSize", "\\p{XDigit}++", "3");
+                limitMessage = limitMessage.replace("[", "\\[").replace("]", "\\]");
+                MatcherAssert.assertThat(output.getTrace(),
+                        RegexMatcher.matchesRegex("0-Goaway-\\[3\\]-\\[11\\]-\\[" + limitMessage + "\\]"));
+                break;
+            }
         }
     }
 
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_3_2.java b/test/org/apache/coyote/http2/TestHttp2Section_3_2.java
index 8f1057d6d5..be875ed9df 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_3_2.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_3_2.java
@@ -22,16 +22,13 @@ import java.nio.charset.StandardCharsets;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 3.2 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 3.2 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_3_2 extends Http2TestBase {
 
     // Note: Tests for zero/multiple HTTP2-Settings fields can be found below
-    //       in the tests for section 3.2.1
+    // in the tests for section 3.2.1
 
     // TODO: Test initial requests with bodies of various sizes
 
@@ -54,7 +51,7 @@ public class TestHttp2Section_3_2 extends Http2TestBase {
     }
 
 
-    @Test(timeout=10000)
+    @Test(timeout = 10000)
     public void testConnectionNoPreface() throws Exception {
         setupAsFarAsUpgrade();
 
@@ -68,7 +65,7 @@ public class TestHttp2Section_3_2 extends Http2TestBase {
     }
 
 
-    @Test(timeout=10000)
+    @Test(timeout = 10000)
     public void testConnectionIncompletePrefaceStart() throws Exception {
         setupAsFarAsUpgrade();
 
@@ -85,14 +82,13 @@ public class TestHttp2Section_3_2 extends Http2TestBase {
     }
 
 
-    @Test(timeout=10000)
+    @Test(timeout = 10000)
     public void testConnectionInvalidPrefaceStart() throws Exception {
         setupAsFarAsUpgrade();
 
         // If we send an incomplete preface the server should kill the
         // connection.
-        os.write("xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx".getBytes(
-                StandardCharsets.ISO_8859_1));
+        os.write("xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx".getBytes(StandardCharsets.ISO_8859_1));
         os.flush();
         try {
             // Make the parser read something.
@@ -104,7 +100,7 @@ public class TestHttp2Section_3_2 extends Http2TestBase {
 
 
     @Test
-    public void testConnectionUpgradeFirstResponse() throws Exception{
+    public void testConnectionUpgradeFirstResponse() throws Exception {
         super.http2Connect();
     }
 
@@ -117,7 +113,7 @@ public class TestHttp2Section_3_2 extends Http2TestBase {
     }
 
 
-    //------------------------------------------------------------ Section 3.2.1
+    // ------------------------------------------------------------ Section 3.2.1
 
     @Test
     public void testZeroHttp2Settings() throws Exception {
@@ -135,8 +131,7 @@ public class TestHttp2Section_3_2 extends Http2TestBase {
         configureAndStartWebApplication();
         openClientConnection();
         doHttpUpgrade(Http2TestBase.DEFAULT_CONNECTION_HEADER_VALUE, "h2c",
-                Http2TestBase.EMPTY_HTTP2_SETTINGS_HEADER +
-                Http2TestBase.EMPTY_HTTP2_SETTINGS_HEADER, false);
+                Http2TestBase.EMPTY_HTTP2_SETTINGS_HEADER + Http2TestBase.EMPTY_HTTP2_SETTINGS_HEADER, false);
         parseHttp11Response();
     }
 
@@ -156,8 +151,7 @@ public class TestHttp2Section_3_2 extends Http2TestBase {
         enableHttp2();
         configureAndStartWebApplication();
         openClientConnection();
-        doHttpUpgrade("Upgrade\r\nConnection: HTTP2-Settings", "h2c",
-                Http2TestBase.EMPTY_HTTP2_SETTINGS_HEADER, true);
+        doHttpUpgrade("Upgrade\r\nConnection: HTTP2-Settings", "h2c", Http2TestBase.EMPTY_HTTP2_SETTINGS_HEADER, true);
         sendClientPreface();
         validateHttp2InitialResponse();
     }
@@ -168,8 +162,7 @@ public class TestHttp2Section_3_2 extends Http2TestBase {
         enableHttp2();
         configureAndStartWebApplication();
         openClientConnection();
-        doHttpUpgrade("HTTP2-Settings\r\nConnection: Upgrade", "h2c",
-                Http2TestBase.EMPTY_HTTP2_SETTINGS_HEADER, true);
+        doHttpUpgrade("HTTP2-Settings\r\nConnection: Upgrade", "h2c", Http2TestBase.EMPTY_HTTP2_SETTINGS_HEADER, true);
         sendClientPreface();
         validateHttp2InitialResponse();
     }
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_3_5.java b/test/org/apache/coyote/http2/TestHttp2Section_3_5.java
index 60112773b8..4f88571877 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_3_5.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_3_5.java
@@ -32,9 +32,7 @@ public class TestHttp2Section_3_5 extends Http2TestBase {
 
         // Server settings
         parser.readFrame();
-        Assert.assertEquals("0-Settings-[3]-[200]\n" +
-                "0-Settings-End\n"
-                , output.getTrace());
+        Assert.assertEquals("0-Settings-[3]-[200]\n" + "0-Settings-End\n", output.getTrace());
         output.clearTrace();
 
         // Should send client preface here. This will trigger an error.
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_4_1.java b/test/org/apache/coyote/http2/TestHttp2Section_4_1.java
index 73a31d57a4..35872befac 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_4_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_4_1.java
@@ -22,16 +22,12 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 4.1 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 4.1 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_4_1 extends Http2TestBase {
 
-    private static final byte[] UNKNOWN_FRAME = new byte[] {
-        0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 };
+    private static final byte[] UNKNOWN_FRAME = new byte[] { 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 };
 
     // TODO: Tests for over-sized frames. Better located in tests for section 6?
 
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_4_2.java b/test/org/apache/coyote/http2/TestHttp2Section_4_2.java
index 496825f38e..3c158c724d 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_4_2.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_4_2.java
@@ -20,11 +20,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 4.2 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 4.2 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_4_2 extends Http2TestBase {
 
@@ -77,7 +74,7 @@ public class TestHttp2Section_4_2 extends Http2TestBase {
 
         os.write(ping);
 
-        handleGoAwayResponse(1,  Http2Error.FRAME_SIZE_ERROR);
+        handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
     }
 
 
@@ -99,7 +96,7 @@ public class TestHttp2Section_4_2 extends Http2TestBase {
 
         os.write(ping);
 
-        handleGoAwayResponse(1,  Http2Error.FRAME_SIZE_ERROR);
+        handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
     }
 
 
@@ -125,7 +122,6 @@ public class TestHttp2Section_4_2 extends Http2TestBase {
         // Read Stream reset frame
         parser.readFrame();
 
-        Assert.assertTrue(output.getTrace(),
-                output.getTrace().startsWith("3-RST-[6]"));
+        Assert.assertTrue(output.getTrace(), output.getTrace().startsWith("3-RST-[6]"));
     }
 }
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_4_3.java b/test/org/apache/coyote/http2/TestHttp2Section_4_3.java
index dc65ee6395..772c26f2e7 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_4_3.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_4_3.java
@@ -22,11 +22,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 4.3 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 4.3 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_4_3 extends Http2TestBase {
 
@@ -46,7 +43,7 @@ public class TestHttp2Section_4_3 extends Http2TestBase {
         // Process the request
         writeFrame(frameHeader, headersPayload);
 
-        handleGoAwayResponse(1,  Http2Error.COMPRESSION_ERROR);
+        handleGoAwayResponse(1, Http2Error.COMPRESSION_ERROR);
     }
 
 
@@ -87,6 +84,6 @@ public class TestHttp2Section_4_3 extends Http2TestBase {
 
         sendPing();
 
-        handleGoAwayResponse(1,  Http2Error.COMPRESSION_ERROR);
+        handleGoAwayResponse(1, Http2Error.COMPRESSION_ERROR);
     }
 }
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 62c507cdf7..cbe224ccfc 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -24,11 +24,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 5.§ of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 5.§ of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_5_1 extends Http2TestBase {
 
@@ -69,7 +66,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
         // This should trigger a connection error
         sendData(3, new byte[] {});
 
-        handleGoAwayResponse(3,  Http2Error.STREAM_CLOSED);
+        handleGoAwayResponse(3, Http2Error.STREAM_CLOSED);
     }
 
 
@@ -108,7 +105,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
         // Stream 1 is closed. This should trigger a connection error
         sendData(1, new byte[] {});
 
-        handleGoAwayResponse(1,  Http2Error.STREAM_CLOSED);
+        handleGoAwayResponse(1, Http2Error.STREAM_CLOSED);
     }
 
 
@@ -179,8 +176,10 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 
         // Allow second request to take up to 5 times first request or up to 1 second - whichever is the larger - mainly
         // to allow for CI systems under load that can exhibit significant timing variation.
-        Assert.assertTrue("First request took [" + durationFirst/1000000 + "ms], second request took [" +
-                durationSecond/1000000 + "ms]", durationSecond < 1000000000 || durationSecond < durationFirst * 3);
+        Assert.assertTrue(
+                "First request took [" + durationFirst / 1000000 + "ms], second request took [" +
+                        durationSecond / 1000000 + "ms]",
+                durationSecond < 1000000000 || durationSecond < durationFirst * 3);
 
         // Should trigger an error since stream 3 should have been implicitly
         // closed.
@@ -206,12 +205,8 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
         parser.readFrame();
         parser.readFrame();
 
-        Assert.assertEquals("0-Settings-[3]-[1]\n" +
-                "0-Settings-End\n" +
-                "0-Settings-Ack\n" +
-                "0-Ping-[0,0,0,0,0,0,0,1]\n" +
-                getSimpleResponseTrace(1)
-                , output.getTrace());
+        Assert.assertEquals("0-Settings-[3]-[1]\n" + "0-Settings-End\n" + "0-Settings-Ack\n" +
+                "0-Ping-[0,0,0,0,0,0,0,1]\n" + getSimpleResponseTrace(1), output.getTrace());
         output.clearTrace();
 
         sendLargeGetRequest(3);
@@ -231,8 +226,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
         }
 
         Assert.assertTrue(output.getTrace(),
-                output.getTrace().contains("5-RST-[" +
-                        Http2Error.REFUSED_STREAM.getCode() + "]"));
+                output.getTrace().contains("5-RST-[" + Http2Error.REFUSED_STREAM.getCode() + "]"));
         output.clearTrace();
 
         // Connection window is zero.
@@ -273,12 +267,8 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
         parser.readFrame();
         parser.readFrame();
 
-        Assert.assertEquals("0-Settings-[3]-[1]\n" +
-                "0-Settings-End\n" +
-                "0-Settings-Ack\n" +
-                "0-Ping-[0,0,0,0,0,0,0,1]\n" +
-                getSimpleResponseTrace(1)
-                , output.getTrace());
+        Assert.assertEquals("0-Settings-[3]-[1]\n" + "0-Settings-End\n" + "0-Settings-Ack\n" +
+                "0-Ping-[0,0,0,0,0,0,0,1]\n" + getSimpleResponseTrace(1), output.getTrace());
         output.clearTrace();
 
         sendLargeGetRequest(3);
@@ -298,8 +288,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
         }
 
         Assert.assertTrue(output.getTrace(),
-                output.getTrace().contains("5-RST-[" +
-                        Http2Error.REFUSED_STREAM.getCode() + "]"));
+                output.getTrace().contains("5-RST-[" + Http2Error.REFUSED_STREAM.getCode() + "]"));
         output.clearTrace();
 
         // Connection window is zero.
@@ -342,12 +331,8 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
             parser.readFrame();
             parser.readFrame();
 
-            Assert.assertEquals("0-Settings-[3]-[1]\n" +
-                    "0-Settings-End\n" +
-                    "0-Settings-Ack\n" +
-                    "0-Ping-[0,0,0,0,0,0,0,1]\n" +
-                    getSimpleResponseTrace(1)
-                    , output.getTrace());
+            Assert.assertEquals("0-Settings-[3]-[1]\n" + "0-Settings-End\n" + "0-Settings-Ack\n" +
+                    "0-Ping-[0,0,0,0,0,0,0,1]\n" + getSimpleResponseTrace(1), output.getTrace());
             output.clearTrace();
 
             sendLargeGetRequest(3);
@@ -401,12 +386,8 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
         parser.readFrame();
         parser.readFrame();
 
-        Assert.assertEquals("0-Settings-[3]-[1]\n" +
-                "0-Settings-End\n" +
-                "0-Settings-Ack\n" +
-                "0-Ping-[0,0,0,0,0,0,0,1]\n" +
-                getSimpleResponseTrace(1)
-                , output.getTrace());
+        Assert.assertEquals("0-Settings-[3]-[1]\n" + "0-Settings-End\n" + "0-Settings-Ack\n" +
+                "0-Ping-[0,0,0,0,0,0,0,1]\n" + getSimpleResponseTrace(1), output.getTrace());
         output.clearTrace();
 
         // Default connection window size is 64k-1.
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_2.java b/test/org/apache/coyote/http2/TestHttp2Section_5_2.java
index 35083face7..fbdd148de4 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_2.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_2.java
@@ -21,17 +21,14 @@ import org.junit.Before;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 5.2 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 5.2 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_5_2 extends Http2TestBase {
 
     /*
-     * Get the connection to a point where 1k of 8k response body has been
-     * read and the flow control for the stream has no capacity left.
+     * Get the connection to a point where 1k of 8k response body has been read and the flow control for the stream has
+     * no capacity left.
      */
     @Override
     @Before
@@ -80,7 +77,7 @@ public class TestHttp2Section_5_2 extends Http2TestBase {
 
     @Test
     public void testFlowControlLimits03() throws Exception {
-        readBytes(8192,7168);
+        readBytes(8192, 7168);
     }
 
 
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_3.java b/test/org/apache/coyote/http2/TestHttp2Section_5_3.java
index 4a50528dd6..872748bd61 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_3.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_3.java
@@ -20,14 +20,9 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 5.3 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
- *
- * Note: Unit tests for the examples described by each of the figures may be
- * found in {@link TestAbstractStream}.
+ * Unit tests for Section 5.3 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC. Note: Unit tests for the
+ * examples described by each of the figures may be found in {@link TestAbstractStream}.
  */
 public class TestHttp2Section_5_3 extends Http2TestBase {
 
@@ -37,11 +32,11 @@ public class TestHttp2Section_5_3 extends Http2TestBase {
     public void testStreamDependsOnSelf() throws Exception {
         http2Connect();
 
-        sendPriority(3,  3,  15);
+        sendPriority(3, 3, 15);
 
         parser.readFrame();
 
-        Assert.assertEquals("3-RST-[1]\n",  output.getTrace());
+        Assert.assertEquals("3-RST-[1]\n", output.getTrace());
     }
 
 
@@ -82,8 +77,8 @@ public class TestHttp2Section_5_3 extends Http2TestBase {
         // should have a window of 1k as well
 
         // Set up streams A=17, B=19, C=21
-        sendPriority(17,  0, 15);
-        sendPriority(19, 17,  3);
+        sendPriority(17, 0, 15);
+        sendPriority(19, 17, 3);
         sendPriority(21, 17, 11);
 
         // First, process a request on stream 17. This should consume both
@@ -105,8 +100,8 @@ public class TestHttp2Section_5_3 extends Http2TestBase {
 
         // Open up the flow control windows for stream 19 & 21 to more than the
         // size of a simple request (8k)
-        sendWindowUpdate(19, 16*1024);
-        sendWindowUpdate(21, 16*1024);
+        sendWindowUpdate(19, 16 * 1024);
+        sendWindowUpdate(21, 16 * 1024);
 
         // Read some frames
         // 19-headers, 21-headers
@@ -135,22 +130,22 @@ public class TestHttp2Section_5_3 extends Http2TestBase {
         //
         // The loop below handles 0, 1 or 2 stream being blocked
         // - If 0 streams are blocked the connection window will be set to one
-        //   and that will be consumed by the first stream to attempt to write.
-        //   That body frame will be read by the client. The stream will then be
-        //   blocked and the loop will start again.
+        // and that will be consumed by the first stream to attempt to write.
+        // That body frame will be read by the client. The stream will then be
+        // blocked and the loop will start again.
         // - If 1 stream is blocked, the connection window will be set to one
-        //   which will then be consumed by the blocked stream. After writing
-        //   the single byte the stream will again be blocked and the loop will
-        //   start again.
+        // which will then be consumed by the blocked stream. After writing
+        // the single byte the stream will again be blocked and the loop will
+        // start again.
         // - If 2 streams are blocked the connection window will be set to one
-        //   but one byte will be permitted for both streams (due to rounding in
-        //   the allocation). The window size should be -1 (see below). Two
-        //   frames (one for each stream will be written) one of which will be
-        //   consumed by the client. The loop will start again and the Window
-        //   size incremented to zero. No data will be written by the streams
-        //   but the second data frame written in the last iteration of the loop
-        //   will be read. The loop will then exit since frames from both
-        //   streams will have been observed.
+        // but one byte will be permitted for both streams (due to rounding in
+        // the allocation). The window size should be -1 (see below). Two
+        // frames (one for each stream will be written) one of which will be
+        // consumed by the client. The loop will start again and the Window
+        // size incremented to zero. No data will be written by the streams
+        // but the second data frame written in the last iteration of the loop
+        // will be read. The loop will then exit since frames from both
+        // streams will have been observed.
         boolean seen19 = false;
         boolean seen21 = false;
         while (!seen19 || !seen21) {
@@ -271,7 +266,7 @@ public class TestHttp2Section_5_3 extends Http2TestBase {
         // should have a window of 64k
 
         // Create priority tree. This test requires a blocked stream to depend on a closed stream
-        sendPriority(17,  15, 15);
+        sendPriority(17, 15, 15);
 
         // Process a request on stream 17.
         // This should consume the connection window and put streams 15 and 17 in the backlog.
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_5.java b/test/org/apache/coyote/http2/TestHttp2Section_5_5.java
index fb9966757a..c383a2e631 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_5.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_5.java
@@ -22,11 +22,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 5.5 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 5.5 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_5_5 extends Http2TestBase {
 
@@ -57,7 +54,7 @@ public class TestHttp2Section_5_5 extends Http2TestBase {
 
         parser.readFrame();
 
-        Assert.assertEquals("0-Settings-Ack\n",  output.getTrace());
+        Assert.assertEquals("0-Settings-Ack\n", output.getTrace());
     }
 
 
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_1.java b/test/org/apache/coyote/http2/TestHttp2Section_6_1.java
index 27a622380f..bd064ae152 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_1.java
@@ -23,11 +23,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 6.1 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 6.1 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_6_1 extends Http2TestBase {
 
@@ -41,15 +38,11 @@ public class TestHttp2Section_6_1 extends Http2TestBase {
         sendSimplePostRequest(3, null);
         readSimplePostResponse(false);
 
-        Assert.assertEquals("0-WindowSize-[128]\n" +
-                "3-WindowSize-[128]\n" +
-                "3-HeadersStart\n" +
-                "3-Header-[:status]-[200]\n" +
-                "3-Header-[content-length]-[128]\n" +
-                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                "3-HeadersEnd\n" +
-                "3-Body-128\n" +
-                "3-EndOfStream\n", output.getTrace());
+        Assert.assertEquals(
+                "0-WindowSize-[128]\n" + "3-WindowSize-[128]\n" + "3-HeadersStart\n" + "3-Header-[:status]-[200]\n" +
+                        "3-Header-[content-length]-[128]\n" + "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
+                        "3-HeadersEnd\n" + "3-Body-128\n" + "3-EndOfStream\n",
+                output.getTrace());
     }
 
 
@@ -79,19 +72,14 @@ public class TestHttp2Section_6_1 extends Http2TestBase {
             trace = trace.replace(paddingWindowUpdate, "");
 
             // The stream window update may or may not be present depending on
-            //  timing. Remove it if present.
+            // timing. Remove it if present.
             if (trace.contains("3-WindowSize-[9]\n")) {
                 trace = trace.replace("3-WindowSize-[9]\n", "");
             }
 
-            Assert.assertEquals("0-WindowSize-[119]\n" +
-                    "3-WindowSize-[119]\n" +
-                    "3-HeadersStart\n" +
-                    "3-Header-[:status]-[200]\n" +
-                    "3-Header-[content-length]-[119]\n" +
-                    "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                    "3-HeadersEnd\n" +
-                    "3-Body-119\n" +
+            Assert.assertEquals("0-WindowSize-[119]\n" + "3-WindowSize-[119]\n" + "3-HeadersStart\n" +
+                    "3-Header-[:status]-[200]\n" + "3-Header-[content-length]-[119]\n" +
+                    "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "3-HeadersEnd\n" + "3-Body-119\n" +
                     "3-EndOfStream\n", trace);
         } finally {
             LogManager.getLogManager().getLogger("org.apache.coyote").setLevel(Level.INFO);
@@ -184,20 +172,16 @@ public class TestHttp2Section_6_1 extends Http2TestBase {
         trace = trace.replace(paddingWindowUpdate, "");
 
         // The stream window update may or may not be present depending on
-        //  timing. Remove it if present.
+        // timing. Remove it if present.
         paddingWindowUpdate = "3-WindowSize-[1]\n";
         if (trace.contains(paddingWindowUpdate)) {
             trace = trace.replace(paddingWindowUpdate, "");
         }
 
-        Assert.assertEquals("0-WindowSize-[127]\n" +
-                "3-WindowSize-[127]\n" +
-                "3-HeadersStart\n" +
-                "3-Header-[:status]-[200]\n" +
-                "3-Header-[content-length]-[127]\n" +
-                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                "3-HeadersEnd\n" +
-                "3-Body-127\n" +
-                "3-EndOfStream\n", trace);
+        Assert.assertEquals(
+                "0-WindowSize-[127]\n" + "3-WindowSize-[127]\n" + "3-HeadersStart\n" + "3-Header-[:status]-[200]\n" +
+                        "3-Header-[content-length]-[127]\n" + "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
+                        "3-HeadersEnd\n" + "3-Body-127\n" + "3-EndOfStream\n",
+                trace);
     }
 }
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_2.java b/test/org/apache/coyote/http2/TestHttp2Section_6_2.java
index ae9665ca96..9e903ceed9 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_2.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_2.java
@@ -22,11 +22,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 6.2 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 6.2 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_6_2 extends Http2TestBase {
 
@@ -49,7 +46,7 @@ public class TestHttp2Section_6_2 extends Http2TestBase {
     public void testHeaderFrameWithPadding() throws Exception {
         http2Connect();
 
-        byte[] padding= new byte[8];
+        byte[] padding = new byte[8];
 
         sendSimpleGetRequest(3, padding);
         readSimpleGetResponse();
@@ -61,7 +58,7 @@ public class TestHttp2Section_6_2 extends Http2TestBase {
     public void testHeaderFrameWithNonZeroPadding() throws Exception {
         http2Connect();
 
-        byte[] padding= new byte[8];
+        byte[] padding = new byte[8];
         padding[4] = 1;
 
         sendSimpleGetRequest(3, padding);
@@ -98,7 +95,7 @@ public class TestHttp2Section_6_2 extends Http2TestBase {
     public void testHeaderFrameWithZeroLengthPadding() throws Exception {
         http2Connect();
 
-        byte[] padding= new byte[0];
+        byte[] padding = new byte[0];
 
         sendSimpleGetRequest(3, padding);
         readSimpleGetResponse();
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_3.java b/test/org/apache/coyote/http2/TestHttp2Section_6_3.java
index 0b9c956769..1115f52457 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_3.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_3.java
@@ -22,11 +22,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 6.3 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 6.3 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_6_3 extends Http2TestBase {
 
@@ -80,7 +77,6 @@ public class TestHttp2Section_6_3 extends Http2TestBase {
         // Read reset frame
         parser.readFrame();
 
-        Assert.assertEquals("3-RST-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]\n",
-                output.getTrace());
+        Assert.assertEquals("3-RST-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]\n", output.getTrace());
     }
 }
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_4.java b/test/org/apache/coyote/http2/TestHttp2Section_6_4.java
index a587294cac..ba0dc64cd1 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_4.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_4.java
@@ -20,11 +20,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 6.4 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 6.4 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_6_4 extends Http2TestBase {
 
@@ -73,7 +70,6 @@ public class TestHttp2Section_6_4 extends Http2TestBase {
         // Read reset frame
         parser.readFrame();
 
-        Assert.assertEquals("3-RST-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]\n",
-                output.getTrace());
+        Assert.assertEquals("3-RST-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]\n", output.getTrace());
     }
 }
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_5.java b/test/org/apache/coyote/http2/TestHttp2Section_6_5.java
index 306bd89671..f826914013 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_5.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_5.java
@@ -20,11 +20,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 6.5 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 6.5 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_6_5 extends Http2TestBase {
 
@@ -34,7 +31,7 @@ public class TestHttp2Section_6_5 extends Http2TestBase {
         // HTTP2 upgrade
         http2Connect();
 
-        sendSettings(0, true, new SettingValue(1,1));
+        sendSettings(0, true, new SettingValue(1, 1));
 
         handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
     }
@@ -46,7 +43,7 @@ public class TestHttp2Section_6_5 extends Http2TestBase {
         http2Connect();
 
         sendPriority(3, 0, 15);
-        sendSettings(3, true, new SettingValue(1,1));
+        sendSettings(3, true, new SettingValue(1, 1));
 
         handleGoAwayResponse(1);
     }
@@ -81,7 +78,7 @@ public class TestHttp2Section_6_5 extends Http2TestBase {
         // HTTP2 upgrade
         http2Connect();
 
-        sendSettings(0, false, new SettingValue(0x2,0x2));
+        sendSettings(0, false, new SettingValue(0x2, 0x2));
 
         handleGoAwayResponse(1);
     }
@@ -92,7 +89,7 @@ public class TestHttp2Section_6_5 extends Http2TestBase {
         // HTTP2 upgrade
         http2Connect();
 
-        sendSettings(0, false, new SettingValue(0x4,1 << 31));
+        sendSettings(0, false, new SettingValue(0x4, 1 << 31));
 
         handleGoAwayResponse(1, Http2Error.FLOW_CONTROL_ERROR);
     }
@@ -103,7 +100,7 @@ public class TestHttp2Section_6_5 extends Http2TestBase {
         // HTTP2 upgrade
         http2Connect();
 
-        sendSettings(0, false, new SettingValue(0x5,1 << 31));
+        sendSettings(0, false, new SettingValue(0x5, 1 << 31));
 
         handleGoAwayResponse(1);
     }
@@ -114,13 +111,12 @@ public class TestHttp2Section_6_5 extends Http2TestBase {
         // HTTP2 upgrade
         http2Connect();
 
-        sendSettings(0, false, new SettingValue(0xFF,0xFF));
+        sendSettings(0, false, new SettingValue(0xFF, 0xFF));
 
         // Ack
         parser.readFrame();
 
-        Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
-                "0-Settings-Ack"));
+        Assert.assertTrue(output.getTrace(), output.getTrace().startsWith("0-Settings-Ack"));
     }
 
     // delayed ACKs. Requires an API (TBD) for applications to send settings.
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_6.java b/test/org/apache/coyote/http2/TestHttp2Section_6_6.java
index cdf19bbec1..ae61fd31f1 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_6.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_6.java
@@ -36,10 +36,9 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.startup.Tomcat;
 
 /**
- * Unit tests for Section 6.5 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
+ * Unit tests for Section 6.5 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
  */
-public class TestHttp2Section_6_6  extends Http2TestBase {
+public class TestHttp2Section_6_6 extends Http2TestBase {
 
 
     @Test
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_7.java b/test/org/apache/coyote/http2/TestHttp2Section_6_7.java
index d9186486fb..cb5422322f 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_7.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_7.java
@@ -22,11 +22,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 6.7 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 6.7 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_6_7 extends Http2TestBase {
 
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
index b2de519e6b..ae245ca418 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
@@ -20,11 +20,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 6.8 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 6.8 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_6_8 extends Http2TestBase {
 
@@ -62,7 +59,7 @@ public class TestHttp2Section_6_8 extends Http2TestBase {
         parser.readFrame();
         parser.readFrame();
 
-        Assert.assertEquals(getSimpleResponseTrace(3),  output.getTrace());
+        Assert.assertEquals(getSimpleResponseTrace(3), output.getTrace());
         output.clearTrace();
 
         // Finally the go away frame
@@ -83,5 +80,5 @@ public class TestHttp2Section_6_8 extends Http2TestBase {
 
 
     // TODO Test header processing and window size processing for ignored
-    //      streams
+    // streams
 }
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_9.java b/test/org/apache/coyote/http2/TestHttp2Section_6_9.java
index 25186671d1..176c669cef 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_9.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_9.java
@@ -22,11 +22,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Unit tests for Section 6.9 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * requirements in the RFC.
+ * Unit tests for Section 6.9 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the requirements in the RFC.
  */
 public class TestHttp2Section_6_9 extends Http2TestBase {
 
@@ -44,13 +41,12 @@ public class TestHttp2Section_6_9 extends Http2TestBase {
     public void testZeroWindowUpdateStream() throws Exception {
         http2Connect();
 
-        sendSimplePostRequest(3,  null,  false);
+        sendSimplePostRequest(3, null, false);
         sendWindowUpdate(3, 0);
 
         parser.readFrame();
 
-        Assert.assertEquals("3-RST-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]\n",
-                output.getTrace());
+        Assert.assertEquals("3-RST-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]\n", output.getTrace());
     }
 
 
@@ -69,7 +65,7 @@ public class TestHttp2Section_6_9 extends Http2TestBase {
 
 
     // TODO: Test always accounting for changes in flow control windows even if
-    //       the frame is in error.
+    // the frame is in error.
 
 
     @Test
@@ -114,7 +110,7 @@ public class TestHttp2Section_6_9 extends Http2TestBase {
         parser.readFrame();
 
         // Release Stream 15 which is waiting for a single byte.
-        sendWindowUpdate(0,  1024);
+        sendWindowUpdate(0, 1024);
 
         Assert.assertEquals(getEmptyResponseTrace(17), output.getTrace());
     }
@@ -125,15 +121,14 @@ public class TestHttp2Section_6_9 extends Http2TestBase {
         http2Connect();
 
         // Set up stream 3
-        sendSimplePostRequest(3,  null,  false);
+        sendSimplePostRequest(3, null, false);
 
         // Super size the flow control window.
         sendWindowUpdate(3, (1 << 31) - 1);
 
         parser.readFrame();
 
-        Assert.assertEquals("3-RST-[" + Http2Error.FLOW_CONTROL_ERROR.getCode() + "]\n",
-                output.getTrace());
+        Assert.assertEquals("3-RST-[" + Http2Error.FLOW_CONTROL_ERROR.getCode() + "]\n", output.getTrace());
     }
 
 
@@ -161,8 +156,7 @@ public class TestHttp2Section_6_9 extends Http2TestBase {
         byte[] dataFrameHeader = new byte[9];
         ByteBuffer dataPayload = ByteBuffer.allocate(8 * 1024);
 
-        buildPostRequest(headersFrameHeader, headersPayload, false,
-                dataFrameHeader, dataPayload, null, 3);
+        buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader, dataPayload, null, 3);
 
         // Write the headers
         writeFrame(headersFrameHeader, headersPayload);
@@ -181,23 +175,17 @@ public class TestHttp2Section_6_9 extends Http2TestBase {
         // Window size updates after reading POST body
         parser.readFrame();
         parser.readFrame();
-        Assert.assertEquals(
-                "0-WindowSize-[8192]\n" +
-                "3-WindowSize-[8192]\n",
-                output.getTrace());
+        Assert.assertEquals("0-WindowSize-[8192]\n" + "3-WindowSize-[8192]\n", output.getTrace());
         output.clearTrace();
 
         // Read stream 3 headers and first part of body
         parser.readFrame();
         parser.readFrame();
         Assert.assertEquals(
-                "3-HeadersStart\n" +
-                "3-Header-[:status]-[200]\n" +
-                "3-Header-[content-length]-[8192]\n" +
-                "3-Header-[date]-["+ DEFAULT_DATE + "]\n" +
-                "3-HeadersEnd\n" +
-                "3-Body-4096\n", output.getTrace());
-                output.clearTrace();
+                "3-HeadersStart\n" + "3-Header-[:status]-[200]\n" + "3-Header-[content-length]-[8192]\n" +
+                        "3-Header-[date]-[" + DEFAULT_DATE + "]\n" + "3-HeadersEnd\n" + "3-Body-4096\n",
+                output.getTrace());
+        output.clearTrace();
 
         // Now use a settings frame to further reduce the size of the flow
         // control window. This should make the stream 3 window negative
@@ -220,23 +208,15 @@ public class TestHttp2Section_6_9 extends Http2TestBase {
         // Window size updates after reading POST body
         parser.readFrame();
         parser.readFrame();
-        Assert.assertEquals(
-                "0-WindowSize-[128]\n" +
-                "5-WindowSize-[128]\n",
-                output.getTrace());
+        Assert.assertEquals("0-WindowSize-[128]\n" + "5-WindowSize-[128]\n", output.getTrace());
         output.clearTrace();
         // Headers + body
         parser.readFrame();
         parser.readFrame();
-        Assert.assertEquals(
-                "5-HeadersStart\n" +
-                "5-Header-[:status]-[200]\n" +
-                "5-Header-[content-length]-[128]\n" +
-                "5-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                "5-HeadersEnd\n" +
-                "5-Body-128\n" +
+        Assert.assertEquals("5-HeadersStart\n" + "5-Header-[:status]-[200]\n" + "5-Header-[content-length]-[128]\n" +
+                "5-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "5-HeadersEnd\n" + "5-Body-128\n" +
                 "5-EndOfStream\n", output.getTrace());
-                output.clearTrace();
+        output.clearTrace();
 
         // Now use a settings frame to restore the size of the flow control
         // window.
@@ -270,17 +250,16 @@ public class TestHttp2Section_6_9 extends Http2TestBase {
         http2Connect();
 
         // Set up stream 3
-        sendSimplePostRequest(3,  null,  false);
+        sendSimplePostRequest(3, null, false);
 
         // Increase the flow control window but keep it under the limit
         sendWindowUpdate(3, 1 << 30);
 
         // Now increase beyond the limit via a settings frame
-        sendSettings(0, false, new SettingValue(4,  1 << 30));
+        sendSettings(0, false, new SettingValue(4, 1 << 30));
         // Ack
         parser.readFrame();
-        Assert.assertEquals("3-RST-[" + Http2Error.FLOW_CONTROL_ERROR.getCode() + "]\n",
-                output.getTrace());
+        Assert.assertEquals("3-RST-[" + Http2Error.FLOW_CONTROL_ERROR.getCode() + "]\n", output.getTrace());
 
     }
 }
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_8_1.java b/test/org/apache/coyote/http2/TestHttp2Section_8_1.java
index e76bfd869a..5bc3e3872e 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_8_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_8_1.java
@@ -29,11 +29,8 @@ import org.apache.coyote.ContinueResponseTiming;
 import org.apache.coyote.http11.AbstractHttp11Protocol;
 
 /**
- * Unit tests for Section 8.1 of
- * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
- * <br>
- * The order of tests in this class is aligned with the order of the
- * examples in the RFC.
+ * Unit tests for Section 8.1 of <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. <br>
+ * The order of tests in this class is aligned with the order of the examples in the RFC.
  */
 public class TestHttp2Section_8_1 extends Http2TestBase {
 
@@ -49,10 +46,11 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
     }
 
 
-    private void doTestPostWithTrailerHeaders(boolean allowTrailerHeader) throws Exception{
+    private void doTestPostWithTrailerHeaders(boolean allowTrailerHeader) throws Exception {
         http2Connect();
         if (allowTrailerHeader) {
-            ((AbstractHttp11Protocol<?>) http2Protocol.getHttp11Protocol()).setAllowedTrailerHeaders(TRAILER_HEADER_NAME);
+            ((AbstractHttp11Protocol<?>) http2Protocol.getHttp11Protocol())
+                    .setAllowedTrailerHeaders(TRAILER_HEADER_NAME);
         }
 
         // Disable overhead protection for window update as it breaks some tests
@@ -65,8 +63,8 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
         byte[] trailerFrameHeader = new byte[9];
         ByteBuffer trailerPayload = ByteBuffer.allocate(256);
 
-        buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader, dataPayload,
-                null, trailerFrameHeader, trailerPayload, 3);
+        buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader, dataPayload, null,
+                trailerFrameHeader, trailerPayload, 3);
 
         // Write the headers
         writeFrame(headersFrameHeader, headersPayload);
@@ -87,17 +85,9 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
             len = "256";
         }
 
-        Assert.assertEquals("0-WindowSize-[256]\n" +
-                "3-WindowSize-[256]\n" +
-                "3-HeadersStart\n" +
-                "3-Header-[:status]-[200]\n" +
-                "3-Header-[content-length]-[" + len + "]\n" +
-                "3-Header-[date]-["+ DEFAULT_DATE + "]\n" +
-                "3-HeadersEnd\n" +
-                "3-Body-" +
-                len +
-                "\n" +
-                "3-EndOfStream\n",
+        Assert.assertEquals("0-WindowSize-[256]\n" + "3-WindowSize-[256]\n" + "3-HeadersStart\n" +
+                "3-Header-[:status]-[200]\n" + "3-Header-[content-length]-[" + len + "]\n" + "3-Header-[date]-[" +
+                DEFAULT_DATE + "]\n" + "3-HeadersEnd\n" + "3-Body-" + len + "\n" + "3-EndOfStream\n",
                 output.getTrace());
     }
 
@@ -147,20 +137,15 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
         byte[] dataFrameHeader = new byte[9];
         ByteBuffer dataPayload = ByteBuffer.allocate(256);
 
-        buildPostRequest(headersFrameHeader, headersPayload, true,
-                null, -1, "/simple",
-                dataFrameHeader, dataPayload, null,
-                null, null, 3);
+        buildPostRequest(headersFrameHeader, headersPayload, true, null, -1, "/simple", dataFrameHeader, dataPayload,
+                null, null, null, 3);
 
         // Write the headers
         writeFrame(headersFrameHeader, headersPayload);
 
         parser.readFrame();
 
-        Assert.assertEquals("3-HeadersStart\n" +
-                "3-Header-[:status]-[100]\n" +
-                "3-HeadersEnd\n",
-                output.getTrace());
+        Assert.assertEquals("3-HeadersStart\n" + "3-Header-[:status]-[100]\n" + "3-HeadersEnd\n", output.getTrace());
         output.clearTrace();
 
         // Write the body
@@ -171,16 +156,9 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
         parser.readFrame();
         parser.readFrame();
 
-        Assert.assertEquals("0-WindowSize-[256]\n" +
-                "3-WindowSize-[256]\n" +
-                "3-HeadersStart\n" +
-                "3-Header-[:status]-[200]\n" +
-                "3-Header-[content-length]-[256]\n" +
-                "3-Header-[date]-["+ DEFAULT_DATE + "]\n" +
-                "3-HeadersEnd\n" +
-                "3-Body-256\n" +
-                "3-EndOfStream\n",
-                output.getTrace());
+        Assert.assertEquals("0-WindowSize-[256]\n" + "3-WindowSize-[256]\n" + "3-HeadersStart\n" +
+                "3-Header-[:status]-[200]\n" + "3-Header-[content-length]-[256]\n" + "3-Header-[date]-[" +
+                DEFAULT_DATE + "]\n" + "3-HeadersEnd\n" + "3-Body-256\n" + "3-EndOfStream\n", output.getTrace());
     }
 
 
@@ -230,7 +208,7 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
         byte[] headersFrameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
 
-        buildSimpleGetRequestPart1(headersFrameHeader, headersPayload, headers , 3);
+        buildSimpleGetRequestPart1(headersFrameHeader, headersPayload, headers, 3);
 
         writeFrame(headersFrameHeader, headersPayload);
 
@@ -238,7 +216,7 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
         headers.add(new Header(":authority", "localhost:" + getPort()));
         headersPayload.clear();
 
-        buildSimpleGetRequestPart2(headersFrameHeader, headersPayload, headers , 3);
+        buildSimpleGetRequestPart2(headersFrameHeader, headersPayload, headers, 3);
 
         writeFrame(headersFrameHeader, headersPayload);
 
@@ -262,7 +240,7 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
         byte[] headersFrameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
 
-        buildGetRequest(headersFrameHeader, headersPayload, null, headers , 3);
+        buildGetRequest(headersFrameHeader, headersPayload, null, headers, 3);
 
         writeFrame(headersFrameHeader, headersPayload);
 
@@ -287,7 +265,7 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
         byte[] headersFrameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
 
-        buildGetRequest(headersFrameHeader, headersPayload, null, headers , 3);
+        buildGetRequest(headersFrameHeader, headersPayload, null, headers, 3);
 
         writeFrame(headersFrameHeader, headersPayload);
 
@@ -312,7 +290,7 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
         byte[] headersFrameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
 
-        buildGetRequest(headersFrameHeader, headersPayload, null, headers , 3);
+        buildGetRequest(headersFrameHeader, headersPayload, null, headers, 3);
 
         writeFrame(headersFrameHeader, headersPayload);
 
@@ -337,7 +315,7 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
         byte[] headersFrameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
 
-        buildGetRequest(headersFrameHeader, headersPayload, null, headers , 3);
+        buildGetRequest(headersFrameHeader, headersPayload, null, headers, 3);
 
         writeFrame(headersFrameHeader, headersPayload);
 
@@ -399,7 +377,7 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
         byte[] headersFrameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
 
-        buildGetRequest(headersFrameHeader, headersPayload, null, headers , 3);
+        buildGetRequest(headersFrameHeader, headersPayload, null, headers, 3);
 
         writeFrame(headersFrameHeader, headersPayload);
 
@@ -419,7 +397,7 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
         byte[] headersFrameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
 
-        buildGetRequest(headersFrameHeader, headersPayload, null, headers , 3);
+        buildGetRequest(headersFrameHeader, headersPayload, null, headers, 3);
 
         // Write the headers
         writeFrame(headersFrameHeader, headersPayload);
@@ -448,7 +426,7 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
         byte[] headersFrameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
 
-        buildGetRequest(headersFrameHeader, headersPayload, null, headers , 3);
+        buildGetRequest(headersFrameHeader, headersPayload, null, headers, 3);
 
         writeFrame(headersFrameHeader, headersPayload);
 
diff --git a/test/org/apache/coyote/http2/TestHttp2Timeouts.java b/test/org/apache/coyote/http2/TestHttp2Timeouts.java
index 3768b5888e..4456b704bd 100644
--- a/test/org/apache/coyote/http2/TestHttp2Timeouts.java
+++ b/test/org/apache/coyote/http2/TestHttp2Timeouts.java
@@ -30,8 +30,7 @@ public class TestHttp2Timeouts extends Http2TestBase {
 
 
     /*
-     * Simple request won't fill buffer so timeout will occur in Tomcat internal
-     * code during response completion.
+     * Simple request won't fill buffer so timeout will occur in Tomcat internal code during response completion.
      */
     @Test
     public void testClientWithEmptyWindow() throws Exception {
@@ -51,9 +50,8 @@ public class TestHttp2Timeouts extends Http2TestBase {
 
 
     /*
-     * Large request will fill buffer so timeout will occur in application code
-     * during response write (when Tomcat commits the response and flushes the
-     * buffer as a result of the buffer filling).
+     * Large request will fill buffer so timeout will occur in application code during response write (when Tomcat
+     * commits the response and flushes the buffer as a result of the buffer filling).
      */
     @Test
     public void testClientWithEmptyWindowLargeResponse() throws Exception {
@@ -77,7 +75,7 @@ public class TestHttp2Timeouts extends Http2TestBase {
      */
     @Test
     public void testClientPostsNoBody() throws Exception {
-        sendSimplePostRequest(3,  null,  false);
+        sendSimplePostRequest(3, null, false);
 
         // Headers
         parser.readFrame();
diff --git a/test/org/apache/coyote/http2/TestHttp2UpgradeHandler.java b/test/org/apache/coyote/http2/TestHttp2UpgradeHandler.java
index b4565c7c72..da7f9da4c3 100644
--- a/test/org/apache/coyote/http2/TestHttp2UpgradeHandler.java
+++ b/test/org/apache/coyote/http2/TestHttp2UpgradeHandler.java
@@ -58,15 +58,9 @@ public class TestHttp2UpgradeHandler extends Http2TestBase {
         // Body
         parser.readFrame();
 
-        Assert.assertEquals(
-                "3-HeadersStart\n" +
-                "3-Header-[:status]-[200]\n" +
-                "3-Header-[x-ignore]-[...]\n" +
-                "3-Header-[content-type]-[text/plain;charset=UTF-8]\n" +
-                "3-Header-[content-length]-[2]\n" +
-                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                "3-HeadersEnd\n" +
-                "3-Body-2\n" +
+        Assert.assertEquals("3-HeadersStart\n" + "3-Header-[:status]-[200]\n" + "3-Header-[x-ignore]-[...]\n" +
+                "3-Header-[content-type]-[text/plain;charset=UTF-8]\n" + "3-Header-[content-length]-[2]\n" +
+                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "3-HeadersEnd\n" + "3-Body-2\n" +
                 "3-EndOfStream\n", output.getTrace());
     }
 
@@ -136,14 +130,9 @@ public class TestHttp2UpgradeHandler extends Http2TestBase {
 
         openClientConnection();
 
-        byte[] upgradeRequest = ((usePost ? "POST" : "GET") +
-                " /" + (useReader ? "?useReader=true " : " ") + "HTTP/1.1\r\n" +
-                "Host: localhost:" + getPort() + "\r\n" +
-                "Content-Length: 18\r\n" +
-                "Connection: Upgrade,HTTP2-Settings\r\n" +
-                "Upgrade: h2c\r\n" +
-                EMPTY_HTTP2_SETTINGS_HEADER +
-                "\r\n" +
+        byte[] upgradeRequest = ((usePost ? "POST" : "GET") + " /" + (useReader ? "?useReader=true " : " ") +
+                "HTTP/1.1\r\n" + "Host: localhost:" + getPort() + "\r\n" + "Content-Length: 18\r\n" +
+                "Connection: Upgrade,HTTP2-Settings\r\n" + "Upgrade: h2c\r\n" + EMPTY_HTTP2_SETTINGS_HEADER + "\r\n" +
                 "Small request body").getBytes(StandardCharsets.ISO_8859_1);
         os.write(upgradeRequest);
         os.flush();
@@ -171,19 +160,11 @@ public class TestHttp2UpgradeHandler extends Http2TestBase {
             parser.readFrame();
             parser.readFrame();
 
-            Assert.assertEquals("0-Settings-[3]-[200]\n" +
-                    "0-Settings-End\n" +
-                    "0-Settings-Ack\n" +
-                    "0-Ping-[0,0,0,0,0,0,0,1]\n" +
-                    "1-HeadersStart\n" +
-                    "1-Header-[:status]-[200]\n" +
-                    "1-Header-[content-type]-[text/plain;charset=UTF-8]\n" +
-                    "1-Header-[content-length]-[39]\n" +
-                    "1-Header-[date]-[" + DEFAULT_DATE + "]\n" +
-                    "1-HeadersEnd\n" +
-                    "1-Body-39\n" +
-                    "1-EndOfStream\n"
-                    , output.getTrace());
+            Assert.assertEquals("0-Settings-[3]-[200]\n" + "0-Settings-End\n" + "0-Settings-Ack\n" +
+                    "0-Ping-[0,0,0,0,0,0,0,1]\n" + "1-HeadersStart\n" + "1-Header-[:status]-[200]\n" +
+                    "1-Header-[content-type]-[text/plain;charset=UTF-8]\n" + "1-Header-[content-length]-[39]\n" +
+                    "1-Header-[date]-[" + DEFAULT_DATE + "]\n" + "1-HeadersEnd\n" + "1-Body-39\n" + "1-EndOfStream\n",
+                    output.getTrace());
         }
     }
 
@@ -222,9 +203,8 @@ public class TestHttp2UpgradeHandler extends Http2TestBase {
 
             // 500 response (triggered by IOException trying to read body that never arrived)
             parser.readFrame();
-            Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
-                    stream + "-HeadersStart\n" +
-                    stream + "-Header-[:status]-[500]\n"));
+            Assert.assertTrue(output.getTrace(),
+                    output.getTrace().startsWith(stream + "-HeadersStart\n" + stream + "-Header-[:status]-[500]\n"));
             output.clearTrace();
 
             // reset frame
diff --git a/test/org/apache/coyote/http2/TestLargeUpload.java b/test/org/apache/coyote/http2/TestLargeUpload.java
index e52cbdc84d..886f55350a 100644
--- a/test/org/apache/coyote/http2/TestLargeUpload.java
+++ b/test/org/apache/coyote/http2/TestLargeUpload.java
@@ -54,15 +54,12 @@ public class TestLargeUpload extends Http2TestBase {
 
         List<Object[]> parameterSets = new ArrayList<>();
         for (Object[] base : baseData) {
-            parameterSets.add(new Object[] {
-                    base[0], base[1],
-                    "JSSE", Boolean.FALSE, "org.apache.tomcat.util.net.jsse.JSSEImplementation"});
-            parameterSets.add(new Object[] {
-                    base[0], base[1],
-                    "OpenSSL", Boolean.TRUE, "org.apache.tomcat.util.net.openssl.OpenSSLImplementation"});
-            parameterSets.add(new Object[] {
-                    base[0], base[1],
-                    "OpenSSL-Panama", Boolean.FALSE, "org.apache.tomcat.util.net.openssl.panama.OpenSSLImplementation"});
+            parameterSets.add(new Object[] { base[0], base[1], "JSSE", Boolean.FALSE,
+                    "org.apache.tomcat.util.net.jsse.JSSEImplementation" });
+            parameterSets.add(new Object[] { base[0], base[1], "OpenSSL", Boolean.TRUE,
+                    "org.apache.tomcat.util.net.openssl.OpenSSLImplementation" });
+            parameterSets.add(new Object[] { base[0], base[1], "OpenSSL-Panama", Boolean.FALSE,
+                    "org.apache.tomcat.util.net.openssl.panama.OpenSSLImplementation" });
         }
 
         return parameterSets;
@@ -98,8 +95,8 @@ public class TestLargeUpload extends Http2TestBase {
         byte[] trailerFrameHeader = new byte[9];
         ByteBuffer trailerPayload = ByteBuffer.allocate(256);
 
-        buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader, dataPayload,
-                null, trailerFrameHeader, trailerPayload, 3);
+        buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader, dataPayload, null,
+                trailerFrameHeader, trailerPayload, 3);
 
         // Write the headers
         writeFrame(headersFrameHeader, headersPayload);
diff --git a/test/org/apache/coyote/http2/TestStream.java b/test/org/apache/coyote/http2/TestStream.java
index 6cdb581d58..83dc31479f 100644
--- a/test/org/apache/coyote/http2/TestStream.java
+++ b/test/org/apache/coyote/http2/TestStream.java
@@ -60,20 +60,14 @@ public class TestStream extends Http2TestBase {
 
         byte[] frameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
-        buildGetRequest(frameHeader, headersPayload, null, 3,
-                "/pathparam;jsessionid=" + PathParam.EXPECTED_SESSION_ID);
+        buildGetRequest(frameHeader, headersPayload, null, 3, "/pathparam;jsessionid=" + PathParam.EXPECTED_SESSION_ID);
         writeFrame(frameHeader, headersPayload);
 
         readSimpleGetResponse();
 
-        Assert.assertEquals(
-                "3-HeadersStart\n" +
-                "3-Header-[:status]-[200]\n" +
-                "3-Header-[content-type]-[text/plain;charset=UTF-8]\n" +
-                "3-Header-[content-length]-[2]\n" +
-                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                "3-HeadersEnd\n" +
-                "3-Body-2\n" +
+        Assert.assertEquals("3-HeadersStart\n" + "3-Header-[:status]-[200]\n" +
+                "3-Header-[content-type]-[text/plain;charset=UTF-8]\n" + "3-Header-[content-length]-[2]\n" +
+                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "3-HeadersEnd\n" + "3-Body-2\n" +
                 "3-EndOfStream\n", output.getTrace());
     }
 
@@ -111,18 +105,12 @@ public class TestStream extends Http2TestBase {
         parser.readFrame();
 
         Assert.assertEquals(
-                "3-HeadersStart\n" +
-                "3-Header-[:status]-[200]\n" +
-                "3-Header-[content-type]-[text/plain;charset=UTF-8]\n" +
-                "3-Header-[content-length]-[44]\n" +
-                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                "3-HeadersEnd\n" +
-                "3-Body-44\n" +
-                "3-HeadersStart\n" +
-                "3-Header-[x-trailer-2]-[Trailer value two]\n" +
-                "3-Header-[x-trailer-1]-[Trailer value one]\n" +
-                "3-HeadersEnd\n" +
-                "3-EndOfStream\n", output.getTrace());
+                "3-HeadersStart\n" + "3-Header-[:status]-[200]\n" +
+                        "3-Header-[content-type]-[text/plain;charset=UTF-8]\n" + "3-Header-[content-length]-[44]\n" +
+                        "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "3-HeadersEnd\n" + "3-Body-44\n" +
+                        "3-HeadersStart\n" + "3-Header-[x-trailer-2]-[Trailer value two]\n" +
+                        "3-Header-[x-trailer-1]-[Trailer value one]\n" + "3-HeadersEnd\n" + "3-EndOfStream\n",
+                output.getTrace());
     }
 
 
diff --git a/test/org/apache/coyote/http2/TestStreamProcessor.java b/test/org/apache/coyote/http2/TestStreamProcessor.java
index 78e84bb57f..4231fd3f3f 100644
--- a/test/org/apache/coyote/http2/TestStreamProcessor.java
+++ b/test/org/apache/coyote/http2/TestStreamProcessor.java
@@ -74,14 +74,9 @@ public class TestStreamProcessor extends Http2TestBase {
         // additional frame needs to be read
         parser.readFrame();
 
-        Assert.assertEquals(
-                "3-HeadersStart\n" +
-                "3-Header-[:status]-[200]\n" +
+        Assert.assertEquals("3-HeadersStart\n" + "3-Header-[:status]-[200]\n" +
                 "3-Header-[content-type]-[text/plain;charset=UTF-8]\n" +
-                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                "3-HeadersEnd\n" +
-                "3-Body-17\n" +
-                "3-Body-8\n" +
+                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "3-HeadersEnd\n" + "3-Body-17\n" + "3-Body-8\n" +
                 "3-EndOfStream\n", output.getTrace());
     }
 
@@ -539,15 +534,9 @@ public class TestStreamProcessor extends Http2TestBase {
 
         readSimpleGetResponse();
 
-        Assert.assertEquals(
-                "3-HeadersStart\n" +
-                "3-Header-[:status]-[200]\n" +
-                "3-Header-[vary]-[accept-encoding]\n" +
-                "3-Header-[content-encoding]-[gzip]\n" +
-                "3-Header-[content-type]-[text/plain;charset=UTF-8]\n" +
-                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                "3-HeadersEnd\n" +
-                "3-Body-97\n" +
+        Assert.assertEquals("3-HeadersStart\n" + "3-Header-[:status]-[200]\n" + "3-Header-[vary]-[accept-encoding]\n" +
+                "3-Header-[content-encoding]-[gzip]\n" + "3-Header-[content-type]-[text/plain;charset=UTF-8]\n" +
+                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "3-HeadersEnd\n" + "3-Body-97\n" +
                 "3-EndOfStream\n", output.getTrace());
     }
 
@@ -557,8 +546,7 @@ public class TestStreamProcessor extends Http2TestBase {
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             // Generate content type that is compressible
             resp.setContentType("text/plain");
             resp.setCharacterEncoding("UTF-8");
@@ -589,7 +577,7 @@ public class TestStreamProcessor extends Http2TestBase {
         byte[] headersFrameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
 
-        buildGetRequest(headersFrameHeader, headersPayload, null, headers , 3);
+        buildGetRequest(headersFrameHeader, headersPayload, null, headers, 3);
 
         writeFrame(headersFrameHeader, headersPayload);
 
diff --git a/test/org/apache/coyote/http2/TestStreamQueryString.java b/test/org/apache/coyote/http2/TestStreamQueryString.java
index be10725426..07dd93e66c 100644
--- a/test/org/apache/coyote/http2/TestStreamQueryString.java
+++ b/test/org/apache/coyote/http2/TestStreamQueryString.java
@@ -55,9 +55,7 @@ public class TestStreamQueryString extends Http2TestBase {
         for (Object[] base : baseData) {
             // Test ASCII characters from 32 to 126 inclusive
             for (int i = 32; i < 128; i++) {
-                result.add(new Object[] {
-                        base[0], base[1],
-                       "%" + HexUtils.toHexString(new byte[] { (byte) i})});
+                result.add(new Object[] { base[0], base[1], "%" + HexUtils.toHexString(new byte[] { (byte) i }) });
             }
         }
 
@@ -89,36 +87,28 @@ public class TestStreamQueryString extends Http2TestBase {
 
         byte[] frameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
-        buildGetRequest(frameHeader, headersPayload, null, 3,
-                "/query?" + Query.PARAM_NAME + "=" + queryValue);
+        buildGetRequest(frameHeader, headersPayload, null, 3, "/query?" + Query.PARAM_NAME + "=" + queryValue);
         writeFrame(frameHeader, headersPayload);
 
         readSimpleGetResponse();
 
         Assert.assertEquals(queryValue,
-                "3-HeadersStart\n" +
-                "3-Header-[:status]-[200]\n" +
-                "3-Header-[content-type]-[text/plain;charset=UTF-8]\n" +
-                "3-Header-[content-length]-[2]\n" +
-                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                "3-HeadersEnd\n" +
-                "3-Body-2\n" +
-                "3-EndOfStream\n", output.getTrace());
+                "3-HeadersStart\n" + "3-Header-[:status]-[200]\n" +
+                        "3-Header-[content-type]-[text/plain;charset=UTF-8]\n" + "3-Header-[content-length]-[2]\n" +
+                        "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "3-HeadersEnd\n" + "3-Body-2\n" +
+                        "3-EndOfStream\n",
+                output.getTrace());
     }
 
 
     protected void doHttpUpgrade(String queryValue) throws IOException {
         byte[] upgradeRequest = ("GET /query?" + Query.PARAM_NAME + "=" + queryValue + " HTTP/1.1\r\n" +
-                "Host: localhost:" + getPort() + "\r\n" +
-                "Connection: "+ DEFAULT_CONNECTION_HEADER_VALUE + "\r\n" +
-                "Upgrade: h2c\r\n" +
-                EMPTY_HTTP2_SETTINGS_HEADER +
-                "\r\n").getBytes(StandardCharsets.ISO_8859_1);
+                "Host: localhost:" + getPort() + "\r\n" + "Connection: " + DEFAULT_CONNECTION_HEADER_VALUE + "\r\n" +
+                "Upgrade: h2c\r\n" + EMPTY_HTTP2_SETTINGS_HEADER + "\r\n").getBytes(StandardCharsets.ISO_8859_1);
         os.write(upgradeRequest);
         os.flush();
 
-        Assert.assertTrue("Failed to read HTTP Upgrade response",
-                readHttpUpgradeResponse());
+        Assert.assertTrue("Failed to read HTTP Upgrade response", readHttpUpgradeResponse());
     }
 
 
@@ -137,17 +127,10 @@ public class TestStreamQueryString extends Http2TestBase {
         parser.readFrame();
         parser.readFrame();
 
-        Assert.assertEquals("0-Settings-[3]-[200]\n" +
-                "0-Settings-End\n" +
-                "0-Settings-Ack\n" +
-                "0-Ping-[0,0,0,0,0,0,0,1]\n" +
-                "1-HeadersStart\n" +
-                "1-Header-[:status]-[200]\n" +
-                "1-Header-[content-type]-[text/plain;charset=UTF-8]\n" +
-                "1-Header-[content-length]-[2]\n" +
-                "1-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                "1-HeadersEnd\n" +
-                "1-Body-2\n" +
+        Assert.assertEquals("0-Settings-[3]-[200]\n" + "0-Settings-End\n" + "0-Settings-Ack\n" +
+                "0-Ping-[0,0,0,0,0,0,0,1]\n" + "1-HeadersStart\n" + "1-Header-[:status]-[200]\n" +
+                "1-Header-[content-type]-[text/plain;charset=UTF-8]\n" + "1-Header-[content-length]-[2]\n" +
+                "1-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" + "1-HeadersEnd\n" + "1-Body-2\n" +
                 "1-EndOfStream\n", output.getTrace());
 
         output.clearTrace();
diff --git a/test/org/apache/coyote/http2/TesterHttp2Parser.java b/test/org/apache/coyote/http2/TesterHttp2Parser.java
index ee0a4b3b1d..3b4f10af39 100644
--- a/test/org/apache/coyote/http2/TesterHttp2Parser.java
+++ b/test/org/apache/coyote/http2/TesterHttp2Parser.java
@@ -37,8 +37,7 @@ public class TesterHttp2Parser extends Http2Parser {
     /**
      * {@inheritDoc}
      * <p>
-     * <b>Note:</b> The test implementation always uses blocking IO for both the
-     * initial read and the remainder.
+     * <b>Note:</b> The test implementation always uses blocking IO for both the initial read and the remainder.
      */
     @Override
     public boolean readFrame() throws Http2Exception, IOException {
@@ -46,7 +45,8 @@ public class TesterHttp2Parser extends Http2Parser {
     }
 
     @Override
-    protected void readPushPromiseFrame(int streamId, int flags, int payloadSize, ByteBuffer buffer) throws Http2Exception, IOException {
+    protected void readPushPromiseFrame(int streamId, int flags, int payloadSize, ByteBuffer buffer)
+            throws Http2Exception, IOException {
 
         // Parse flags used in this method
         boolean hasPadding = Flags.hasPadding(flags);


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


[tomcat] 04/06: Clean-up - formatting. No functional change.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit dbb979a15f89038cce380ed721bca8140d1c8078
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Feb 23 16:49:36 2023 +0000

    Clean-up - formatting. No functional change.
---
 .../coyote/http11/AbstractHttp11JsseProtocol.java  |  27 ++-
 .../coyote/http11/AbstractHttp11Protocol.java      | 251 +++++++++++++--------
 .../coyote/http11/HeadersTooLargeException.java    |   3 +-
 .../apache/coyote/http11/Http11InputBuffer.java    | 165 ++++++--------
 .../apache/coyote/http11/Http11Nio2Protocol.java   |   6 +-
 .../apache/coyote/http11/Http11NioProtocol.java    |  14 +-
 .../apache/coyote/http11/Http11OutputBuffer.java   |  95 ++++----
 java/org/apache/coyote/http11/Http11Processor.java | 164 ++++++--------
 .../org/apache/coyote/http11/HttpOutputBuffer.java |   5 +-
 java/org/apache/coyote/http11/InputFilter.java     |  15 +-
 java/org/apache/coyote/http11/OutputFilter.java    |   5 +-
 11 files changed, 380 insertions(+), 370 deletions(-)

diff --git a/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java b/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java
index d8241a6bac..6f6fff40e8 100644
--- a/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java
+++ b/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java
@@ -19,18 +19,17 @@ package org.apache.coyote.http11;
 import org.apache.tomcat.util.net.AbstractJsseEndpoint;
 import org.apache.tomcat.util.net.openssl.OpenSSLImplementation;
 
-public abstract class AbstractHttp11JsseProtocol<S>
-        extends AbstractHttp11Protocol<S> {
+public abstract class AbstractHttp11JsseProtocol<S> extends AbstractHttp11Protocol<S> {
 
-    public AbstractHttp11JsseProtocol(AbstractJsseEndpoint<S,?> endpoint) {
+    public AbstractHttp11JsseProtocol(AbstractJsseEndpoint<S, ?> endpoint) {
         super(endpoint);
     }
 
 
     @Override
-    protected AbstractJsseEndpoint<S,?> getEndpoint() {
+    protected AbstractJsseEndpoint<S, ?> getEndpoint() {
         // Over-ridden to add cast
-        return (AbstractJsseEndpoint<S,?>) super.getEndpoint();
+        return (AbstractJsseEndpoint<S, ?>) super.getEndpoint();
     }
 
 
@@ -38,18 +37,26 @@ public abstract class AbstractHttp11JsseProtocol<S>
         if (OpenSSLImplementation.class.getName().equals(getSslImplementationName())) {
             return "openssl";
         }
-        if (getSslImplementationName() != null
-                && getSslImplementationName().endsWith(".panama.OpenSSLImplementation")) {
+        if (getSslImplementationName() != null &&
+                getSslImplementationName().endsWith(".panama.OpenSSLImplementation")) {
             return "opensslforeign";
         }
         return "jsse";
     }
 
-    public String getSslImplementationName() { return getEndpoint().getSslImplementationName(); }
-    public void setSslImplementationName(String s) { getEndpoint().setSslImplementationName(s); }
+    public String getSslImplementationName() {
+        return getEndpoint().getSslImplementationName();
+    }
+
+    public void setSslImplementationName(String s) {
+        getEndpoint().setSslImplementationName(s);
+    }
 
 
-    public int getSniParseLimit() { return getEndpoint().getSniParseLimit(); }
+    public int getSniParseLimit() {
+        return getEndpoint().getSniParseLimit();
+    }
+
     public void setSniParseLimit(int sniParseLimit) {
         getEndpoint().setSniParseLimit(sniParseLimit);
     }
diff --git a/java/org/apache/coyote/http11/AbstractHttp11Protocol.java b/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
index ab74a5434d..a8fab9554d 100644
--- a/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
+++ b/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
@@ -54,13 +54,12 @@ import org.apache.tomcat.util.res.StringManager;
 
 public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
 
-    protected static final StringManager sm =
-            StringManager.getManager(AbstractHttp11Protocol.class);
+    protected static final StringManager sm = StringManager.getManager(AbstractHttp11Protocol.class);
 
     private final CompressionConfig compressionConfig = new CompressionConfig();
 
 
-    public AbstractHttp11Protocol(AbstractEndpoint<S,?> endpoint) {
+    public AbstractHttp11Protocol(AbstractEndpoint<S, ?> endpoint) {
         super(endpoint);
         setConnectionTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
     }
@@ -116,7 +115,7 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
      * Over-ridden here to make the method visible to nested classes.
      */
     @Override
-    protected AbstractEndpoint<S,?> getEndpoint() {
+    protected AbstractEndpoint<S, ?> getEndpoint() {
         return super.getEndpoint();
     }
 
@@ -125,61 +124,70 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
     // ------------------------------------------ managed in the ProtocolHandler
 
     private ContinueResponseTiming continueResponseTiming = ContinueResponseTiming.IMMEDIATELY;
+
     public String getContinueResponseTiming() {
         return continueResponseTiming.toString();
     }
+
     public void setContinueResponseTiming(String continueResponseTiming) {
         this.continueResponseTiming = ContinueResponseTiming.fromString(continueResponseTiming);
     }
+
     public ContinueResponseTiming getContinueResponseTimingInternal() {
         return continueResponseTiming;
     }
 
 
     private boolean useKeepAliveResponseHeader = true;
+
     public boolean getUseKeepAliveResponseHeader() {
         return useKeepAliveResponseHeader;
     }
+
     public void setUseKeepAliveResponseHeader(boolean useKeepAliveResponseHeader) {
         this.useKeepAliveResponseHeader = useKeepAliveResponseHeader;
     }
 
 
     private String relaxedPathChars = null;
+
     public String getRelaxedPathChars() {
         return relaxedPathChars;
     }
+
     public void setRelaxedPathChars(String relaxedPathChars) {
         this.relaxedPathChars = relaxedPathChars;
     }
 
 
     private String relaxedQueryChars = null;
+
     public String getRelaxedQueryChars() {
         return relaxedQueryChars;
     }
+
     public void setRelaxedQueryChars(String relaxedQueryChars) {
         this.relaxedQueryChars = relaxedQueryChars;
     }
 
 
     private boolean allowHostHeaderMismatch = false;
+
     /**
-     * Will Tomcat accept an HTTP 1.1 request where the host header does not
-     * agree with the host specified (if any) in the request line?
+     * Will Tomcat accept an HTTP 1.1 request where the host header does not agree with the host specified (if any) in
+     * the request line?
      *
-     * @return {@code true} if Tomcat will allow such requests, otherwise
-     *         {@code false}
+     * @return {@code true} if Tomcat will allow such requests, otherwise {@code false}
      */
     public boolean getAllowHostHeaderMismatch() {
         return allowHostHeaderMismatch;
     }
+
     /**
-     * Will Tomcat accept an HTTP 1.1 request where the host header does not
-     * agree with the host specified (if any) in the request line?
+     * Will Tomcat accept an HTTP 1.1 request where the host header does not agree with the host specified (if any) in
+     * the request line?
      *
-     * @param allowHostHeaderMismatch {@code true} to allow such requests,
-     *                                {@code false} to reject them with a 400
+     * @param allowHostHeaderMismatch {@code true} to allow such requests, {@code false} to reject them with a 400
      */
     public void setAllowHostHeaderMismatch(boolean allowHostHeaderMismatch) {
         this.allowHostHeaderMismatch = allowHostHeaderMismatch;
@@ -187,23 +195,23 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
 
 
     private boolean rejectIllegalHeader = true;
+
     /**
-     * If an HTTP request is received that contains an illegal header name or
-     * value (e.g. the header name is not a token) will the request be rejected
-     * (with a 400 response) or will the illegal header be ignored?
+     * If an HTTP request is received that contains an illegal header name or value (e.g. the header name is not a
+     * token) will the request be rejected (with a 400 response) or will the illegal header be ignored?
      *
-     * @return {@code true} if the request will be rejected or {@code false} if
-     *         the header will be ignored
+     * @return {@code true} if the request will be rejected or {@code false} if the header will be ignored
      */
-    public boolean getRejectIllegalHeader() { return rejectIllegalHeader; }
+    public boolean getRejectIllegalHeader() {
+        return rejectIllegalHeader;
+    }
+
     /**
-     * If an HTTP request is received that contains an illegal header name or
-     * value (e.g. the header name is not a token) should the request be
-     * rejected (with a 400 response) or should the illegal header be ignored?
+     * If an HTTP request is received that contains an illegal header name or value (e.g. the header name is not a
+     * token) should the request be rejected (with a 400 response) or should the illegal header be ignored?
      *
-     * @param rejectIllegalHeader   {@code true} to reject requests with illegal
-     *                              header names or values, {@code false} to
-     *                              ignore the header
+     * @param rejectIllegalHeader {@code true} to reject requests with illegal header names or values, {@code false} to
+     *                                ignore the header
      */
     public void setRejectIllegalHeader(boolean rejectIllegalHeader) {
         this.rejectIllegalHeader = rejectIllegalHeader;
@@ -211,19 +219,20 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
 
 
     private int maxSavePostSize = 4 * 1024;
+
     /**
-     * Return the maximum size of the post which will be saved during FORM or
-     * CLIENT-CERT authentication.
+     * Return the maximum size of the post which will be saved during FORM or CLIENT-CERT authentication.
      *
      * @return The size in bytes
      */
-    public int getMaxSavePostSize() { return maxSavePostSize; }
+    public int getMaxSavePostSize() {
+        return maxSavePostSize;
+    }
+
     /**
-     * Set the maximum size of a POST which will be buffered during FORM or
-     * CLIENT-CERT authentication. When a POST is received where the security
-     * constraints require a client certificate, the POST body needs to be
-     * buffered while an SSL handshake takes place to obtain the certificate. A
-     * similar buffering is required during FORM auth.
+     * Set the maximum size of a POST which will be buffered during FORM or CLIENT-CERT authentication. When a POST is
+     * received where the security constraints require a client certificate, the POST body needs to be buffered while an
+     * SSL handshake takes place to obtain the certificate. A similar buffering is required during FORM auth.
      *
      * @param maxSavePostSize The maximum size POST body to buffer in bytes
      */
@@ -236,8 +245,14 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
      * Maximum size of the HTTP message header.
      */
     private int maxHttpHeaderSize = 8 * 1024;
-    public int getMaxHttpHeaderSize() { return maxHttpHeaderSize; }
-    public void setMaxHttpHeaderSize(int valueI) { maxHttpHeaderSize = valueI; }
+
+    public int getMaxHttpHeaderSize() {
+        return maxHttpHeaderSize;
+    }
+
+    public void setMaxHttpHeaderSize(int valueI) {
+        maxHttpHeaderSize = valueI;
+    }
 
 
     /**
@@ -269,13 +284,17 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
 
 
     private int connectionUploadTimeout = 300000;
+
     /**
-     * Specifies a different (usually longer) connection timeout during data
-     * upload. Default is 5 minutes as in Apache HTTPD server.
+     * Specifies a different (usually longer) connection timeout during data upload. Default is 5 minutes as in Apache
+     * HTTPD server.
      *
      * @return The timeout in milliseconds
      */
-    public int getConnectionUploadTimeout() { return connectionUploadTimeout; }
+    public int getConnectionUploadTimeout() {
+        return connectionUploadTimeout;
+    }
+
     /**
      * Set the upload timeout.
      *
@@ -287,20 +306,21 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
 
 
     private boolean disableUploadTimeout = true;
+
     /**
-     * Get the flag that controls upload time-outs. If true, the
-     * connectionUploadTimeout will be ignored and the regular socket timeout
-     * will be used for the full duration of the connection.
+     * Get the flag that controls upload time-outs. If true, the connectionUploadTimeout will be ignored and the regular
+     * socket timeout will be used for the full duration of the connection.
      *
      * @return {@code true} if the separate upload timeout is disabled
      */
-    public boolean getDisableUploadTimeout() { return disableUploadTimeout; }
+    public boolean getDisableUploadTimeout() {
+        return disableUploadTimeout;
+    }
+
     /**
-     * Set the flag to control whether a separate connection timeout is used
-     * during upload of a request body.
+     * Set the flag to control whether a separate connection timeout is used during upload of a request body.
      *
-     * @param isDisabled {@code true} if the separate upload timeout should be
-     *                   disabled
+     * @param isDisabled {@code true} if the separate upload timeout should be disabled
      */
     public void setDisableUploadTimeout(boolean isDisabled) {
         disableUploadTimeout = isDisabled;
@@ -310,9 +330,11 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
     public void setCompression(String compression) {
         compressionConfig.setCompression(compression);
     }
+
     public String getCompression() {
         return compressionConfig.getCompression();
     }
+
     protected int getCompressionLevel() {
         return compressionConfig.getCompressionLevel();
     }
@@ -321,9 +343,11 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
     public String getNoCompressionUserAgents() {
         return compressionConfig.getNoCompressionUserAgents();
     }
+
     protected Pattern getNoCompressionUserAgentsPattern() {
         return compressionConfig.getNoCompressionUserAgentsPattern();
     }
+
     public void setNoCompressionUserAgents(String noCompressionUserAgents) {
         compressionConfig.setNoCompressionUserAgents(noCompressionUserAgents);
     }
@@ -332,9 +356,11 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
     public String getCompressibleMimeType() {
         return compressionConfig.getCompressibleMimeType();
     }
+
     public void setCompressibleMimeType(String valueS) {
         compressionConfig.setCompressibleMimeType(valueS);
     }
+
     public String[] getCompressibleMimeTypes() {
         return compressionConfig.getCompressibleMimeTypes();
     }
@@ -343,6 +369,7 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
     public int getCompressionMinSize() {
         return compressionConfig.getCompressionMinSize();
     }
+
     public void setCompressionMinSize(int compressionMinSize) {
         compressionConfig.setCompressionMinSize(compressionMinSize);
     }
@@ -354,9 +381,10 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
 
 
     private Pattern restrictedUserAgents = null;
+
     /**
-     * Get the string form of the regular expression that defines the User
-     * agents which should be restricted to HTTP/1.0 support.
+     * Get the string form of the regular expression that defines the User agents which should be restricted to HTTP/1.0
+     * support.
      *
      * @return The regular expression as a String
      */
@@ -367,16 +395,17 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
             return restrictedUserAgents.toString();
         }
     }
+
     protected Pattern getRestrictedUserAgentsPattern() {
         return restrictedUserAgents;
     }
+
     /**
-     * Set restricted user agent list (which will downgrade the connector
-     * to HTTP/1.0 mode). Regular expression as supported by {@link Pattern}.
+     * Set restricted user agent list (which will downgrade the connector to HTTP/1.0 mode). Regular expression as
+     * supported by {@link Pattern}.
      *
-     * @param restrictedUserAgents The regular expression as supported by
-     *                             {@link Pattern} for the user agents e.g.
-     *                             "gorilla|desesplorer|tigrus"
+     * @param restrictedUserAgents The regular expression as supported by {@link Pattern} for the user agents e.g.
+     *                                 "gorilla|desesplorer|tigrus"
      */
     public void setRestrictedUserAgents(String restrictedUserAgents) {
         if (restrictedUserAgents == null || restrictedUserAgents.length() == 0) {
@@ -388,7 +417,11 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
 
 
     private String server;
-    public String getServer() { return server; }
+
+    public String getServer() {
+        return server;
+    }
+
     /**
      * Set the server header name.
      *
@@ -400,15 +433,17 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
 
 
     private boolean serverRemoveAppProvidedValues = false;
+
     /**
-     * Should application provider values for the HTTP Server header be removed.
-     * Note that if {@link #server} is set, any application provided value will
-     * be over-ridden.
+     * Should application provider values for the HTTP Server header be removed. Note that if {@link #server} is set,
+     * any application provided value will be over-ridden.
      *
-     * @return {@code true} if application provided values should be removed,
-     *         otherwise {@code false}
+     * @return {@code true} if application provided values should be removed, otherwise {@code false}
      */
-    public boolean getServerRemoveAppProvidedValues() { return serverRemoveAppProvidedValues; }
+    public boolean getServerRemoveAppProvidedValues() {
+        return serverRemoveAppProvidedValues;
+    }
+
     public void setServerRemoveAppProvidedValues(boolean serverRemoveAppProvidedValues) {
         this.serverRemoveAppProvidedValues = serverRemoveAppProvidedValues;
     }
@@ -418,7 +453,11 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
      * Maximum size of trailing headers in bytes
      */
     private int maxTrailerSize = 8192;
-    public int getMaxTrailerSize() { return maxTrailerSize; }
+
+    public int getMaxTrailerSize() {
+        return maxTrailerSize;
+    }
+
     public void setMaxTrailerSize(int maxTrailerSize) {
         this.maxTrailerSize = maxTrailerSize;
     }
@@ -428,7 +467,11 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
      * Maximum size of extension information in chunked encoding
      */
     private int maxExtensionSize = 8192;
-    public int getMaxExtensionSize() { return maxExtensionSize; }
+
+    public int getMaxExtensionSize() {
+        return maxExtensionSize;
+    }
+
     public void setMaxExtensionSize(int maxExtensionSize) {
         this.maxExtensionSize = maxExtensionSize;
     }
@@ -438,29 +481,37 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
      * Maximum amount of request body to swallow.
      */
     private int maxSwallowSize = 2 * 1024 * 1024;
-    public int getMaxSwallowSize() { return maxSwallowSize; }
+
+    public int getMaxSwallowSize() {
+        return maxSwallowSize;
+    }
+
     public void setMaxSwallowSize(int maxSwallowSize) {
         this.maxSwallowSize = maxSwallowSize;
     }
 
 
     /**
-     * This field indicates if the protocol is treated as if it is secure. This
-     * normally means https is being used but can be used to fake https e.g
-     * behind a reverse proxy.
+     * This field indicates if the protocol is treated as if it is secure. This normally means https is being used but
+     * can be used to fake https e.g behind a reverse proxy.
      */
     private boolean secure;
-    public boolean getSecure() { return secure; }
+
+    public boolean getSecure() {
+        return secure;
+    }
+
     public void setSecure(boolean b) {
         secure = b;
     }
 
 
     /**
-     * The names of headers that are allowed to be sent via a trailer when using
-     * chunked encoding. They are stored in lower case.
+     * The names of headers that are allowed to be sent via a trailer when using chunked encoding. They are stored in
+     * lower case.
      */
     private Set<String> allowedTrailerHeaders = ConcurrentHashMap.newKeySet();
+
     public void setAllowedTrailerHeaders(String commaSeparatedHeaders) {
         // Jump through some hoops so we don't end up with an empty set while
         // doing updates.
@@ -478,23 +529,28 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
             allowedTrailerHeaders.removeAll(toRemove);
         }
     }
+
     protected Set<String> getAllowedTrailerHeadersInternal() {
         return allowedTrailerHeaders;
     }
+
     public boolean isTrailerHeaderAllowed(String headerName) {
         return allowedTrailerHeaders.contains(headerName);
     }
+
     public String getAllowedTrailerHeaders() {
         // Chances of a change during execution of this line are small enough
         // that a sync is unnecessary.
         List<String> copy = new ArrayList<>(allowedTrailerHeaders);
         return StringUtils.join(copy);
     }
+
     public void addAllowedTrailerHeader(String header) {
         if (header != null) {
             allowedTrailerHeaders.add(header.trim().toLowerCase(Locale.ENGLISH));
         }
     }
+
     public void removeAllowedTrailerHeader(String header) {
         if (header != null) {
             allowedTrailerHeaders.remove(header.trim().toLowerCase(Locale.ENGLISH));
@@ -506,10 +562,12 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
      * The upgrade protocol instances configured.
      */
     private final List<UpgradeProtocol> upgradeProtocols = new ArrayList<>();
+
     @Override
     public void addUpgradeProtocol(UpgradeProtocol upgradeProtocol) {
         upgradeProtocols.add(upgradeProtocol);
     }
+
     @Override
     public UpgradeProtocol[] findUpgradeProtocols() {
         return upgradeProtocols.toArray(new UpgradeProtocol[0]);
@@ -517,15 +575,14 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
 
 
     /**
-     * The protocols that are available via internal Tomcat support for access
-     * via HTTP upgrade.
+     * The protocols that are available via internal Tomcat support for access via HTTP upgrade.
      */
-    private final Map<String,UpgradeProtocol> httpUpgradeProtocols = new HashMap<>();
+    private final Map<String, UpgradeProtocol> httpUpgradeProtocols = new HashMap<>();
     /**
-     * The protocols that are available via internal Tomcat support for access
-     * via ALPN negotiation.
+     * The protocols that are available via internal Tomcat support for access via ALPN negotiation.
      */
-    private final Map<String,UpgradeProtocol> negotiatedProtocols = new HashMap<>();
+    private final Map<String, UpgradeProtocol> negotiatedProtocols = new HashMap<>();
+
     private void configureUpgradeProtocol(UpgradeProtocol upgradeProtocol) {
         // HTTP Upgrade
         String httpUpgradeName = upgradeProtocol.getHttpUpgradeName(getEndpoint().isSSLEnabled());
@@ -533,8 +590,7 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
         if (httpUpgradeName != null && httpUpgradeName.length() > 0) {
             httpUpgradeProtocols.put(httpUpgradeName, upgradeProtocol);
             httpUpgradeConfigured = true;
-            getLog().info(sm.getString("abstractHttp11Protocol.httpUpgradeConfigured",
-                    getName(), httpUpgradeName));
+            getLog().info(sm.getString("abstractHttp11Protocol.httpUpgradeConfigured", getName(), httpUpgradeName));
         }
 
 
@@ -545,8 +601,7 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
             if (getEndpoint().isSSLEnabled()) {
                 negotiatedProtocols.put(alpnName, upgradeProtocol);
                 getEndpoint().addNegotiatedProtocol(alpnName);
-                getLog().info(sm.getString("abstractHttp11Protocol.alpnConfigured",
-                        getName(), alpnName));
+                getLog().info(sm.getString("abstractHttp11Protocol.alpnConfigured", getName(), alpnName));
             } else {
                 if (!httpUpgradeConfigured) {
                     // ALPN is not supported by this connector and the upgrade
@@ -559,10 +614,12 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
             }
         }
     }
+
     @Override
     public UpgradeProtocol getNegotiatedProtocol(String negotiatedName) {
         return negotiatedProtocols.get(negotiatedName);
     }
+
     @Override
     public UpgradeProtocol getUpgradeProtocol(String upgradedName) {
         return httpUpgradeProtocols.get(upgradedName);
@@ -572,12 +629,12 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
     /**
      * Map of upgrade protocol name to {@link UpgradeGroupInfo} instance.
      * <p>
-     * HTTP upgrades via {@link HttpServletRequest#upgrade(Class)} do not have
-     * to depend on an {@code UpgradeProtocol}. To enable basic statistics to be
-     * made available for these protocols, a map of protocol name to
+     * HTTP upgrades via {@link HttpServletRequest#upgrade(Class)} do not have to depend on an {@code UpgradeProtocol}.
+     * To enable basic statistics to be made available for these protocols, a map of protocol name to
      * {@link UpgradeGroupInfo} instances is maintained here.
      */
-    private final Map<String,UpgradeGroupInfo> upgradeProtocolGroupInfos = new ConcurrentHashMap<>();
+    private final Map<String, UpgradeGroupInfo> upgradeProtocolGroupInfos = new ConcurrentHashMap<>();
+
     public UpgradeGroupInfo getUpgradeGroupInfo(String upgradeProtocol) {
         if (upgradeProtocol == null) {
             return null;
@@ -631,28 +688,35 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
     // ------------------------------------------------ HTTP specific properties
     // ------------------------------------------ passed through to the EndPoint
 
-    public boolean isSSLEnabled() { return getEndpoint().isSSLEnabled();}
+    public boolean isSSLEnabled() {
+        return getEndpoint().isSSLEnabled();
+    }
+
     public void setSSLEnabled(boolean SSLEnabled) {
         getEndpoint().setSSLEnabled(SSLEnabled);
     }
 
 
-    public boolean getUseSendfile() { return getEndpoint().getUseSendfile(); }
-    public void setUseSendfile(boolean useSendfile) { getEndpoint().setUseSendfile(useSendfile); }
+    public boolean getUseSendfile() {
+        return getEndpoint().getUseSendfile();
+    }
+
+    public void setUseSendfile(boolean useSendfile) {
+        getEndpoint().setUseSendfile(useSendfile);
+    }
 
 
     /**
-     * @return The maximum number of requests which can be performed over a
-     *         keep-alive connection. The default is the same as for Apache HTTP
-     *         Server (100).
+     * @return The maximum number of requests which can be performed over a keep-alive connection. The default is the
+     *             same as for Apache HTTP Server (100).
      */
     public int getMaxKeepAliveRequests() {
         return getEndpoint().getMaxKeepAliveRequests();
     }
+
     /**
-     * Set the maximum number of Keep-Alive requests to allow.
-     * This is to safeguard from DoS attacks. Setting to a negative
-     * value disables the limit.
+     * Set the maximum number of Keep-Alive requests to allow. This is to safeguard from DoS attacks. Setting to a
+     * negative value disables the limit.
      *
      * @param mkar The new maximum number of Keep-Alive requests allowed
      */
@@ -667,6 +731,7 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
     public String getDefaultSSLHostConfigName() {
         return getEndpoint().getDefaultSSLHostConfigName();
     }
+
     public void setDefaultSSLHostConfigName(String defaultSSLHostConfigName) {
         getEndpoint().setDefaultSSLHostConfigName(defaultSSLHostConfigName);
     }
@@ -704,9 +769,7 @@ public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
 
 
     @Override
-    protected Processor createUpgradeProcessor(
-            SocketWrapperBase<?> socket,
-            UpgradeToken upgradeToken) {
+    protected Processor createUpgradeProcessor(SocketWrapperBase<?> socket, UpgradeToken upgradeToken) {
         HttpUpgradeHandler httpUpgradeHandler = upgradeToken.getHttpUpgradeHandler();
         if (httpUpgradeHandler instanceof InternalHttpUpgradeHandler) {
             return new UpgradeProcessorInternal(socket, upgradeToken, getUpgradeGroupInfo(upgradeToken.getProtocol()));
diff --git a/java/org/apache/coyote/http11/HeadersTooLargeException.java b/java/org/apache/coyote/http11/HeadersTooLargeException.java
index 96d5133259..49001d2240 100644
--- a/java/org/apache/coyote/http11/HeadersTooLargeException.java
+++ b/java/org/apache/coyote/http11/HeadersTooLargeException.java
@@ -17,8 +17,7 @@
 package org.apache.coyote.http11;
 
 /**
- * Exception used to mark the specific error condition of the HTTP headers
- * exceeding the maximum permitted size.
+ * Exception used to mark the specific error condition of the HTTP headers exceeding the maximum permitted size.
  */
 public class HeadersTooLargeException extends IllegalStateException {
 
diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java b/java/org/apache/coyote/http11/Http11InputBuffer.java
index ddd7e2d1e2..e338ef653a 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -36,8 +36,7 @@ import org.apache.tomcat.util.net.SocketWrapperBase;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * InputBuffer for HTTP that provides request header parsing as well as transfer
- * encoding.
+ * InputBuffer for HTTP that provides request header parsing as well as transfer encoding.
  */
 public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler {
 
@@ -51,8 +50,8 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
     private static final StringManager sm = StringManager.getManager(Http11InputBuffer.class);
 
 
-    private static final byte[] CLIENT_PREFACE_START =
-            "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n".getBytes(StandardCharsets.ISO_8859_1);
+    private static final byte[] CLIENT_PREFACE_START = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
+            .getBytes(StandardCharsets.ISO_8859_1);
 
     /**
      * Associated Coyote request.
@@ -87,8 +86,7 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
 
 
     /**
-     * Pos of the end of the header in the buffer, which is also the
-     * start of the body.
+     * Pos of the end of the header in the buffer, which is also the start of the body.
      */
     private int end;
 
@@ -106,8 +104,7 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
 
 
     /**
-     * Filter library.
-     * Note: Filter[Constants.CHUNKED_FILTER] is always the "chunked" filter.
+     * Filter library. Note: Filter[Constants.CHUNKED_FILTER] is always the "chunked" filter.
      */
     private InputFilter[] filterLibrary;
 
@@ -125,8 +122,7 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
 
 
     /**
-     * Parsing state - used for non blocking parsing so that
-     * when more data arrives, we can pick up where we left off.
+     * Parsing state - used for non blocking parsing so that when more data arrives, we can pick up where we left off.
      */
     private byte prevChr = 0;
     private byte chr = 0;
@@ -140,8 +136,7 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
     private final HttpParser httpParser;
 
     /**
-     * Maximum allowed size of the HTTP request line plus headers plus any
-     * leading blank lines.
+     * Maximum allowed size of the HTTP request line plus headers plus any leading blank lines.
      */
     private final int headerBufferSize;
 
@@ -153,8 +148,8 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
 
     // ----------------------------------------------------------- Constructors
 
-    public Http11InputBuffer(Request request, int headerBufferSize,
-            boolean rejectIllegalHeader, HttpParser httpParser) {
+    public Http11InputBuffer(Request request, int headerBufferSize, boolean rejectIllegalHeader,
+            HttpParser httpParser) {
 
         this.request = request;
         headers = request.getMimeHeaders();
@@ -254,8 +249,7 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
     // ------------------------------------------------------- Protected Methods
 
     /**
-     * Recycle the input buffer. This should be called when closing the
-     * connection.
+     * Recycle the input buffer. This should be called when closing the connection.
      */
     void recycle() {
         wrapper = null;
@@ -287,10 +281,8 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
 
 
     /**
-     * End processing of current HTTP request.
-     * Note: All bytes of the current request should have been already
-     * consumed. This method only resets all the pointers so that we are ready
-     * to parse the next HTTP request.
+     * End processing of current HTTP request. Note: All bytes of the current request should have been already consumed.
+     * This method only resets all the pointers so that we are ready to parse the next HTTP request.
      */
     void nextRequest() {
         request.recycle();
@@ -327,19 +319,15 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
 
 
     /**
-     * Read the request line. This function is meant to be used during the
-     * HTTP request header parsing. Do NOT attempt to read the request body
-     * using it.
+     * Read the request line. This function is meant to be used during the HTTP request header parsing. Do NOT attempt
+     * to read the request body using it.
      *
-     * @throws IOException If an exception occurs during the underlying socket
-     * read operations, or if the given buffer is not big enough to accommodate
-     * the whole line.
+     * @throws IOException If an exception occurs during the underlying socket read operations, or if the given buffer
+     *                         is not big enough to accommodate the whole line.
      *
-     * @return true if data is properly fed; false if no data is available
-     * immediately and thread should be freed
+     * @return true if data is properly fed; false if no data is available immediately and thread should be freed
      */
-    boolean parseRequestLine(boolean keptAlive, int connectionTimeout, int keepAliveTimeout)
-            throws IOException {
+    boolean parseRequestLine(boolean keptAlive, int connectionTimeout, int keepAliveTimeout) throws IOException {
 
         // check state
         if (!parsingRequestLine) {
@@ -572,8 +560,7 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
             }
 
             if ((end - parsingRequestLineStart) > 0) {
-                request.protocol().setBytes(byteBuffer.array(), parsingRequestLineStart,
-                        end - parsingRequestLineStart);
+                request.protocol().setBytes(byteBuffer.array(), parsingRequestLineStart, end - parsingRequestLineStart);
                 parsingRequestLinePhase = 7;
             }
             // If no protocol is found, the ISE below will be triggered.
@@ -610,7 +597,8 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
             // limitation to enforce the meaning of headerBufferSize
             // From the way how buf is allocated and how blank lines are being
             // read, it should be enough to check (1) only.
-            if (byteBuffer.position() > headerBufferSize || byteBuffer.capacity() - byteBuffer.position() < socketReadBufferSize) {
+            if (byteBuffer.position() > headerBufferSize ||
+                    byteBuffer.capacity() - byteBuffer.position() < socketReadBufferSize) {
                 throw new IllegalArgumentException(sm.getString("iib.requestheadertoolarge.error"));
             }
         } while (status == HeaderParseStatus.HAVE_MORE_HEADERS);
@@ -635,7 +623,8 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
         while (buffer.hasRemaining() && b != 0x20) {
             b = buffer.get();
         }
-        String result = HeaderUtil.toPrintableString(buffer.array(), buffer.arrayOffset() + startPos, buffer.position() - startPos);
+        String result = HeaderUtil.toPrintableString(buffer.array(), buffer.arrayOffset() + startPos,
+                buffer.position() - startPos);
         if (b != 0x20) {
             // Ran out of buffer rather than found a space
             result = result + "...";
@@ -665,10 +654,8 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
 
 
     /**
-     * Available bytes in the buffers for the current request.
-     *
-     * Note that when requests are pipelined, the data in byteBuffer may relate
-     * to the next request rather than this one.
+     * Available bytes in the buffers for the current request. Note that when requests are pipelined, the data in
+     * byteBuffer may relate to the next request rather than this one.
      */
     int available(boolean read) {
         int available;
@@ -686,10 +673,10 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
         // - the socket wrapper indicates a read is allowed
         //
         // Notes: 1. When pipelined requests are being used available may be
-        //        zero even when byteBuffer has data. This is because the data
-        //        in byteBuffer is for the next request. We don't want to
-        //        attempt a read in this case.
-        //        2. wrapper.hasDataToRead() is present to handle the NIO2 case
+        // zero even when byteBuffer has data. This is because the data
+        // in byteBuffer is for the next request. We don't want to
+        // attempt a read in this case.
+        // 2. wrapper.hasDataToRead() is present to handle the NIO2 case
         try {
             if (available == 0 && read && !byteBuffer.hasRemaining() && wrapper.hasDataToRead()) {
                 fill(false);
@@ -709,9 +696,8 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
 
 
     /**
-     * Has all of the request body been read? There are subtle differences
-     * between this and available() &gt; 0 primarily because of having to handle
-     * faking non-blocking reads with the blocking IO connector.
+     * Has all of the request body been read? There are subtle differences between this and available() &gt; 0 primarily
+     * because of having to handle faking non-blocking reads with the blocking IO connector.
      */
     boolean isFinished() {
         // The active filters have the definitive information on whether or not
@@ -751,8 +737,7 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
         wrapper = socketWrapper;
         wrapper.setAppReadBufHandler(this);
 
-        int bufLength = headerBufferSize +
-                wrapper.getSocketBufferHandler().getReadBuffer().capacity();
+        int bufLength = headerBufferSize + wrapper.getSocketBufferHandler().getReadBuffer().capacity();
         if (byteBuffer == null || byteBuffer.capacity() < bufLength) {
             byteBuffer = ByteBuffer.allocate(bufLength);
             byteBuffer.position(0).limit(0);
@@ -760,25 +745,20 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
     }
 
 
-
     // --------------------------------------------------------- Private Methods
 
     /**
      * Attempts to read some data into the input buffer.
      *
-     * @return <code>true</code> if more data was added to the input buffer
-     *         otherwise <code>false</code>
+     * @return <code>true</code> if more data was added to the input buffer otherwise <code>false</code>
      */
     private boolean fill(boolean block) throws IOException {
 
         if (log.isDebugEnabled()) {
-            log.debug("Before fill(): parsingHeader: [" + parsingHeader +
-                    "], parsingRequestLine: [" + parsingRequestLine +
-                    "], parsingRequestLinePhase: [" + parsingRequestLinePhase +
-                    "], parsingRequestLineStart: [" + parsingRequestLineStart +
-                    "], byteBuffer.position(): [" + byteBuffer.position() +
-                    "], byteBuffer.limit(): [" + byteBuffer.limit() +
-                    "], end: [" + end + "]");
+            log.debug("Before fill(): parsingHeader: [" + parsingHeader + "], parsingRequestLine: [" +
+                    parsingRequestLine + "], parsingRequestLinePhase: [" + parsingRequestLinePhase +
+                    "], parsingRequestLineStart: [" + parsingRequestLineStart + "], byteBuffer.position(): [" +
+                    byteBuffer.position() + "], byteBuffer.limit(): [" + byteBuffer.limit() + "], end: [" + end + "]");
         }
 
         if (parsingHeader) {
@@ -827,8 +807,8 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
         }
 
         if (log.isDebugEnabled()) {
-            log.debug("Received ["
-                    + new String(byteBuffer.array(), byteBuffer.position(), byteBuffer.remaining(), StandardCharsets.ISO_8859_1) + "]");
+            log.debug("Received [" + new String(byteBuffer.array(), byteBuffer.position(), byteBuffer.remaining(),
+                    StandardCharsets.ISO_8859_1) + "]");
         }
 
         if (nRead > 0) {
@@ -845,9 +825,8 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
     /**
      * Parse an HTTP header.
      *
-     * @return One of {@link HeaderParseStatus#NEED_MORE_DATA},
-     * {@link HeaderParseStatus#HAVE_MORE_HEADERS} or
-     * {@link HeaderParseStatus#DONE}.
+     * @return One of {@link HeaderParseStatus#NEED_MORE_DATA}, {@link HeaderParseStatus#HAVE_MORE_HEADERS} or
+     *             {@link HeaderParseStatus#DONE}.
      */
     private HeaderParseStatus parseHeader() throws IOException {
 
@@ -905,8 +884,7 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
             chr = byteBuffer.get();
             if (chr == Constants.COLON) {
                 headerParsePos = HeaderParsePosition.HEADER_VALUE_START;
-                headerData.headerValue = headers.addValue(byteBuffer.array(), headerData.start,
-                        pos - headerData.start);
+                headerData.headerValue = headers.addValue(byteBuffer.array(), headerData.start, pos - headerData.start);
                 pos = byteBuffer.position();
                 // Mark the current buffer position
                 headerData.start = pos;
@@ -938,8 +916,8 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
         //
 
         while (headerParsePos == HeaderParsePosition.HEADER_VALUE_START ||
-               headerParsePos == HeaderParsePosition.HEADER_VALUE ||
-               headerParsePos == HeaderParsePosition.HEADER_MULTI_LINE) {
+                headerParsePos == HeaderParsePosition.HEADER_VALUE ||
+                headerParsePos == HeaderParsePosition.HEADER_MULTI_LINE) {
 
             if (headerParsePos == HeaderParsePosition.HEADER_VALUE_START) {
                 // Skipping spaces
@@ -1086,9 +1064,8 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
             }
         }
         if (rejectThisHeader || log.isDebugEnabled()) {
-            String message = sm.getString("iib.invalidheader",
-                    HeaderUtil.toPrintableString(byteBuffer.array(), headerData.lineStart,
-                            headerData.lastSignificantChar - headerData.lineStart + 1));
+            String message = sm.getString("iib.invalidheader", HeaderUtil.toPrintableString(byteBuffer.array(),
+                    headerData.lineStart, headerData.lastSignificantChar - headerData.lineStart + 1));
             if (rejectThisHeader) {
                 throw new IllegalArgumentException(message);
             }
@@ -1103,41 +1080,39 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
     // ----------------------------------------------------------- Inner classes
 
     private enum HeaderParseStatus {
-        DONE, HAVE_MORE_HEADERS, NEED_MORE_DATA
+        DONE,
+        HAVE_MORE_HEADERS,
+        NEED_MORE_DATA
     }
 
 
     private enum HeaderParsePosition {
         /**
-         * Start of a new header. A CRLF here means that there are no more
-         * headers. Any other character starts a header name.
+         * Start of a new header. A CRLF here means that there are no more headers. Any other character starts a header
+         * name.
          */
         HEADER_START,
         /**
-         * Reading a header name. All characters of header are HTTP_TOKEN_CHAR.
-         * Header name is followed by ':'. No whitespace is allowed.<br>
-         * Any non-HTTP_TOKEN_CHAR (this includes any whitespace) encountered
-         * before ':' will result in the whole line being ignored.
+         * Reading a header name. All characters of header are HTTP_TOKEN_CHAR. Header name is followed by ':'. No
+         * whitespace is allowed.<br>
+         * Any non-HTTP_TOKEN_CHAR (this includes any whitespace) encountered before ':' will result in the whole line
+         * being ignored.
          */
         HEADER_NAME,
         /**
-         * Skipping whitespace before text of header value starts, either on the
-         * first line of header value (just after ':') or on subsequent lines
-         * when it is known that subsequent line starts with SP or HT.
+         * Skipping whitespace before text of header value starts, either on the first line of header value (just after
+         * ':') or on subsequent lines when it is known that subsequent line starts with SP or HT.
          */
         HEADER_VALUE_START,
         /**
-         * Reading the header value. We are inside the value. Either on the
-         * first line or on any subsequent line. We come into this state from
-         * HEADER_VALUE_START after the first non-SP/non-HT byte is encountered
-         * on the line.
+         * Reading the header value. We are inside the value. Either on the first line or on any subsequent line. We
+         * come into this state from HEADER_VALUE_START after the first non-SP/non-HT byte is encountered on the line.
          */
         HEADER_VALUE,
         /**
-         * Before reading a new line of a header. Once the next byte is peeked,
-         * the state changes without advancing our position. The state becomes
-         * either HEADER_VALUE_START (if that first byte is SP or HT), or
-         * HEADER_START (otherwise).
+         * Before reading a new line of a header. Once the next byte is peeked, the state changes without advancing our
+         * position. The state becomes either HEADER_VALUE_START (if that first byte is SP or HT), or HEADER_START
+         * (otherwise).
          */
         HEADER_MULTI_LINE,
         /**
@@ -1161,11 +1136,9 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
         /**
          * When parsing header name: not used (stays as 0).<br>
          * When skipping broken header line: not used (stays as 0).<br>
-         * When parsing header value: starts as the first character after ':'.
-         * Then is increased as far as more bytes of the header are harvested.
-         * Bytes from buf[pos] are copied to buf[realPos]. Thus the string from
-         * [start] to [realPos-1] is the prepared value of the header, with
-         * whitespaces removed as needed.<br>
+         * When parsing header value: starts as the first character after ':'. Then is increased as far as more bytes of
+         * the header are harvested. Bytes from buf[pos] are copied to buf[realPos]. Thus the string from [start] to
+         * [realPos-1] is the prepared value of the header, with whitespaces removed as needed.<br>
          */
         int realPos = 0;
         /**
@@ -1175,10 +1148,11 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
          */
         int lastSignificantChar = 0;
         /**
-         * MB that will store the value of the header. It is null while parsing
-         * header name and is created after the name has been parsed.
+         * MB that will store the value of the header. It is null while parsing header name and is created after the
+         * name has been parsed.
          */
         MessageBytes headerValue = null;
+
         public void recycle() {
             lineStart = 0;
             start = 0;
@@ -1192,8 +1166,7 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
     // ------------------------------------- InputStreamInputBuffer Inner Class
 
     /**
-     * This class is an input buffer which will read its data from an input
-     * stream.
+     * This class is an input buffer which will read its data from an input stream.
      */
     private class SocketInputBuffer implements InputBuffer {
 
diff --git a/java/org/apache/coyote/http11/Http11Nio2Protocol.java b/java/org/apache/coyote/http11/Http11Nio2Protocol.java
index 84ce5fb946..2d0bbfa844 100644
--- a/java/org/apache/coyote/http11/Http11Nio2Protocol.java
+++ b/java/org/apache/coyote/http11/Http11Nio2Protocol.java
@@ -41,7 +41,9 @@ public class Http11Nio2Protocol extends AbstractHttp11JsseProtocol<Nio2Channel>
 
 
     @Override
-    protected Log getLog() { return log; }
+    protected Log getLog() {
+        return log;
+    }
 
 
     // ----------------------------------------------------- JMX related methods
@@ -49,7 +51,7 @@ public class Http11Nio2Protocol extends AbstractHttp11JsseProtocol<Nio2Channel>
     @Override
     protected String getNamePrefix() {
         if (isSSLEnabled()) {
-            return "https-" + getSslImplementationShortName()+ "-nio2";
+            return "https-" + getSslImplementationShortName() + "-nio2";
         } else {
             return "http-nio2";
         }
diff --git a/java/org/apache/coyote/http11/Http11NioProtocol.java b/java/org/apache/coyote/http11/Http11NioProtocol.java
index 94c092cc7d..98b5ccd71b 100644
--- a/java/org/apache/coyote/http11/Http11NioProtocol.java
+++ b/java/org/apache/coyote/http11/Http11NioProtocol.java
@@ -41,25 +41,27 @@ public class Http11NioProtocol extends AbstractHttp11JsseProtocol<NioChannel> {
 
 
     @Override
-    protected Log getLog() { return log; }
+    protected Log getLog() {
+        return log;
+    }
 
 
     // -------------------- Pool setup --------------------
 
     public void setSelectorTimeout(long timeout) {
-        ((NioEndpoint)getEndpoint()).setSelectorTimeout(timeout);
+        ((NioEndpoint) getEndpoint()).setSelectorTimeout(timeout);
     }
 
     public long getSelectorTimeout() {
-        return ((NioEndpoint)getEndpoint()).getSelectorTimeout();
+        return ((NioEndpoint) getEndpoint()).getSelectorTimeout();
     }
 
     public void setPollerThreadPriority(int threadPriority) {
-        ((NioEndpoint)getEndpoint()).setPollerThreadPriority(threadPriority);
+        ((NioEndpoint) getEndpoint()).setPollerThreadPriority(threadPriority);
     }
 
     public int getPollerThreadPriority() {
-      return ((NioEndpoint)getEndpoint()).getPollerThreadPriority();
+        return ((NioEndpoint) getEndpoint()).getPollerThreadPriority();
     }
 
 
@@ -68,7 +70,7 @@ public class Http11NioProtocol extends AbstractHttp11JsseProtocol<NioChannel> {
     @Override
     protected String getNamePrefix() {
         if (isSSLEnabled()) {
-            return "https-" + getSslImplementationShortName()+ "-nio";
+            return "https-" + getSslImplementationShortName() + "-nio";
         } else {
             return "http-nio";
         }
diff --git a/java/org/apache/coyote/http11/Http11OutputBuffer.java b/java/org/apache/coyote/http11/Http11OutputBuffer.java
index cf666b605d..0b9bf29b20 100644
--- a/java/org/apache/coyote/http11/Http11OutputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11OutputBuffer.java
@@ -29,10 +29,9 @@ import org.apache.tomcat.util.net.SocketWrapperBase;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * Provides buffering for the HTTP headers (allowing responses to be reset
- * before they have been committed) and the link to the Socket for writing the
- * headers (once committed) and the response body. Note that buffering of the
- * response body happens at a higher level.
+ * Provides buffering for the HTTP headers (allowing responses to be reset before they have been committed) and the link
+ * to the Socket for writing the headers (once committed) and the response body. Note that buffering of the response
+ * body happens at a higher level.
  */
 public class Http11OutputBuffer implements HttpOutputBuffer {
 
@@ -122,8 +121,8 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
     // ------------------------------------------------------------- Properties
 
     /**
-     * Add an output filter to the filter library. Note that calling this method
-     * resets the currently active filters to none.
+     * Add an output filter to the filter library. Note that calling this method resets the currently active filters to
+     * none.
      *
      * @param filter The filter to add
      */
@@ -152,8 +151,8 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
      * <p>
      * The filter does not have to be present in {@link #getFilters()}.
      * <p>
-     * A filter can only be added to a response once. If the filter has already
-     * been added to this response then this method will be a NO-OP.
+     * A filter can only be added to a response once. If the filter has already been added to this response then this
+     * method will be a NO-OP.
      *
      * @param filter The filter to add
      */
@@ -242,8 +241,8 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
     // --------------------------------------------------------- Public Methods
 
     /**
-     * Reset the header buffer if an error occurs during the writing of the
-     * headers so the error response can be written.
+     * Reset the header buffer if an error occurs during the writing of the headers so the error response can be
+     * written.
      */
     void resetHeaderBuffer() {
         headerBuffer.position(0).limit(headerBuffer.capacity());
@@ -251,8 +250,7 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
 
 
     /**
-     * Recycle the output buffer. This should be called when closing the
-     * connection.
+     * Recycle the output buffer. This should be called when closing the connection.
      */
     public void recycle() {
         nextRequest();
@@ -261,10 +259,8 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
 
 
     /**
-     * End processing of current HTTP request.
-     * Note: All bytes of the current request should have been already
-     * consumed. This method only resets all the pointers so that we are ready
-     * to parse the next HTTP request.
+     * End processing of current HTTP request. Note: All bytes of the current request should have been already consumed.
+     * This method only resets all the pointers so that we are ready to parse the next HTTP request.
      */
     public void nextRequest() {
         // Recycle filters
@@ -337,17 +333,17 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
         // Write status code
         int status = response.getStatus();
         switch (status) {
-        case 200:
-            write(Constants._200_BYTES);
-            break;
-        case 400:
-            write(Constants._400_BYTES);
-            break;
-        case 404:
-            write(Constants._404_BYTES);
-            break;
-        default:
-            write(status);
+            case 200:
+                write(Constants._200_BYTES);
+                break;
+            case 400:
+                write(Constants._400_BYTES);
+                break;
+            case 404:
+                write(Constants._404_BYTES);
+                break;
+            default:
+                write(status);
         }
 
         headerBuffer.put(Constants.SP);
@@ -363,7 +359,7 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
     /**
      * Send a header.
      *
-     * @param name Header name
+     * @param name  Header name
      * @param value Header value
      */
     public void sendHeader(MessageBytes name, MessageBytes value) {
@@ -383,9 +379,8 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
 
 
     /**
-     * This method will write the contents of the specified message bytes
-     * buffer to the output stream, without filtering. This method is meant to
-     * be used to write the response header.
+     * This method will write the contents of the specified message bytes buffer to the output stream, without
+     * filtering. This method is meant to be used to write the response header.
      *
      * @param mb data to be written
      */
@@ -403,8 +398,7 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
                 // filtered (apart from TAB which is 9). 127 is a control (DEL).
                 // The values 128 to 255 are all OK. Converting those to signed
                 // gives -128 to -1.
-                if ((buffer[i] > -1 && buffer[i] <= 31 && buffer[i] != 9) ||
-                        buffer[i] == 127) {
+                if ((buffer[i] > -1 && buffer[i] <= 31 && buffer[i] != 9) || buffer[i] == 127) {
                     buffer[i] = ' ';
                 }
             }
@@ -414,9 +408,8 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
 
 
     /**
-     * This method will write the contents of the specified byte chunk to the
-     * output stream, without filtering. This method is meant to be used to
-     * write the response header.
+     * This method will write the contents of the specified byte chunk to the output stream, without filtering. This
+     * method is meant to be used to write the response header.
      *
      * @param bc data to be written
      */
@@ -429,9 +422,8 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
 
 
     /**
-     * This method will write the contents of the specified byte
-     * buffer to the output stream, without filtering. This method is meant to
-     * be used to write the response header.
+     * This method will write the contents of the specified byte buffer to the output stream, without filtering. This
+     * method is meant to be used to write the response header.
      *
      * @param b data to be written
      */
@@ -444,8 +436,8 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
 
 
     /**
-     * This method will write the specified integer to the output stream. This
-     * method is meant to be used to write the response header.
+     * This method will write the specified integer to the output stream. This method is meant to be used to write the
+     * response header.
      *
      * @param value data to be written
      */
@@ -455,43 +447,44 @@ public class Http11OutputBuffer implements HttpOutputBuffer {
         int len = s.length();
         checkLengthBeforeWrite(len);
         for (int i = 0; i < len; i++) {
-            char c = s.charAt (i);
+            char c = s.charAt(i);
             headerBuffer.put((byte) c);
         }
     }
 
 
     /**
-     * Checks to see if there is enough space in the buffer to write the
-     * requested number of bytes.
+     * Checks to see if there is enough space in the buffer to write the requested number of bytes.
      */
     private void checkLengthBeforeWrite(int length) {
         // "+ 4": BZ 57509. Reserve space for CR/LF/COLON/SP characters that
         // are put directly into the buffer following this write operation.
         if (headerBuffer.position() + length + 4 > headerBuffer.capacity()) {
-            throw new HeadersTooLargeException(
-                    sm.getString("iob.responseheadertoolarge.error"));
+            throw new HeadersTooLargeException(sm.getString("iob.responseheadertoolarge.error"));
         }
     }
 
 
-    //------------------------------------------------------ Non-blocking writes
+    // ------------------------------------------------------ Non-blocking writes
 
     /**
      * Writes any remaining buffered data.
      *
-     * @param block     Should this method block until the buffer is empty
-     * @return  <code>true</code> if data remains in the buffer (which can only
-     *          happen in non-blocking mode) else <code>false</code>.
+     * @param block Should this method block until the buffer is empty
+     *
+     * @return <code>true</code> if data remains in the buffer (which can only happen in non-blocking mode) else
+     *             <code>false</code>.
+     *
      * @throws IOException Error writing data
      */
-    protected boolean flushBuffer(boolean block) throws IOException  {
+    protected boolean flushBuffer(boolean block) throws IOException {
         return socketWrapper.flush(block);
     }
 
 
     /**
      * Is standard Servlet blocking IO being used for output?
+     *
      * @return <code>true</code> if this is blocking IO
      */
     protected final boolean isBlocking() {
diff --git a/java/org/apache/coyote/http11/Http11Processor.java b/java/org/apache/coyote/http11/Http11Processor.java
index c27ff911f4..67d1452de4 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -96,8 +96,8 @@ public class Http11Processor extends AbstractProcessor {
 
 
     /**
-     * Tracks how many internal filters are in the filter library so they
-     * are skipped when looking for pluggable filters.
+     * Tracks how many internal filters are in the filter library so they are skipped when looking for pluggable
+     * filters.
      */
     private int pluggableFilterIndex = Integer.MAX_VALUE;
 
@@ -109,8 +109,7 @@ public class Http11Processor extends AbstractProcessor {
 
 
     /**
-     * Flag used to indicate that the socket should be kept open (e.g. for keep
-     * alive or send file).
+     * Flag used to indicate that the socket should be kept open (e.g. for keep alive or send file).
      */
     private volatile boolean openSocket = false;
 
@@ -133,15 +132,13 @@ public class Http11Processor extends AbstractProcessor {
 
 
     /**
-     * Content delimiter for the request (if false, the connection will
-     * be closed at the end of the request).
+     * Content delimiter for the request (if false, the connection will be closed at the end of the request).
      */
     private boolean contentDelimitation = true;
 
 
     /**
-     * Instance of the new protocol to use after the HTTP connection has been
-     * upgraded.
+     * Instance of the new protocol to use after the HTTP connection has been upgraded.
      */
     private UpgradeToken upgradeToken = null;
 
@@ -156,8 +153,7 @@ public class Http11Processor extends AbstractProcessor {
         super(adapter);
         this.protocol = protocol;
 
-        httpParser = new HttpParser(protocol.getRelaxedPathChars(),
-                protocol.getRelaxedQueryChars());
+        httpParser = new HttpParser(protocol.getRelaxedPathChars(), protocol.getRelaxedQueryChars());
 
         inputBuffer = new Http11InputBuffer(request, protocol.getMaxHttpRequestHeaderSize(),
                 protocol.getRejectIllegalHeader(), httpParser);
@@ -171,9 +167,9 @@ public class Http11Processor extends AbstractProcessor {
         outputBuffer.addFilter(new IdentityOutputFilter());
 
         // Create and add the chunked filters.
-        inputBuffer.addFilter(new ChunkedInputFilter(protocol.getMaxTrailerSize(),
-                protocol.getAllowedTrailerHeadersInternal(), protocol.getMaxExtensionSize(),
-                protocol.getMaxSwallowSize()));
+        inputBuffer.addFilter(
+                new ChunkedInputFilter(protocol.getMaxTrailerSize(), protocol.getAllowedTrailerHeadersInternal(),
+                        protocol.getMaxExtensionSize(), protocol.getMaxSwallowSize()));
         outputBuffer.addFilter(new ChunkedOutputFilter());
 
         // Create and add the void filters.
@@ -184,7 +180,7 @@ public class Http11Processor extends AbstractProcessor {
         inputBuffer.addFilter(new BufferedInputFilter(protocol.getMaxSwallowSize()));
 
         // Create and add the gzip filters.
-        //inputBuffer.addFilter(new GzipInputFilter());
+        // inputBuffer.addFilter(new GzipInputFilter());
         outputBuffer.addFilter(new GzipOutputFilter());
 
         pluggableFilterIndex = inputBuffer.getFilters().length;
@@ -192,24 +188,20 @@ public class Http11Processor extends AbstractProcessor {
 
 
     /**
-     * Determine if we must drop the connection because of the HTTP status
-     * code.  Use the same list of codes as Apache/httpd.
+     * Determine if we must drop the connection because of the HTTP status code. Use the same list of codes as
+     * Apache/httpd.
      */
     private static boolean statusDropsConnection(int status) {
-        return status == 400 /* SC_BAD_REQUEST */ ||
-               status == 408 /* SC_REQUEST_TIMEOUT */ ||
-               status == 411 /* SC_LENGTH_REQUIRED */ ||
-               status == 413 /* SC_REQUEST_ENTITY_TOO_LARGE */ ||
-               status == 414 /* SC_REQUEST_URI_TOO_LONG */ ||
-               status == 500 /* SC_INTERNAL_SERVER_ERROR */ ||
-               status == 503 /* SC_SERVICE_UNAVAILABLE */ ||
-               status == 501 /* SC_NOT_IMPLEMENTED */;
+        return status == 400 /* SC_BAD_REQUEST */ || status == 408 /* SC_REQUEST_TIMEOUT */ ||
+                status == 411 /* SC_LENGTH_REQUIRED */ || status == 413 /* SC_REQUEST_ENTITY_TOO_LARGE */ ||
+                status == 414 /* SC_REQUEST_URI_TOO_LONG */ || status == 500 /* SC_INTERNAL_SERVER_ERROR */ ||
+                status == 503 /* SC_SERVICE_UNAVAILABLE */ || status == 501 /* SC_NOT_IMPLEMENTED */;
     }
 
 
     /**
-     * Add an input filter to the current request. If the encoding is not
-     * supported, a 501 response will be returned to the client.
+     * Add an input filter to the current request. If the encoding is not supported, a 501 response will be returned to
+     * the client.
      */
     private void addInputFilter(InputFilter[] inputFilters, String encodingName) {
         if (contentDelimitation) {
@@ -220,7 +212,7 @@ public class Http11Processor extends AbstractProcessor {
             setErrorState(ErrorState.CLOSE_CLEAN, null);
             if (log.isDebugEnabled()) {
                 log.debug(sm.getString("http11processor.request.prepare") +
-                          " Transfer encoding lists chunked before [" + encodingName + "]");
+                        " Transfer encoding lists chunked before [" + encodingName + "]");
             }
             return;
         }
@@ -241,16 +233,15 @@ public class Http11Processor extends AbstractProcessor {
             response.setStatus(501);
             setErrorState(ErrorState.CLOSE_CLEAN, null);
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("http11processor.request.prepare") +
-                          " Unsupported transfer encoding [" + encodingName + "]");
+                log.debug(sm.getString("http11processor.request.prepare") + " Unsupported transfer encoding [" +
+                        encodingName + "]");
             }
         }
     }
 
 
     @Override
-    public SocketState service(SocketWrapperBase<?> socketWrapper)
-        throws IOException {
+    public SocketState service(SocketWrapperBase<?> socketWrapper) throws IOException {
         RequestInfo rp = request.getRequestProcessor();
         rp.setStage(org.apache.coyote.Constants.STAGE_PARSE);
 
@@ -355,12 +346,12 @@ public class Http11Processor extends AbstractProcessor {
                             response.setStatus(HttpServletResponse.SC_SWITCHING_PROTOCOLS);
                             response.setHeader("Connection", "Upgrade");
                             response.setHeader("Upgrade", requestedProtocol);
-                            action(ActionCode.CLOSE,  null);
+                            action(ActionCode.CLOSE, null);
                             getAdapter().log(request, response, 0);
 
                             // Continue processing using new protocol
-                            InternalHttpUpgradeHandler upgradeHandler =
-                                    upgradeProtocol.getInternalUpgradeHandler(socketWrapper, getAdapter(), upgradeRequest);
+                            InternalHttpUpgradeHandler upgradeHandler = upgradeProtocol
+                                    .getInternalUpgradeHandler(socketWrapper, getAdapter(), upgradeRequest);
                             UpgradeToken upgradeToken = new UpgradeToken(upgradeHandler, null, null, requestedProtocol);
                             action(ActionCode.UPGRADE, upgradeToken);
                             return SocketState.UPGRADING;
@@ -388,8 +379,7 @@ public class Http11Processor extends AbstractProcessor {
             int maxKeepAliveRequests = protocol.getMaxKeepAliveRequests();
             if (maxKeepAliveRequests == 1) {
                 keepAlive = false;
-            } else if (maxKeepAliveRequests > 0 &&
-                    socketWrapper.decrementKeepAlive() <= 0) {
+            } else if (maxKeepAliveRequests > 0 && socketWrapper.decrementKeepAlive() <= 0) {
                 keepAlive = false;
             }
 
@@ -399,11 +389,11 @@ public class Http11Processor extends AbstractProcessor {
                     rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
                     getAdapter().service(request, response);
                     // Handle when the response was committed before a serious
-                    // error occurred.  Throwing a ServletException should both
+                    // error occurred. Throwing a ServletException should both
                     // set the status to 500 and set the errorException.
                     // If we fail here, then the response is likely already
                     // committed, so we can't try and set headers.
-                    if(keepAlive && !getErrorState().isError() && !isAsync() &&
+                    if (keepAlive && !getErrorState().isError() && !isAsync() &&
                             statusDropsConnection(response.getStatus())) {
                         setErrorState(ErrorState.CLOSE_CLEAN, null);
                     }
@@ -457,7 +447,7 @@ public class Http11Processor extends AbstractProcessor {
 
             if (!protocol.getDisableUploadTimeout()) {
                 int connectionTimeout = protocol.getConnectionTimeout();
-                if(connectionTimeout > 0) {
+                if (connectionTimeout > 0) {
                     socketWrapper.setReadTimeout(connectionTimeout);
                 } else {
                     socketWrapper.setReadTimeout(0);
@@ -622,8 +612,8 @@ public class Http11Processor extends AbstractProcessor {
             response.setStatus(505);
             setErrorState(ErrorState.CLOSE_CLEAN, null);
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("http11processor.request.prepare")+
-                          " Unsupported HTTP version \""+protocolMB+"\"");
+                log.debug(sm.getString("http11processor.request.prepare") + " Unsupported HTTP version \"" +
+                        protocolMB + "\"");
             }
         }
     }
@@ -662,7 +652,7 @@ public class Http11Processor extends AbstractProcessor {
             MessageBytes userAgentValueMB = headers.getValue("user-agent");
             // Check in the restricted list, and adjust the http11
             // and keepAlive flags accordingly
-            if(userAgentValueMB != null && !userAgentValueMB.isNull()) {
+            if (userAgentValueMB != null && !userAgentValueMB.isNull()) {
                 String userAgentValue = userAgentValueMB.toString();
                 if (restrictedUserAgents.matcher(userAgentValue).matches()) {
                     http11 = false;
@@ -742,8 +732,7 @@ public class Http11Processor extends AbstractProcessor {
                     if (hostValueMB != null) {
                         // Any host in the request line must be consistent with
                         // the Host header
-                        if (!hostValueMB.getByteChunk().equals(
-                                uriB, uriBCStart + pos, slashPos - pos)) {
+                        if (!hostValueMB.getByteChunk().equals(uriB, uriBCStart + pos, slashPos - pos)) {
                             if (protocol.getAllowHostHeaderMismatch()) {
                                 // The requirements of RFC 2616 are being
                                 // applied. If the host header and the request
@@ -880,8 +869,7 @@ public class Http11Processor extends AbstractProcessor {
 
 
     /**
-     * When committing the response, we have to validate the set of headers, as
-     * well as setup the response filters.
+     * When committing the response, we have to validate the set of headers, as well as setup the response filters.
      */
     @Override
     protected final void prepareResponse() throws IOException {
@@ -899,11 +887,9 @@ public class Http11Processor extends AbstractProcessor {
         }
 
         int statusCode = response.getStatus();
-        if (statusCode < 200 || statusCode == 204 || statusCode == 205 ||
-                statusCode == 304) {
+        if (statusCode < 200 || statusCode == 204 || statusCode == 205 || statusCode == 304) {
             // No entity body
-            outputBuffer.addActiveFilter
-                (outputFilters[Constants.VOID_FILTER]);
+            outputBuffer.addActiveFilter(outputFilters[Constants.VOID_FILTER]);
             entityBody = false;
             contentDelimitation = true;
             if (statusCode == 205) {
@@ -918,8 +904,7 @@ public class Http11Processor extends AbstractProcessor {
         MessageBytes methodMB = request.method();
         if (methodMB.equals("HEAD")) {
             // No entity body
-            outputBuffer.addActiveFilter
-                (outputFilters[Constants.VOID_FILTER]);
+            outputBuffer.addActiveFilter(outputFilters[Constants.VOID_FILTER]);
             contentDelimitation = true;
         }
 
@@ -943,8 +928,7 @@ public class Http11Processor extends AbstractProcessor {
             }
             String contentLanguage = response.getContentLanguage();
             if (contentLanguage != null) {
-                headers.setValue("Content-Language")
-                    .setString(contentLanguage);
+                headers.setValue("Content-Language").setString(contentLanguage);
             }
         }
 
@@ -978,8 +962,7 @@ public class Http11Processor extends AbstractProcessor {
         // Add date header unless application has already set one (e.g. in a
         // Caching Filter)
         if (headers.getValue("Date") == null) {
-            headers.addValue("Date").setString(
-                    FastHttpDateFormat.getCurrentDate());
+            headers.addValue("Date").setString(FastHttpDateFormat.getCurrentDate());
         }
 
         // FIXME: Add transfer encoding header
@@ -987,7 +970,7 @@ public class Http11Processor extends AbstractProcessor {
         if ((entityBody) && (!contentDelimitation) || connectionClosePresent) {
             // Disable keep-alive if:
             // - there is a response body but way for the client to determine
-            //   the content length information; or
+            // the content length information; or
             // - there is a "connection: close" header present
             // This will cause the "connection: close" header to be added if it
             // is not already present.
@@ -1010,8 +993,7 @@ public class Http11Processor extends AbstractProcessor {
         if (!keepAlive) {
             // Avoid adding the close header twice
             if (!connectionClosePresent) {
-                headers.addValue(Constants.CONNECTION).setString(
-                        Constants.CLOSE);
+                headers.addValue(Constants.CONNECTION).setString(Constants.CLOSE);
             }
         } else if (!getErrorState().isError()) {
             if (!http11) {
@@ -1019,8 +1001,8 @@ public class Http11Processor extends AbstractProcessor {
             }
 
             if (protocol.getUseKeepAliveResponseHeader()) {
-                boolean connectionKeepAlivePresent =
-                    isConnectionToken(request.getMimeHeaders(), Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
+                boolean connectionKeepAlivePresent = isConnectionToken(request.getMimeHeaders(),
+                        Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
 
                 if (connectionKeepAlivePresent) {
                     int keepAliveTimeout = protocol.getKeepAliveTimeout();
@@ -1034,10 +1016,11 @@ public class Http11Processor extends AbstractProcessor {
                             // else create the header
                             MessageBytes connectionHeaderValue = headers.getValue(Constants.CONNECTION);
                             if (connectionHeaderValue == null) {
-                                headers.addValue(Constants.CONNECTION).setString(Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
+                                headers.addValue(Constants.CONNECTION)
+                                        .setString(Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
                             } else {
-                                connectionHeaderValue.setString(
-                                        connectionHeaderValue.getString() + ", " + Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
+                                connectionHeaderValue.setString(connectionHeaderValue.getString() + ", " +
+                                        Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
                             }
                         }
                     }
@@ -1066,8 +1049,8 @@ public class Http11Processor extends AbstractProcessor {
                     outputBuffer.sendHeader(headers.getName(i), headers.getValue(i));
                 } catch (IllegalArgumentException iae) {
                     // Log the problematic header
-                    log.warn(sm.getString("http11processor.response.invalidHeader",
-                            headers.getName(i), headers.getValue(i)), iae);
+                    log.warn(sm.getString("http11processor.response.invalidHeader", headers.getName(i),
+                            headers.getValue(i)), iae);
                     // Remove the problematic header
                     headers.removeHeader(i);
                     size--;
@@ -1102,27 +1085,23 @@ public class Http11Processor extends AbstractProcessor {
 
 
     private void prepareSendfile(OutputFilter[] outputFilters) {
-        String fileName = (String) request.getAttribute(
-                org.apache.coyote.Constants.SENDFILE_FILENAME_ATTR);
+        String fileName = (String) request.getAttribute(org.apache.coyote.Constants.SENDFILE_FILENAME_ATTR);
         if (fileName == null) {
             sendfileData = null;
         } else {
             // No entity body sent here
             outputBuffer.addActiveFilter(outputFilters[Constants.VOID_FILTER]);
             contentDelimitation = true;
-            long pos = ((Long) request.getAttribute(
-                    org.apache.coyote.Constants.SENDFILE_FILE_START_ATTR)).longValue();
-            long end = ((Long) request.getAttribute(
-                    org.apache.coyote.Constants.SENDFILE_FILE_END_ATTR)).longValue();
+            long pos = ((Long) request.getAttribute(org.apache.coyote.Constants.SENDFILE_FILE_START_ATTR)).longValue();
+            long end = ((Long) request.getAttribute(org.apache.coyote.Constants.SENDFILE_FILE_END_ATTR)).longValue();
             sendfileData = socketWrapper.createSendfileData(fileName, pos, end - pos);
         }
     }
 
 
     /*
-     * Note: populateHost() is not over-ridden.
-     *       request.serverName() will be set to return the default host name by
-     *       the Mapper.
+     * Note: populateHost() is not over-ridden. request.serverName() will be set to return the default host name by the
+     * Mapper.
      */
 
 
@@ -1188,9 +1167,8 @@ public class Http11Processor extends AbstractProcessor {
 
 
     /*
-     * No more input will be passed to the application. Remaining input will be
-     * swallowed or the connection dropped depending on the error and
-     * expectation status.
+     * No more input will be passed to the application. Remaining input will be swallowed or the connection dropped
+     * depending on the error and expectation status.
      */
     private void endRequest() {
         if (getErrorState().isError()) {
@@ -1300,20 +1278,18 @@ public class Http11Processor extends AbstractProcessor {
             // Consume and buffer the request body, so that it does not
             // interfere with the client's handshake messages
             InputFilter[] inputFilters = inputBuffer.getFilters();
-            ((BufferedInputFilter) inputFilters[Constants.BUFFERED_FILTER]).setLimit(
-                    protocol.getMaxSavePostSize());
+            ((BufferedInputFilter) inputFilters[Constants.BUFFERED_FILTER]).setLimit(protocol.getMaxSavePostSize());
             inputBuffer.addActiveFilter(inputFilters[Constants.BUFFERED_FILTER]);
 
             /*
-             * Outside the try/catch because we want I/O errors during
-             * renegotiation to be thrown for the caller to handle since they
-             * will be fatal to the connection.
+             * Outside the try/catch because we want I/O errors during renegotiation to be thrown for the caller to
+             * handle since they will be fatal to the connection.
              */
             socketWrapper.doClientAuth(sslSupport);
             try {
                 /*
-                 * Errors processing the cert chain do not affect the client
-                 * connection so they can be logged and swallowed here.
+                 * Errors processing the cert chain do not affect the client connection so they can be logged and
+                 * swallowed here.
                  */
                 Object sslO = sslSupport.getPeerCertificateChain();
                 if (sslO != null) {
@@ -1420,15 +1396,15 @@ public class Http11Processor extends AbstractProcessor {
             }
             result = socketWrapper.processSendfile(sendfileData);
             switch (result) {
-            case ERROR:
-                // Write failed
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("http11processor.sendfile.error"));
-                }
-                setErrorState(ErrorState.CLOSE_CONNECTION_NOW, null);
-                //$FALL-THROUGH$
-            default:
-                sendfileData = null;
+                case ERROR:
+                    // Write failed
+                    if (log.isDebugEnabled()) {
+                        log.debug(sm.getString("http11processor.sendfile.error"));
+                    }
+                    setErrorState(ErrorState.CLOSE_CONNECTION_NOW, null);
+                    //$FALL-THROUGH$
+                default:
+                    sendfileData = null;
             }
         }
         return result;
diff --git a/java/org/apache/coyote/http11/HttpOutputBuffer.java b/java/org/apache/coyote/http11/HttpOutputBuffer.java
index 6127000ad6..1a66ad7979 100644
--- a/java/org/apache/coyote/http11/HttpOutputBuffer.java
+++ b/java/org/apache/coyote/http11/HttpOutputBuffer.java
@@ -23,9 +23,8 @@ import org.apache.coyote.OutputBuffer;
 public interface HttpOutputBuffer extends OutputBuffer {
 
     /**
-     * Finish writing the current response. It is acceptable to write extra
-     * bytes using {@link #doWrite(java.nio.ByteBuffer)} during the execution of
-     * this method.
+     * Finish writing the current response. It is acceptable to write extra bytes using
+     * {@link #doWrite(java.nio.ByteBuffer)} during the execution of this method.
      *
      * @throws IOException If an I/O error occurs while writing to the client
      */
diff --git a/java/org/apache/coyote/http11/InputFilter.java b/java/org/apache/coyote/http11/InputFilter.java
index cc76bed06f..a68ee7a5ef 100644
--- a/java/org/apache/coyote/http11/InputFilter.java
+++ b/java/org/apache/coyote/http11/InputFilter.java
@@ -46,9 +46,8 @@ public interface InputFilter extends InputBuffer {
     /**
      * Get the name of the encoding handled by this filter.
      *
-     * @return The encoding name as a byte chunk to facilitate comparison with
-     *         the value read from the HTTP headers which will also be a
-     *         ByteChunk
+     * @return The encoding name as a byte chunk to facilitate comparison with the value read from the HTTP headers
+     *             which will also be a ByteChunk
      */
     ByteChunk getEncodingName();
 
@@ -64,10 +63,9 @@ public interface InputFilter extends InputBuffer {
     /**
      * End the current request.
      *
-     * @return 0 is the expected return value. A positive value indicates that
-     * too many bytes were read. This method is allowed to use buffer.doRead
-     * to consume extra bytes. The result of this method can't be negative (if
-     * an error happens, an IOException should be thrown instead).
+     * @return 0 is the expected return value. A positive value indicates that too many bytes were read. This method is
+     *             allowed to use buffer.doRead to consume extra bytes. The result of this method can't be negative (if
+     *             an error happens, an IOException should be thrown instead).
      *
      * @throws IOException If an error happens
      */
@@ -77,8 +75,7 @@ public interface InputFilter extends InputBuffer {
     /**
      * Has the request body been read fully?
      *
-     * @return {@code true} if the request body has been fully read, otherwise
-     *         {@code false}
+     * @return {@code true} if the request body has been fully read, otherwise {@code false}
      */
     boolean isFinished();
 }
diff --git a/java/org/apache/coyote/http11/OutputFilter.java b/java/org/apache/coyote/http11/OutputFilter.java
index d2481554e0..040ec3bc25 100644
--- a/java/org/apache/coyote/http11/OutputFilter.java
+++ b/java/org/apache/coyote/http11/OutputFilter.java
@@ -26,9 +26,8 @@ import org.apache.coyote.Response;
 public interface OutputFilter extends HttpOutputBuffer {
 
     /**
-     * Some filters need additional parameters from the response. All the
-     * necessary reading can occur in that method, as this method is called
-     * after the response header processing is complete.
+     * Some filters need additional parameters from the response. All the necessary reading can occur in that method, as
+     * this method is called after the response header processing is complete.
      *
      * @param response The response to associate with this OutputFilter
      */


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


[tomcat] 05/06: Clean-up - formatting. No functional change.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1b6c6c47010748dcec8f37e92546b172b3d17080
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Feb 23 16:49:52 2023 +0000

    Clean-up - formatting. No functional change.
---
 .../coyote/http11/TestHttp11InputBuffer.java       | 122 ++---
 .../coyote/http11/TestHttp11InputBufferCRLF.java   |  66 +--
 .../coyote/http11/TestHttp11OutputBuffer.java      |   2 +-
 .../apache/coyote/http11/TestHttp11Processor.java  | 506 ++++++++-------------
 4 files changed, 237 insertions(+), 459 deletions(-)

diff --git a/test/org/apache/coyote/http11/TestHttp11InputBuffer.java b/test/org/apache/coyote/http11/TestHttp11InputBuffer.java
index 9e8c5b43b0..40276619de 100644
--- a/test/org/apache/coyote/http11/TestHttp11InputBuffer.java
+++ b/test/org/apache/coyote/http11/TestHttp11InputBuffer.java
@@ -39,7 +39,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
 
     private static final String CR = "\r";
     private static final String LF = "\n";
-    private  static final String CRLF = CR + LF;
+    private static final String CRLF = CR + LF;
 
     /**
      * Test case for https://bz.apache.org/bugzilla/show_bug.cgi?id=48839
@@ -76,13 +76,8 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
                 connect();
 
                 String[] request = new String[1];
-                request[0] =
-                    "GET http://localhost:8080/test HTTP/1.1" + CRLF +
-                    "Host: localhost:8080" + CRLF +
-                    "X-Bug48839: abcd" + CRLF +
-                    "\tefgh" + CRLF +
-                    "Connection: close" + CRLF +
-                    CRLF;
+                request[0] = "GET http://localhost:8080/test HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF +
+                        "X-Bug48839: abcd" + CRLF + "\tefgh" + CRLF + "Connection: close" + CRLF + CRLF;
 
                 setRequest(request);
                 processRequest(); // blocks until response has been read
@@ -116,8 +111,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
          * Only interested in the request headers from a GET request
          */
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             // Just echo the header value back as plain text
             resp.setContentType("text/plain");
 
@@ -167,9 +161,8 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
 
     @Test
     public void testBug51557SeparatorsInName() throws Exception {
-        char httpSeparators[] = new char[] {
-                '\t', ' ', '\"', '(', ')', ',', '/', ':', ';', '<',
-                '=', '>', '?', '@', '[', '\\', ']', '{', '}' };
+        char httpSeparators[] = new char[] { '\t', ' ', '\"', '(', ')', ',', '/', ':', ';', '<', '=', '>', '?', '@',
+                '[', '\\', ']', '{', '}' };
 
         for (char s : httpSeparators) {
             doTestBug51557CharInName(s);
@@ -222,8 +215,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
     @Test
     public void testBug51557Continuation() {
 
-        Bug51557Client client = new Bug51557Client("X-Bug=51557NoColon",
-                "foo" + SimpleHttpClient.CRLF + " bar");
+        Bug51557Client client = new Bug51557Client("X-Bug=51557NoColon", "foo" + SimpleHttpClient.CRLF + " bar");
 
         client.doRequest();
         Assert.assertTrue(client.isResponse200());
@@ -235,8 +227,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
     @Test
     public void testBug51557BoundaryStart() {
 
-        Bug51557Client client = new Bug51557Client("=X-Bug51557",
-                "invalid");
+        Bug51557Client client = new Bug51557Client("=X-Bug51557", "invalid");
 
         client.doRequest();
         Assert.assertTrue(client.isResponse200());
@@ -248,8 +239,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
     @Test
     public void testBug51557BoundaryEnd() {
 
-        Bug51557Client client = new Bug51557Client("X-Bug51557=",
-                "invalid");
+        Bug51557Client client = new Bug51557Client("X-Bug51557=", "invalid");
 
         client.doRequest();
         Assert.assertTrue(client.isResponse200());
@@ -259,8 +249,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
 
 
     private void doTestBug51557CharInName(char s) {
-        Bug51557Client client =
-            new Bug51557Client("X-Bug" + s + "51557", "invalid");
+        Bug51557Client client = new Bug51557Client("X-Bug" + s + "51557", "invalid");
 
         client.doRequest();
         Assert.assertTrue(client.isResponse200());
@@ -270,8 +259,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
 
 
     private void doTestBug51557InvalidCharInValue(char s) {
-        Bug51557Client client =
-            new Bug51557Client("X-Bug51557-Invalid", "invalid" + s + "invalid");
+        Bug51557Client client = new Bug51557Client("X-Bug51557-Invalid", "invalid" + s + "invalid");
 
         client.doRequest();
         Assert.assertTrue("Testing [" + (int) s + "]", client.isResponse200());
@@ -281,8 +269,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
 
 
     private void doTestBug51557ValidCharInValue(char s) {
-        Bug51557Client client =
-            new Bug51557Client("X-Bug51557-Valid", "valid" + s + "valid");
+        Bug51557Client client = new Bug51557Client("X-Bug51557-Valid", "valid" + s + "valid");
 
         client.doRequest();
         Assert.assertTrue("Testing [" + (int) s + "]", client.isResponse200());
@@ -310,8 +297,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
             this(headerName, headerValue, false);
         }
 
-        Bug51557Client(String headerName, String headerValue,
-                boolean rejectIllegalHeader) {
+        Bug51557Client(String headerName, String headerValue, boolean rejectIllegalHeader) {
             this.headerName = headerName;
             this.headerLine = headerName + ": " + headerValue;
             this.rejectIllegalHeader = rejectIllegalHeader;
@@ -322,14 +308,12 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
             Tomcat tomcat = getTomcatInstance();
 
             Context root = tomcat.addContext("", TEMP_DIR);
-            Tomcat.addServlet(root, "Bug51557",
-                    new Bug51557Servlet(headerName));
+            Tomcat.addServlet(root, "Bug51557", new Bug51557Servlet(headerName));
             root.addServletMappingDecoded("/test", "Bug51557");
 
             try {
                 Connector connector = tomcat.getConnector();
-                Assert.assertTrue(connector.setProperty(
-                        "rejectIllegalHeader", Boolean.toString(rejectIllegalHeader)));
+                Assert.assertTrue(connector.setProperty("rejectIllegalHeader", Boolean.toString(rejectIllegalHeader)));
                 tomcat.start();
                 setPort(connector.getLocalPort());
 
@@ -338,13 +322,8 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
                 connect();
 
                 String[] request = new String[1];
-                request[0] =
-                    "GET http://localhost:8080/test HTTP/1.1" + CRLF +
-                    "Host: localhost:8080" + CRLF +
-                    headerLine + CRLF +
-                    "X-Bug51557: abcd" + CRLF +
-                    "Connection: close" + CRLF +
-                    CRLF;
+                request[0] = "GET http://localhost:8080/test HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF +
+                        headerLine + CRLF + "X-Bug51557: abcd" + CRLF + "Connection: close" + CRLF + CRLF;
 
                 setRequest(request);
                 processRequest(); // blocks until response has been read
@@ -377,8 +356,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
         private String invalidHeaderName;
 
         /**
-         * @param invalidHeaderName The header name should be invalid and
-         *                          therefore ignored by the header parsing code
+         * @param invalidHeaderName The header name should be invalid and therefore ignored by the header parsing code
          */
         Bug51557Servlet(String invalidHeaderName) {
             this.invalidHeaderName = invalidHeaderName;
@@ -388,8 +366,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
          * Only interested in the request headers from a GET request
          */
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             // Just echo the header value back as plain text
             resp.setContentType("text/plain");
 
@@ -399,8 +376,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
             processHeaders("X-Bug51557", req, out);
         }
 
-        private void processHeaders(String header, HttpServletRequest req,
-                PrintWriter out) {
+        private void processHeaders(String header, HttpServletRequest req, PrintWriter out) {
             Enumeration<String> values = req.getHeaders(header);
             while (values.hasMoreElements()) {
                 out.println(values.nextElement());
@@ -410,8 +386,8 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
 
 
     /**
-     * Test case for new lines at the start of a request. RFC2616
-     * does not permit any, but Tomcat is tolerant of them if they are present.
+     * Test case for new lines at the start of a request. RFC2616 does not permit any, but Tomcat is tolerant of them if
+     * they are present.
      */
     @Test
     public void testNewLines() {
@@ -425,8 +401,8 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
 
 
     /**
-     * Test case for new lines at the start of a request. RFC2616
-     * does not permit any, but Tomcat is tolerant of them if they are present.
+     * Test case for new lines at the start of a request. RFC2616 does not permit any, but Tomcat is tolerant of them if
+     * they are present.
      */
     @Test
     public void testNewLinesExcessive() {
@@ -471,14 +447,8 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
                 connect();
 
                 String[] request = new String[1];
-                request[0] =
-                    newLines +
-                    "GET http://localhost:8080/test HTTP/1.1" + CRLF +
-                    "Host: localhost:8080" + CRLF +
-                    "X-Bug48839: abcd" + CRLF +
-                    "\tefgh" + CRLF +
-                    "Connection: close" + CRLF +
-                    CRLF;
+                request[0] = newLines + "GET http://localhost:8080/test HTTP/1.1" + CRLF + "Host: localhost:8080" +
+                        CRLF + "X-Bug48839: abcd" + CRLF + "\tefgh" + CRLF + "Connection: close" + CRLF + CRLF;
 
                 setRequest(request);
                 processRequest(); // blocks until response has been read
@@ -541,10 +511,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
 
                 String[] request = new String[2];
                 request[0] = "GET http://localhost:8080/test HTTP/1.1" + CR;
-                request[1] = LF +
-                        "Host: localhost:8080" + CRLF +
-                        "Connection: close" + CRLF +
-                        CRLF;
+                request[1] = LF + "Host: localhost:8080" + CRLF + "Connection: close" + CRLF + CRLF;
 
                 setRequest(request);
                 processRequest(); // blocks until response has been read
@@ -611,10 +578,8 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
                 connect();
 
                 String[] request = new String[1];
-                request[0] = "GET http://localhost:8080/test HTTP/1.1" + CRLF +
-                        "Host: localhost:8080" + CRLF +
-                        "X-Header: Ignore" + CRLF +
-                        "X-Header" + (char) 130 + ": Broken" + CRLF + CRLF;
+                request[0] = "GET http://localhost:8080/test HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF +
+                        "X-Header: Ignore" + CRLF + "X-Header" + (char) 130 + ": Broken" + CRLF + CRLF;
 
                 setRequest(request);
                 processRequest(); // blocks until response has been read
@@ -644,11 +609,8 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
     public void testInvalidMethod() {
 
         String[] request = new String[1];
-        request[0] =
-            "GET" + (char) 0 + " /test HTTP/1.1" + CRLF +
-            "Host: localhost:8080" + CRLF +
-            "Connection: close" + CRLF +
-            CRLF;
+        request[0] = "GET" + (char) 0 + " /test HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF + "Connection: close" +
+                CRLF + CRLF;
 
         InvalidClient client = new InvalidClient(request);
 
@@ -676,11 +638,7 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
     public void testInvalidEndOfRequestLine01() {
 
         String[] request = new String[1];
-        request[0] =
-                "GET /test HTTP/1.1" + CR +
-                "Host: localhost:8080" + CRLF +
-                "Connection: close" + CRLF +
-                CRLF;
+        request[0] = "GET /test HTTP/1.1" + CR + "Host: localhost:8080" + CRLF + "Connection: close" + CRLF + CRLF;
 
         InvalidClient client = new InvalidClient(request);
 
@@ -694,12 +652,8 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
     public void testInvalidHeader01() {
 
         String[] request = new String[1];
-        request[0] =
-                "GET /test HTTP/1.1" + CRLF +
-                "Host: localhost:8080" + CRLF +
-                CR + "X-Header: xxx" + CRLF +
-                "Connection: close" + CRLF +
-                CRLF;
+        request[0] = "GET /test HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF + CR + "X-Header: xxx" + CRLF +
+                "Connection: close" + CRLF + CRLF;
 
         InvalidClient client = new InvalidClient(request);
 
@@ -725,12 +679,8 @@ public class TestHttp11InputBuffer extends TomcatBaseTest {
         getTomcatInstance().getConnector().setProperty("rejectIllegalHeader", Boolean.toString(rejectIllegalHeader));
 
         String[] request = new String[1];
-        request[0] =
-                "POST /test HTTP/1.1" + CRLF +
-                "Host: localhost:8080" + CRLF +
-                "Content-Length: 12\u000734" + CRLF +
-                "Connection: close" + CRLF +
-                CRLF;
+        request[0] = "POST /test HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF + "Content-Length: 12\u000734" +
+                CRLF + "Connection: close" + CRLF + CRLF;
 
         InvalidClient client = new InvalidClient(request);
 
diff --git a/test/org/apache/coyote/http11/TestHttp11InputBufferCRLF.java b/test/org/apache/coyote/http11/TestHttp11InputBufferCRLF.java
index a38e6d78ab..d87bfa2cfa 100644
--- a/test/org/apache/coyote/http11/TestHttp11InputBufferCRLF.java
+++ b/test/org/apache/coyote/http11/TestHttp11InputBufferCRLF.java
@@ -45,10 +45,8 @@ public class TestHttp11InputBufferCRLF extends TomcatBaseTest {
 
         // Requests to exercise code that allows HT in place of SP
         parameterSets.add(new Object[] { Boolean.FALSE, new String[] {
-                "GET\t/test\tHTTP/1.1" + CRLF +
-                "Host: localhost:8080" + CRLF +
-               "Connection: close" + CRLF +
-                CRLF }, Boolean.TRUE } );
+                "GET\t/test\tHTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF + "Connection: close" + CRLF + CRLF },
+                Boolean.TRUE });
 
         // Requests to simulate package boundaries
         // HTTP/0.9 request
@@ -68,67 +66,44 @@ public class TestHttp11InputBufferCRLF extends TomcatBaseTest {
         addRequestWithSplits("GET /test " + LF, Boolean.FALSE, Boolean.FALSE, parameterSets);
 
         // Standard HTTP/1.1 request
-        addRequestWithSplits("GET /test HTTP/1.1" + CRLF +
-                "Host: localhost:8080" + CRLF +
-                "Connection: close" + CRLF +
-                CRLF,
+        addRequestWithSplits(
+                "GET /test HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF + "Connection: close" + CRLF + CRLF,
                 Boolean.FALSE, parameterSets);
 
         // Standard HTTP/1.1 request with invalid HTTP protocol
-        addRequestWithSplits("GET /test HTTP/" + CR + "1.1" + CRLF +
-                "Host: localhost:8080" + CRLF +
-                "Connection: close" + CRLF +
-                CRLF,
-                Boolean.FALSE, Boolean.FALSE, parameterSets);
+        addRequestWithSplits("GET /test HTTP/" + CR + "1.1" + CRLF + "Host: localhost:8080" + CRLF +
+                "Connection: close" + CRLF + CRLF, Boolean.FALSE, Boolean.FALSE, parameterSets);
 
         // Invalid (request target) HTTP/1.1 request
-        addRequestWithSplits("GET /te<st HTTP/1.1" + CRLF +
-                "Host: localhost:8080" + CRLF +
-                "Connection: close" + CRLF +
-                CRLF,
+        addRequestWithSplits(
+                "GET /te<st HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF + "Connection: close" + CRLF + CRLF,
                 Boolean.FALSE, Boolean.FALSE, parameterSets);
 
         // Invalid (use of CR) HTTP/1.1 request
-        addRequestWithSplits("GET /test HTTP/1.1" + CRLF +
-                "Host: localhost:8080" + CRLF +
-                "Connection: close" + CRLF +
-                "X-aaa: bbb" + CR + CRLF +
-                CRLF,
-                Boolean.FALSE, Boolean.FALSE, parameterSets);
+        addRequestWithSplits("GET /test HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF + "Connection: close" + CRLF +
+                "X-aaa: bbb" + CR + CRLF + CRLF, Boolean.FALSE, Boolean.FALSE, parameterSets);
 
         // Standard HTTP/1.1 request with a query string
-        addRequestWithSplits("GET /test?a=b HTTP/1.1" + CRLF +
-                "Host: localhost:8080" + CRLF +
-                "Connection: close" + CRLF +
-                CRLF,
+        addRequestWithSplits(
+                "GET /test?a=b HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF + "Connection: close" + CRLF + CRLF,
                 Boolean.FALSE, parameterSets);
 
         // Standard HTTP/1.1 request with a query string that includes ?
-        addRequestWithSplits("GET /test?a=?b HTTP/1.1" + CRLF +
-                "Host: localhost:8080" + CRLF +
-                "Connection: close" + CRLF +
-                CRLF,
+        addRequestWithSplits(
+                "GET /test?a=?b HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF + "Connection: close" + CRLF + CRLF,
                 Boolean.FALSE, parameterSets);
 
         // Standard HTTP/1.1 request with an invalid query string
-        addRequestWithSplits("GET /test?a=<b HTTP/1.1" + CRLF +
-                "Host: localhost:8080" + CRLF +
-                "Connection: close" + CRLF +
-                CRLF,
+        addRequestWithSplits(
+                "GET /test?a=<b HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF + "Connection: close" + CRLF + CRLF,
                 Boolean.FALSE, Boolean.FALSE, parameterSets);
 
         // Standard HTTP/1.1 request using LF rather than CRLF
-        addRequestWithSplits("GET /test HTTP/1.1" + LF +
-                "Host: localhost:8080" + LF +
-                "Connection: close" + LF +
-                LF,
+        addRequestWithSplits("GET /test HTTP/1.1" + LF + "Host: localhost:8080" + LF + "Connection: close" + LF + LF,
                 Boolean.FALSE, parameterSets);
 
         // Invalid HTTP/1.1 request using CR rather than CRLF
-        addRequestWithSplits("GET /test HTTP/1.1" + CR +
-                "Host: localhost:8080" + CR +
-                "Connection: close" + CR +
-                CR,
+        addRequestWithSplits("GET /test HTTP/1.1" + CR + "Host: localhost:8080" + CR + "Connection: close" + CR + CR,
                 Boolean.FALSE, Boolean.FALSE, parameterSets);
 
         return parameterSets;
@@ -139,7 +114,8 @@ public class TestHttp11InputBufferCRLF extends TomcatBaseTest {
         addRequestWithSplits(request, isHttp09, Boolean.TRUE, parameterSets);
     }
 
-    private static void addRequestWithSplits(String request, Boolean isHttp09, Boolean valid, List<Object[]> parameterSets) {
+    private static void addRequestWithSplits(String request, Boolean isHttp09, Boolean valid,
+            List<Object[]> parameterSets) {
         // Add as a single String
         parameterSets.add(new Object[] { isHttp09, new String[] { request }, valid });
 
@@ -182,7 +158,7 @@ public class TestHttp11InputBufferCRLF extends TomcatBaseTest {
 
         if (valid) {
             Assert.assertTrue(client.isResponseBodyOK());
-        } else if (e == null){
+        } else if (e == null) {
             Assert.assertTrue(client.isResponse400());
         } else {
             // The invalid request was detected before the entire request had
diff --git a/test/org/apache/coyote/http11/TestHttp11OutputBuffer.java b/test/org/apache/coyote/http11/TestHttp11OutputBuffer.java
index 43aa9b83a5..d092051e83 100644
--- a/test/org/apache/coyote/http11/TestHttp11OutputBuffer.java
+++ b/test/org/apache/coyote/http11/TestHttp11OutputBuffer.java
@@ -97,7 +97,7 @@ public class TestHttp11OutputBuffer extends TomcatBaseTest {
 
         tomcat.start();
 
-        Map<String,List<String>> resHeaders = new HashMap<>();
+        Map<String, List<String>> resHeaders = new HashMap<>();
         int rc = getUrl("http://localhost:" + getPort() + "/header", new ByteChunk(), resHeaders);
 
         if (valid) {
diff --git a/test/org/apache/coyote/http11/TestHttp11Processor.java b/test/org/apache/coyote/http11/TestHttp11Processor.java
index 9c0c02582c..b3ef4b4fa3 100644
--- a/test/org/apache/coyote/http11/TestHttp11Processor.java
+++ b/test/org/apache/coyote/http11/TestHttp11Processor.java
@@ -77,19 +77,16 @@ public class TestHttp11Processor extends TomcatBaseTest {
         Context ctx = tomcat.addContext("", null);
 
         // Add protected servlet
-        Tomcat.addServlet(ctx, "ChunkedResponseWithErrorServlet",
-                new ResponseWithErrorServlet(true));
+        Tomcat.addServlet(ctx, "ChunkedResponseWithErrorServlet", new ResponseWithErrorServlet(true));
         ctx.addServletMappingDecoded("/*", "ChunkedResponseWithErrorServlet");
 
         tomcat.start();
 
-        String request =
-                "GET /anything HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: any" + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET /anything HTTP/1.1" + SimpleHttpClient.CRLF + "Host: any" + SimpleHttpClient.CRLF +
+                SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -100,7 +97,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
         // Should use chunked encoding
         String transferEncoding = null;
         for (String header : client.getResponseHeaders()) {
-             if (header.startsWith("Transfer-Encoding:")) {
+            if (header.startsWith("Transfer-Encoding:")) {
                 transferEncoding = header.substring(18).trim();
             }
         }
@@ -122,8 +119,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
         }
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
 
             resp.setContentType("text/plain");
             resp.setCharacterEncoding("UTF-8");
@@ -151,14 +147,11 @@ public class TestHttp11Processor extends TomcatBaseTest {
     public void testWithUnknownExpectation() throws Exception {
         getTomcatInstanceTestWebapp(false, true);
 
-        String request =
-            "POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
-            "Host: any" + SimpleHttpClient.CRLF +
-            "Expect: unknown" + SimpleHttpClient.CRLF +
-            SimpleHttpClient.CRLF;
+        String request = "POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF + "Host: any" +
+                SimpleHttpClient.CRLF + "Expect: unknown" + SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(getPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -170,18 +163,13 @@ public class TestHttp11Processor extends TomcatBaseTest {
     public void testWithTEVoid() throws Exception {
         getTomcatInstanceTestWebapp(false, true);
 
-        String request =
-            "POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
-            "Host: any" + SimpleHttpClient.CRLF +
-            "Transfer-encoding: void" + SimpleHttpClient.CRLF +
-            "Content-Length: 9" + SimpleHttpClient.CRLF +
-            "Content-Type: application/x-www-form-urlencoded" +
-                    SimpleHttpClient.CRLF +
-                    SimpleHttpClient.CRLF +
-            "test=data";
+        String request = "POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF + "Host: any" +
+                SimpleHttpClient.CRLF + "Transfer-encoding: void" + SimpleHttpClient.CRLF + "Content-Length: 9" +
+                SimpleHttpClient.CRLF + "Content-Type: application/x-www-form-urlencoded" + SimpleHttpClient.CRLF +
+                SimpleHttpClient.CRLF + "test=data";
 
         Client client = new Client(getPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -193,18 +181,13 @@ public class TestHttp11Processor extends TomcatBaseTest {
     public void testWithTEBuffered() throws Exception {
         getTomcatInstanceTestWebapp(false, true);
 
-        String request =
-            "POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
-            "Host: any" + SimpleHttpClient.CRLF +
-            "Transfer-encoding: buffered" + SimpleHttpClient.CRLF +
-            "Content-Length: 9" + SimpleHttpClient.CRLF +
-            "Content-Type: application/x-www-form-urlencoded" +
-                    SimpleHttpClient.CRLF +
-                    SimpleHttpClient.CRLF +
-            "test=data";
+        String request = "POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF + "Host: any" +
+                SimpleHttpClient.CRLF + "Transfer-encoding: buffered" + SimpleHttpClient.CRLF + "Content-Length: 9" +
+                SimpleHttpClient.CRLF + "Content-Type: application/x-www-form-urlencoded" + SimpleHttpClient.CRLF +
+                SimpleHttpClient.CRLF + "test=data";
 
         Client client = new Client(getPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -229,22 +212,15 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         getTomcatInstanceTestWebapp(false, true);
 
-        String request =
-            "POST /test/echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
-            "Host: any" + SimpleHttpClient.CRLF +
-            (withCL ? "Content-length: 1" + SimpleHttpClient.CRLF : "") +
-            "Transfer-encoding: chunked" + SimpleHttpClient.CRLF +
-            "Content-Type: application/x-www-form-urlencoded" +
-                    SimpleHttpClient.CRLF +
-            "Connection: close" + SimpleHttpClient.CRLF +
-            SimpleHttpClient.CRLF +
-            "9" + SimpleHttpClient.CRLF +
-            "test=data" + SimpleHttpClient.CRLF +
-            "0" + SimpleHttpClient.CRLF +
-            SimpleHttpClient.CRLF;
+        String request = "POST /test/echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF + "Host: any" +
+                SimpleHttpClient.CRLF + (withCL ? "Content-length: 1" + SimpleHttpClient.CRLF : "") +
+                "Transfer-encoding: chunked" + SimpleHttpClient.CRLF +
+                "Content-Type: application/x-www-form-urlencoded" + SimpleHttpClient.CRLF + "Connection: close" +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF + "9" + SimpleHttpClient.CRLF + "test=data" +
+                SimpleHttpClient.CRLF + "0" + SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(getPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -257,18 +233,13 @@ public class TestHttp11Processor extends TomcatBaseTest {
     public void testWithTESavedRequest() throws Exception {
         getTomcatInstanceTestWebapp(false, true);
 
-        String request =
-            "POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
-            "Host: any" + SimpleHttpClient.CRLF +
-            "Transfer-encoding: savedrequest" + SimpleHttpClient.CRLF +
-            "Content-Length: 9" + SimpleHttpClient.CRLF +
-            "Content-Type: application/x-www-form-urlencoded" +
-                    SimpleHttpClient.CRLF +
-                    SimpleHttpClient.CRLF +
-            "test=data";
+        String request = "POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF + "Host: any" +
+                SimpleHttpClient.CRLF + "Transfer-encoding: savedrequest" + SimpleHttpClient.CRLF +
+                "Content-Length: 9" + SimpleHttpClient.CRLF + "Content-Type: application/x-www-form-urlencoded" +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF + "test=data";
 
         Client client = new Client(getPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -280,18 +251,13 @@ public class TestHttp11Processor extends TomcatBaseTest {
     public void testWithTEUnsupported() throws Exception {
         getTomcatInstanceTestWebapp(false, true);
 
-        String request =
-            "POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
-            "Host: any" + SimpleHttpClient.CRLF +
-            "Transfer-encoding: unsupported" + SimpleHttpClient.CRLF +
-            "Content-Length: 9" + SimpleHttpClient.CRLF +
-            "Content-Type: application/x-www-form-urlencoded" +
-                    SimpleHttpClient.CRLF +
-                    SimpleHttpClient.CRLF +
-            "test=data";
+        String request = "POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF + "Host: any" +
+                SimpleHttpClient.CRLF + "Transfer-encoding: unsupported" + SimpleHttpClient.CRLF + "Content-Length: 9" +
+                SimpleHttpClient.CRLF + "Content-Type: application/x-www-form-urlencoded" + SimpleHttpClient.CRLF +
+                SimpleHttpClient.CRLF + "test=data";
 
         Client client = new Client(getPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -312,14 +278,11 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String requestPart1 =
-            "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF;
-        String requestPart2 =
-            "Host: any" + SimpleHttpClient.CRLF +
-            SimpleHttpClient.CRLF;
+        String requestPart1 = "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF;
+        String requestPart2 = "Host: any" + SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         final Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {requestPart1, requestPart2});
+        client.setRequest(new String[] { requestPart1, requestPart2 });
         client.setRequestPause(1000);
         client.setUseContentLength(true);
         client.connect();
@@ -371,16 +334,12 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: any" + SimpleHttpClient.CRLF +
-                SimpleHttpClient.CRLF +
-                "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: any" + SimpleHttpClient.CRLF +
-                SimpleHttpClient.CRLF;
+        String request = "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: any" + SimpleHttpClient.CRLF +
+                SimpleHttpClient.CRLF + "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: any" +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         final Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
         client.setUseContentLength(true);
         client.connect();
         client.sendRequest();
@@ -407,16 +366,14 @@ public class TestHttp11Processor extends TomcatBaseTest {
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
 
-        Tomcat.addServlet(ctx, "NoContentLengthFlushingServlet",
-                new NoContentLengthFlushingServlet());
+        Tomcat.addServlet(ctx, "NoContentLengthFlushingServlet", new NoContentLengthFlushingServlet());
         ctx.addServletMappingDecoded("/test", "NoContentLengthFlushingServlet");
 
         tomcat.start();
 
         ByteChunk responseBody = new ByteChunk();
-        Map<String,List<String>> responseHeaders = new HashMap<>();
-        int rc = getUrl("http://localhost:" + getPort() + "/test", responseBody,
-                responseHeaders);
+        Map<String, List<String>> responseHeaders = new HashMap<>();
+        int rc = getUrl("http://localhost:" + getPort() + "/test", responseBody, responseHeaders);
 
         Assert.assertEquals(HttpServletResponse.SC_OK, rc);
 
@@ -425,8 +382,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
     }
 
     @Test
-    public void testNoChunking11NoContentLengthConnectionClose()
-            throws Exception {
+    public void testNoChunking11NoContentLengthConnectionClose() throws Exception {
 
         Tomcat tomcat = getTomcatInstance();
 
@@ -435,15 +391,13 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         Tomcat.addServlet(ctx, "NoContentLengthConnectionCloseFlushingServlet",
                 new NoContentLengthConnectionCloseFlushingServlet());
-        ctx.addServletMappingDecoded("/test",
-                "NoContentLengthConnectionCloseFlushingServlet");
+        ctx.addServletMappingDecoded("/test", "NoContentLengthConnectionCloseFlushingServlet");
 
         tomcat.start();
 
         ByteChunk responseBody = new ByteChunk();
-        Map<String,List<String>> responseHeaders = new HashMap<>();
-        int rc = getUrl("http://localhost:" + getPort() + "/test", responseBody,
-                responseHeaders);
+        Map<String, List<String>> responseHeaders = new HashMap<>();
+        int rc = getUrl("http://localhost:" + getPort() + "/test", responseBody, responseHeaders);
 
         Assert.assertEquals(HttpServletResponse.SC_OK, rc);
 
@@ -471,8 +425,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
 
-        Tomcat.addServlet(ctx, "LargeHeaderServlet",
-                new LargeHeaderServlet(flush));
+        Tomcat.addServlet(ctx, "LargeHeaderServlet", new LargeHeaderServlet(flush));
         ctx.addServletMappingDecoded("/test", "LargeHeaderServlet");
 
         tomcat.start();
@@ -510,31 +463,22 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request1 = "GET /async?1 HTTP/1.1\r\n" +
-                "Host: localhost:" + getPort() + "\r\n" +
-                "Connection: keep-alive\r\n" +
-                "Cache-Control: max-age=0\r\n" +
+        String request1 = "GET /async?1 HTTP/1.1\r\n" + "Host: localhost:" + getPort() + "\r\n" +
+                "Connection: keep-alive\r\n" + "Cache-Control: max-age=0\r\n" +
                 "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\n" +
-                "User-Agent: Request1\r\n" +
-                "Accept-Encoding: gzip,deflate,sdch\r\n" +
+                "User-Agent: Request1\r\n" + "Accept-Encoding: gzip,deflate,sdch\r\n" +
                 "Accept-Language: en-US,en;q=0.8,fr;q=0.6,es;q=0.4\r\n" +
-                "Cookie: something.that.should.not.leak=true\r\n" +
-                "\r\n";
+                "Cookie: something.that.should.not.leak=true\r\n" + "\r\n";
 
-        String request2 = "GET /async?2 HTTP/1.1\r\n" +
-                "Host: localhost:" + getPort() + "\r\n" +
-                "Connection: keep-alive\r\n" +
-                "Cache-Control: max-age=0\r\n" +
+        String request2 = "GET /async?2 HTTP/1.1\r\n" + "Host: localhost:" + getPort() + "\r\n" +
+                "Connection: keep-alive\r\n" + "Cache-Control: max-age=0\r\n" +
                 "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\n" +
-                "User-Agent: Request2\r\n" +
-                "Accept-Encoding: gzip,deflate,sdch\r\n" +
-                "Accept-Language: en-US,en;q=0.8,fr;q=0.6,es;q=0.4\r\n" +
-                "\r\n";
+                "User-Agent: Request2\r\n" + "Accept-Encoding: gzip,deflate,sdch\r\n" +
+                "Accept-Language: en-US,en;q=0.8,fr;q=0.6,es;q=0.4\r\n" + "\r\n";
 
         try (Socket connection = new Socket("localhost", getPort())) {
             connection.setSoLinger(true, 0);
-            Writer writer = new OutputStreamWriter(connection.getOutputStream(),
-                    StandardCharsets.US_ASCII);
+            Writer writer = new OutputStreamWriter(connection.getOutputStream(), StandardCharsets.US_ASCII);
             writer.write(request1);
             writer.flush();
 
@@ -547,8 +491,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         try (Socket connection = new Socket("localhost", getPort())) {
             connection.setSoLinger(true, 0);
-            Writer writer = new OutputStreamWriter(connection.getOutputStream(),
-                    B2CConverter.getCharset("US-ASCII"));
+            Writer writer = new OutputStreamWriter(connection.getOutputStream(), B2CConverter.getCharset("US-ASCII"));
             writer.write(request2);
             writer.flush();
             connection.getInputStream().read();
@@ -590,18 +533,15 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "POST /echo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: localhost:" + getPort() + SimpleHttpClient.CRLF +
-                "Content-Length: 10" + SimpleHttpClient.CRLF;
+        String request = "POST /echo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: localhost:" + getPort() +
+                SimpleHttpClient.CRLF + "Content-Length: 10" + SimpleHttpClient.CRLF;
         if (useExpectation) {
             request += "Expect: 100-continue" + SimpleHttpClient.CRLF;
         }
-        request += SimpleHttpClient.CRLF +
-                   "HelloWorld";
+        request += SimpleHttpClient.CRLF + "HelloWorld";
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
         client.setUseContentLength(true);
 
         client.connect();
@@ -674,10 +614,8 @@ public class TestHttp11Processor extends TomcatBaseTest {
         }
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
-            String largeValue =
-                    CharBuffer.allocate(10000).toString().replace('\0', 'x');
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+            String largeValue = CharBuffer.allocate(10000).toString().replace('\0', 'x');
             resp.setHeader("x-Test", largeValue);
             if (flush) {
                 resp.flushBuffer();
@@ -690,14 +628,12 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
     // flushes with no content-length set
     // should result in chunking on HTTP 1.1
-    private static final class NoContentLengthFlushingServlet
-            extends HttpServlet {
+    private static final class NoContentLengthFlushingServlet extends HttpServlet {
 
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             resp.setStatus(HttpServletResponse.SC_OK);
             resp.setContentType("text/plain");
             resp.getWriter().write("OK");
@@ -707,14 +643,12 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
     // flushes with no content-length set but sets Connection: close header
     // should no result in chunking on HTTP 1.1
-    private static final class NoContentLengthConnectionCloseFlushingServlet
-            extends HttpServlet {
+    private static final class NoContentLengthConnectionCloseFlushingServlet extends HttpServlet {
 
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             resp.setStatus(HttpServletResponse.SC_OK);
             resp.setContentType("text/event-stream");
             resp.addHeader("Connection", "close");
@@ -738,8 +672,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
 
     /*
-     * Partially read chunked input is not swallowed when it is read during
-     * async processing.
+     * Partially read chunked input is not swallowed when it is read during async processing.
      */
     @Test
     public void testBug57621a() throws Exception {
@@ -830,18 +763,10 @@ public class TestHttp11Processor extends TomcatBaseTest {
         private Exception doRequest() {
             try {
                 String[] request = new String[2];
-                request[0] =
-                    "PUT http://localhost:8080/test HTTP/1.1" + CRLF +
-                    "Host: localhost:8080" + CRLF +
-                    "Transfer-encoding: chunked" + CRLF +
-                    CRLF +
-                    "2" + CRLF +
-                    "OK";
-
-                request[1] =
-                    CRLF +
-                    "0" + CRLF +
-                    CRLF;
+                request[0] = "PUT http://localhost:8080/test HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF +
+                        "Transfer-encoding: chunked" + CRLF + CRLF + "2" + CRLF + "OK";
+
+                request[1] = CRLF + "0" + CRLF + CRLF;
 
                 setRequest(request);
                 processRequest(); // blocks until response has been read
@@ -877,14 +802,12 @@ public class TestHttp11Processor extends TomcatBaseTest {
         tomcat.start();
 
         ByteChunk getBody = new ByteChunk();
-        Map<String,List<String>> getHeaders = new HashMap<>();
-        int getStatus = getUrl("http://localhost:" + getPort() + "/test", getBody,
-                getHeaders);
+        Map<String, List<String>> getHeaders = new HashMap<>();
+        int getStatus = getUrl("http://localhost:" + getPort() + "/test", getBody, getHeaders);
 
         ByteChunk headBody = new ByteChunk();
-        Map<String,List<String>> headHeaders = new HashMap<>();
-        int headStatus = getUrl("http://localhost:" + getPort() + "/test", headBody,
-                headHeaders);
+        Map<String, List<String>> headHeaders = new HashMap<>();
+        int headStatus = getUrl("http://localhost:" + getPort() + "/test", headBody, headHeaders);
 
         Assert.assertEquals(HttpServletResponse.SC_OK, getStatus);
         Assert.assertEquals(HttpServletResponse.SC_OK, headStatus);
@@ -905,20 +828,17 @@ public class TestHttp11Processor extends TomcatBaseTest {
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
         }
 
         @Override
-        protected void doHead(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
         }
     }
 
 
     /*
-     * Tests what happens if a request is completed during a dispatch but the
-     * request body has not been fully read.
+     * Tests what happens if a request is completed during a dispatch but the request body has not been fully read.
      */
     @Test
     public void testRequestBodySwallowing() throws Exception {
@@ -938,7 +858,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
         SocketAddress addr = new InetSocketAddress("localhost", getPort());
         Socket socket = new Socket();
         socket.setSoTimeout(300000);
-        socket.connect(addr,300000);
+        socket.connect(addr, 300000);
         OutputStream os = socket.getOutputStream();
         Writer writer = new OutputStreamWriter(os, "ISO-8859-1");
         InputStream is = socket.getInputStream();
@@ -998,8 +918,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doPost(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             if (DispatcherType.ASYNC.equals(req.getDispatcherType())) {
                 resp.setContentType("text/plain");
                 resp.setCharacterEncoding("UTF-8");
@@ -1024,7 +943,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
         tomcat.start();
 
         ByteChunk responseBody = new ByteChunk();
-        Map<String,List<String>> responseHeaders = new HashMap<>();
+        Map<String, List<String>> responseHeaders = new HashMap<>();
         int rc = getUrl("http://localhost:" + getPort() + "/test", responseBody, responseHeaders);
 
         Assert.assertEquals(HttpServletResponse.SC_RESET_CONTENT, rc);
@@ -1038,8 +957,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             resp.setStatus(205);
         }
     }
@@ -1064,14 +982,11 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: a" + SimpleHttpClient.CRLF +
-                "Host: b" + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: a" + SimpleHttpClient.CRLF + "Host: b" +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -1100,14 +1015,11 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: a" + SimpleHttpClient.CRLF +
-                "Host: a" + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: a" + SimpleHttpClient.CRLF + "Host: a" +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -1133,12 +1045,10 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -1164,13 +1074,11 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET http://a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: b" + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET http://a/foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: b" + SimpleHttpClient.CRLF +
+                SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -1196,13 +1104,11 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET http://a:8080/foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: b:8080" + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET http://a:8080/foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: b:8080" +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -1228,13 +1134,11 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET http://user:pwd@a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: b" + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET http://user:pwd@a/foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: b" +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -1244,9 +1148,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
     }
 
     /*
-     * Hostname (no port) is included in the request line, but Host header
-     * is empty.
-     * Added for bug 62739.
+     * Hostname (no port) is included in the request line, but Host header is empty. Added for bug 62739.
      */
     @Test
     public void testInconsistentHostHeader04() throws Exception {
@@ -1265,13 +1167,11 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET http://a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: " + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET http://a/foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: " + SimpleHttpClient.CRLF +
+                SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -1281,9 +1181,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
     }
 
     /*
-     * Hostname (with port) is included in the request line, but Host header
-     * is empty.
-     * Added for bug 62739.
+     * Hostname (with port) is included in the request line, but Host header is empty. Added for bug 62739.
      */
     @Test
     public void testInconsistentHostHeader05() throws Exception {
@@ -1302,13 +1200,11 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET http://a:8080/foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: " + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET http://a:8080/foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: " + SimpleHttpClient.CRLF +
+                SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -1318,9 +1214,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
     }
 
     /*
-     * Hostname (with port and user) is included in the request line, but Host
-     * header is empty.
-     * Added for bug 62739.
+     * Hostname (with port and user) is included in the request line, but Host header is empty. Added for bug 62739.
      */
     @Test
     public void testInconsistentHostHeader06() throws Exception {
@@ -1339,13 +1233,11 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET http://user:pwd@a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: " + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET http://user:pwd@a/foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: " +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -1375,20 +1267,19 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET http://a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: a" + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET http://a/foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: a" + SimpleHttpClient.CRLF +
+                SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
 
         // Expected response is a 200 response.
         Assert.assertTrue(client.isResponse200());
-        Assert.assertEquals("request.getServerName() is [a] and request.getServerPort() is 80", client.getResponseBody());
+        Assert.assertEquals("request.getServerName() is [a] and request.getServerPort() is 80",
+                client.getResponseBody());
     }
 
     /*
@@ -1411,26 +1302,24 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET http://a:8080/foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: a:8080" + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET http://a:8080/foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: a:8080" +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
 
         // Expected response is a 200 response.
         Assert.assertTrue(client.isResponse200());
-        Assert.assertEquals("request.getServerName() is [a] and request.getServerPort() is 8080", client.getResponseBody());
+        Assert.assertEquals("request.getServerName() is [a] and request.getServerPort() is 8080",
+                client.getResponseBody());
 
     }
 
     /*
-     * Request line host is an exact match for Host header
-     * (no port, with user info)
+     * Request line host is an exact match for Host header (no port, with user info)
      */
     @Test
     public void testConsistentHostHeader03() throws Exception {
@@ -1449,26 +1338,24 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET http://user:pwd@a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: a" + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET http://user:pwd@a/foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: a" +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
 
         // Expected response is a 200 response.
         Assert.assertTrue(client.isResponse200());
-        Assert.assertEquals("request.getServerName() is [a] and request.getServerPort() is 80", client.getResponseBody());
+        Assert.assertEquals("request.getServerName() is [a] and request.getServerPort() is 80",
+                client.getResponseBody());
     }
 
     /*
-     * Host header exists but its value is an empty string.  This is valid if
-     * the request line does not include a hostname/port.
-     * Added for bug 62739.
+     * Host header exists but its value is an empty string. This is valid if the request line does not include a
+     * hostname/port. Added for bug 62739.
      */
     @Test
     public void testBlankHostHeader01() throws Exception {
@@ -1487,27 +1374,24 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: " + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: " + SimpleHttpClient.CRLF +
+                SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
 
         // Expected response is a 200 response.
         Assert.assertTrue(client.isResponse200());
-        Assert.assertEquals("request.getServerName() is [] and request.getServerPort() is " + getPort(), client.getResponseBody());
+        Assert.assertEquals("request.getServerName() is [] and request.getServerPort() is " + getPort(),
+                client.getResponseBody());
     }
 
     /*
-     * Host header exists but has its value is empty (and there are multiple
-     * spaces after the ':'.  This is valid if the request line does not
-     * include a hostname/port.
-     * Added for bug 62739.
+     * Host header exists but has its value is empty (and there are multiple spaces after the ':'. This is valid if the
+     * request line does not include a hostname/port. Added for bug 62739.
      */
     @Test
     public void testBlankHostHeader02() throws Exception {
@@ -1526,20 +1410,19 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host:      " + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host:      " + SimpleHttpClient.CRLF +
+                SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
 
         // Expected response is a 200 response.
         Assert.assertTrue(client.isResponse200());
-        Assert.assertEquals("request.getServerName() is [] and request.getServerPort() is " + getPort(), client.getResponseBody());
+        Assert.assertEquals("request.getServerName() is [] and request.getServerPort() is " + getPort(),
+                client.getResponseBody());
     }
 
 
@@ -1603,8 +1486,8 @@ public class TestHttp11Processor extends TomcatBaseTest {
         doTestKeepAliveHeader(true, -1, -1, true);
     }
 
-    private void doTestKeepAliveHeader(boolean sendKeepAlive, int keepAliveTimeout,
-            int maxKeepAliveRequests, boolean explicitClose) throws Exception {
+    private void doTestKeepAliveHeader(boolean sendKeepAlive, int keepAliveTimeout, int maxKeepAliveRequests,
+            boolean explicitClose) throws Exception {
         Tomcat tomcat = getTomcatInstance();
 
         tomcat.getConnector().setProperty("keepAliveTimeout", Integer.toString(keepAliveTimeout));
@@ -1619,9 +1502,8 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: localhost:" + getPort() + SimpleHttpClient.CRLF;
+        String request = "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: localhost:" + getPort() +
+                SimpleHttpClient.CRLF;
 
         if (sendKeepAlive) {
             request += "Connection: keep-alive" + SimpleHttpClient.CRLF;
@@ -1630,7 +1512,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
         request += SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest(false);
@@ -1651,16 +1533,14 @@ public class TestHttp11Processor extends TomcatBaseTest {
         if (explicitClose) {
             Assert.assertEquals("close", connectionHeaderValue);
             Assert.assertNull(keepAliveHeaderValue);
-        } else if (!sendKeepAlive || keepAliveTimeout < 0
-            && (maxKeepAliveRequests < 0 || maxKeepAliveRequests > 1)) {
+        } else if (!sendKeepAlive || keepAliveTimeout < 0 && (maxKeepAliveRequests < 0 || maxKeepAliveRequests > 1)) {
             Assert.assertNull(connectionHeaderValue);
             Assert.assertNull(keepAliveHeaderValue);
         } else {
             List<String> connectionHeaders = new ArrayList<>();
             TokenList.parseTokenList(new StringReader(connectionHeaderValue), connectionHeaders);
 
-            if (sendKeepAlive && keepAliveTimeout > 0 &&
-                (maxKeepAliveRequests < 0 || maxKeepAliveRequests > 1)) {
+            if (sendKeepAlive && keepAliveTimeout > 0 && (maxKeepAliveRequests < 0 || maxKeepAliveRequests > 1)) {
                 Assert.assertEquals(1, connectionHeaders.size());
                 Assert.assertEquals("keep-alive", connectionHeaders.get(0));
                 Assert.assertEquals("timeout=" + keepAliveTimeout / 1000L, keepAliveHeaderValue);
@@ -1676,29 +1556,21 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
 
     /**
-     * Test servlet that prints out the values of
-     * HttpServletRequest.getServerName() and
-     * HttpServletRequest.getServerPort() in the response body, e.g.:
-     *
-     * "request.getServerName() is [foo] and request.getServerPort() is 8080"
-     *
-     * or:
-     *
-     * "request.getServerName() is null and request.getServerPort() is 8080"
+     * Test servlet that prints out the values of HttpServletRequest.getServerName() and
+     * HttpServletRequest.getServerPort() in the response body, e.g.: "request.getServerName() is [foo] and
+     * request.getServerPort() is 8080" or: "request.getServerName() is null and request.getServerPort() is 8080"
      */
     private static class ServerNameTesterServlet extends HttpServlet {
 
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
 
             resp.setContentType("text/plain");
             PrintWriter out = resp.getWriter();
 
-            if (null == req.getServerName())
-            {
+            if (null == req.getServerName()) {
                 out.print("request.getServerName() is null");
             } else {
                 out.print("request.getServerName() is [" + req.getServerName() + "]");
@@ -1747,14 +1619,11 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "POST /foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: localhost:" + getPort() + SimpleHttpClient.CRLF +
-                "Content-Length: 10" + SimpleHttpClient.CRLF +
-                 SimpleHttpClient.CRLF;
+        String request = "POST /foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: localhost:" + getPort() +
+                SimpleHttpClient.CRLF + "Content-Length: 10" + SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request, "XXXXXXXXXX"});
+        client.setRequest(new String[] { request, "XXXXXXXXXX" });
         client.setRequestPause(delay);
 
         client.connect();
@@ -1788,8 +1657,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
         }
 
         @Override
-        protected void doPost(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
 
             // Swallow the body
             byte[] buf = new byte[1024];
@@ -1809,8 +1677,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
         private static final long serialVersionUID = 1L;
 
         @Override
-        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws ServletException, IOException {
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
 
             // Get requests can have bodies although these requests don't.
             // Needs to be async to trigger the problematic code path
@@ -1907,14 +1774,12 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-                "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: localhost:" + getPort() + SimpleHttpClient.CRLF +
-                "Transfer-Encoding: " + headerValue + SimpleHttpClient.CRLF +
+        String request = "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: localhost:" + getPort() +
+                SimpleHttpClient.CRLF + "Transfer-Encoding: " + headerValue + SimpleHttpClient.CRLF +
                 SimpleHttpClient.CRLF;
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest(false);
@@ -1932,21 +1797,14 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         getTomcatInstanceTestWebapp(false, true);
 
-        String request =
-            "POST /test/echo-params.jsp HTTP/1.0" + SimpleHttpClient.CRLF +
-            "Host: any" + SimpleHttpClient.CRLF +
-            "Transfer-encoding: chunked" + SimpleHttpClient.CRLF +
-            "Content-Type: application/x-www-form-urlencoded" +
-                    SimpleHttpClient.CRLF +
-            "Connection: close" + SimpleHttpClient.CRLF +
-            SimpleHttpClient.CRLF +
-            "9" + SimpleHttpClient.CRLF +
-            "test=data" + SimpleHttpClient.CRLF +
-            "0" + SimpleHttpClient.CRLF +
-            SimpleHttpClient.CRLF;
+        String request = "POST /test/echo-params.jsp HTTP/1.0" + SimpleHttpClient.CRLF + "Host: any" +
+                SimpleHttpClient.CRLF + "Transfer-encoding: chunked" + SimpleHttpClient.CRLF +
+                "Content-Type: application/x-www-form-urlencoded" + SimpleHttpClient.CRLF + "Connection: close" +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF + "9" + SimpleHttpClient.CRLF + "test=data" +
+                SimpleHttpClient.CRLF + "0" + SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(getPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();
@@ -1971,16 +1829,12 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         tomcat.start();
 
-        String request =
-            "POST /foo HTTP/1.1" + SimpleHttpClient.CRLF +
-                "Host: localhost:" + getPort() + SimpleHttpClient.CRLF +
-                "Expect: 100-continue"  + SimpleHttpClient.CRLF +
-                "Content-Length: 10"  + SimpleHttpClient.CRLF +
-                SimpleHttpClient.CRLF +
-                "0123456789";
+        String request = "POST /foo HTTP/1.1" + SimpleHttpClient.CRLF + "Host: localhost:" + getPort() +
+                SimpleHttpClient.CRLF + "Expect: 100-continue" + SimpleHttpClient.CRLF + "Content-Length: 10" +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF + "0123456789";
 
         Client client = new Client(tomcat.getConnector().getLocalPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest(false);
@@ -2002,13 +1856,11 @@ public class TestHttp11Processor extends TomcatBaseTest {
     public void testConnect() throws Exception {
         getTomcatInstanceTestWebapp(false, true);
 
-        String request =
-            "CONNECT example.local HTTP/1.1" + SimpleHttpClient.CRLF +
-            "Host: example.local" + SimpleHttpClient.CRLF +
-            SimpleHttpClient.CRLF;
+        String request = "CONNECT example.local HTTP/1.1" + SimpleHttpClient.CRLF + "Host: example.local" +
+                SimpleHttpClient.CRLF + SimpleHttpClient.CRLF;
 
         Client client = new Client(getPort());
-        client.setRequest(new String[] {request});
+        client.setRequest(new String[] { request });
 
         client.connect();
         client.processRequest();


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


[tomcat] 02/06: Use i18n

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a34d9daeb6d32590c24319dfc918edde673274ee
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Feb 23 16:41:59 2023 +0000

    Use i18n
---
 java/org/apache/catalina/connector/CoyoteAdapter.java      | 10 +++++-----
 java/org/apache/catalina/connector/LocalStrings.properties |  3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java
index 04afae184f..efe8dd61e7 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -629,7 +629,7 @@ public class CoyoteAdapter implements Adapter {
                 connector.getService().getContainer().logAccess(request, response, 0, true);
                 return false;
             } else {
-                response.sendError(400, "Invalid URI");
+                response.sendError(400, sm.getString("coyoteAdapter.invalidURI"));
             }
         }
 
@@ -643,7 +643,7 @@ public class CoyoteAdapter implements Adapter {
             if (undecodedURI.getType() == MessageBytes.T_BYTES) {
                 if (connector.getRejectSuspiciousURIs()) {
                     if (checkSuspiciousURIs(undecodedURI.getByteChunk())) {
-                        response.sendError(400, "Invalid URI");
+                        response.sendError(400, sm.getString("coyoteAdapter.invalidURI"));
                     }
                 }
 
@@ -658,7 +658,7 @@ public class CoyoteAdapter implements Adapter {
                 try {
                     req.getURLDecoder().convert(decodedURI.getByteChunk(), connector.getEncodedSolidusHandlingInternal());
                 } catch (IOException ioe) {
-                    response.sendError(400, "Invalid URI: " + ioe.getMessage());
+                    response.sendError(400, sm.getString("coyoteAdapter.invalidURIWithMessage", ioe.getMessage()));
                 }
                 // Normalization
                 if (normalize(req.decodedURI(), connector.getAllowBackslash())) {
@@ -668,7 +668,7 @@ public class CoyoteAdapter implements Adapter {
                     // Therefore it is not necessary to check that the URI remains
                     // normalized after character decoding
                 } else {
-                    response.sendError(400, "Invalid URI");
+                    response.sendError(400, sm.getString("coyoteAdapter.invalidURI"));
                 }
             } else {
                 /* The URI is chars or String, and has been sent using an in-memory
@@ -866,7 +866,7 @@ public class CoyoteAdapter implements Adapter {
             if (header != null) {
                 res.addHeader("Allow", header);
             }
-            response.sendError(405, "TRACE method is not allowed");
+            response.sendError(405, sm.getString("coyoteAdapter.trace"));
             // Safe to skip the remainder of this method.
             return true;
         }
diff --git a/java/org/apache/catalina/connector/LocalStrings.properties b/java/org/apache/catalina/connector/LocalStrings.properties
index aaf3dd675a..2b0e8c6998 100644
--- a/java/org/apache/catalina/connector/LocalStrings.properties
+++ b/java/org/apache/catalina/connector/LocalStrings.properties
@@ -21,7 +21,10 @@ coyoteAdapter.checkRecycled.request=Encountered a non-recycled request and recyc
 coyoteAdapter.checkRecycled.response=Encountered a non-recycled response and recycled it forcedly.
 coyoteAdapter.connect=HTTP requests using the CONNECT method are not supported
 coyoteAdapter.debug=The variable [{0}] has value [{1}]
+coyoteAdapter.invalidURI=Invalid URI
+coyoteAdapter.invalidURIWithMessage=Invalid URI: [{0}]
 coyoteAdapter.nullRequest=An asynchronous dispatch may only happen on an existing request
+coyoteAdapter.trace=TRACE method is not allowed
 
 coyoteConnector.invalidEncoding=The encoding [{0}] is not recognised by the JRE. The Connector will continue to use [{1}]
 coyoteConnector.invalidPort=The connector cannot start since the specified port value of [{0}] is invalid


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