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/01/24 13:13:12 UTC

[tomcat] branch 9.0.x updated: Code cleanup (format). No functional change.

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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new fc20e55be0 Code cleanup (format). No functional change.
fc20e55be0 is described below

commit fc20e55be011eb22bf064c726d8a4f14aa1073a5
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jan 24 13:13:05 2023 +0000

    Code cleanup (format). No functional change.
---
 .../org/apache/catalina/core/AccessLogAdapter.java |    2 +-
 .../apache/catalina/core/ApplicationContext.java   |  180 +--
 .../catalina/core/ApplicationContextFacade.java    |  329 ++--
 .../catalina/core/ApplicationDispatcher.java       |  329 ++--
 .../catalina/core/ApplicationFilterChain.java      |  113 +-
 .../catalina/core/ApplicationFilterConfig.java     |  114 +-
 .../catalina/core/ApplicationFilterFactory.java    |   75 +-
 .../core/ApplicationFilterRegistration.java        |   21 +-
 .../catalina/core/ApplicationHttpRequest.java      |  161 +-
 .../catalina/core/ApplicationHttpResponse.java     |   59 +-
 .../apache/catalina/core/ApplicationMapping.java   |    7 +-
 java/org/apache/catalina/core/ApplicationPart.java |   13 +-
 .../catalina/core/ApplicationPushBuilder.java      |   32 +-
 .../apache/catalina/core/ApplicationRequest.java   |   53 +-
 .../apache/catalina/core/ApplicationResponse.java  |   32 +-
 .../core/ApplicationServletRegistration.java       |   22 +-
 .../core/ApplicationSessionCookieConfig.java       |   58 +-
 .../apache/catalina/core/AprLifecycleListener.java |  104 +-
 .../org/apache/catalina/core/AsyncContextImpl.java |  103 +-
 .../apache/catalina/core/AsyncListenerWrapper.java |    3 +-
 java/org/apache/catalina/core/ContainerBase.java   |  360 ++---
 .../catalina/core/DefaultInstanceManager.java      |  284 ++--
 .../apache/catalina/core/FrameworkListener.java    |   13 +-
 .../apache/catalina/core/JniLifecycleListener.java |   12 +-
 .../core/JreMemoryLeakPreventionListener.java      |  258 ++-
 .../catalina/core/NamingContextListener.java       |  173 +-
 java/org/apache/catalina/core/StandardContext.java | 1666 ++++++++------------
 .../apache/catalina/core/StandardContextValve.java |   27 +-
 java/org/apache/catalina/core/StandardEngine.java  |  103 +-
 .../apache/catalina/core/StandardEngineValve.java  |   20 +-
 java/org/apache/catalina/core/StandardHost.java    |  178 +--
 .../apache/catalina/core/StandardHostValve.java    |   81 +-
 .../org/apache/catalina/core/StandardPipeline.java |   93 +-
 java/org/apache/catalina/core/StandardServer.java  |  146 +-
 java/org/apache/catalina/core/StandardService.java |   76 +-
 .../catalina/core/StandardThreadExecutor.java      |   36 +-
 java/org/apache/catalina/core/StandardWrapper.java |  437 ++---
 .../catalina/core/StandardWrapperFacade.java       |    4 +-
 .../apache/catalina/core/StandardWrapperValve.java |  119 +-
 .../core/ThreadLocalLeakPreventionListener.java    |   49 +-
 40 files changed, 2367 insertions(+), 3578 deletions(-)

diff --git a/java/org/apache/catalina/core/AccessLogAdapter.java b/java/org/apache/catalina/core/AccessLogAdapter.java
index e3705664d1..8a107a4409 100644
--- a/java/org/apache/catalina/core/AccessLogAdapter.java
+++ b/java/org/apache/catalina/core/AccessLogAdapter.java
@@ -44,7 +44,7 @@ public class AccessLogAdapter implements AccessLog {
 
     @Override
     public void log(Request request, Response response, long time) {
-        for (AccessLog log: logs) {
+        for (AccessLog log : logs) {
             log.log(request, response, time);
         }
     }
diff --git a/java/org/apache/catalina/core/ApplicationContext.java b/java/org/apache/catalina/core/ApplicationContext.java
index 7dbc88bd73..73653db8d7 100644
--- a/java/org/apache/catalina/core/ApplicationContext.java
+++ b/java/org/apache/catalina/core/ApplicationContext.java
@@ -80,9 +80,8 @@ import org.apache.tomcat.util.res.StringManager;
 
 
 /**
- * Standard implementation of <code>ServletContext</code> that represents
- * a web application's execution environment.  An instance of this class is
- * associated with each instance of <code>StandardContext</code>.
+ * Standard implementation of <code>ServletContext</code> that represents a web application's execution environment. An
+ * instance of this class is associated with each instance of <code>StandardContext</code>.
  *
  * @author Craig R. McClanahan
  * @author Remy Maucherat
@@ -96,8 +95,8 @@ public class ApplicationContext implements ServletContext {
     static {
         STRICT_SERVLET_COMPLIANCE = Globals.STRICT_SERVLET_COMPLIANCE;
 
-        String requireSlash = System.getProperty(
-                "org.apache.catalina.core.ApplicationContext.GET_RESOURCE_REQUIRE_SLASH");
+        String requireSlash = System
+                .getProperty("org.apache.catalina.core.ApplicationContext.GET_RESOURCE_REQUIRE_SLASH");
         if (requireSlash == null) {
             GET_RESOURCE_REQUIRE_SLASH = STRICT_SERVLET_COMPLIANCE;
         } else {
@@ -109,8 +108,7 @@ public class ApplicationContext implements ServletContext {
     // ----------------------------------------------------------- Constructors
 
     /**
-     * Construct a new instance of this class, associated with the specified
-     * Context instance.
+     * Construct a new instance of this class, associated with the specified Context instance.
      *
      * @param context The associated Context instance
      */
@@ -131,13 +129,13 @@ public class ApplicationContext implements ServletContext {
     /**
      * The context attributes for this context.
      */
-    protected Map<String,Object> attributes = new ConcurrentHashMap<>();
+    protected Map<String, Object> attributes = new ConcurrentHashMap<>();
 
 
     /**
      * List of read only attributes for this context.
      */
-    private final Map<String,String> readOnlyAttributes = new ConcurrentHashMap<>();
+    private final Map<String, String> readOnlyAttributes = new ConcurrentHashMap<>();
 
 
     /**
@@ -173,7 +171,7 @@ public class ApplicationContext implements ServletContext {
     /**
      * The merged context initialization parameters for this Context.
      */
-    private final Map<String,String> parameters = new ConcurrentHashMap<>();
+    private final Map<String, String> parameters = new ConcurrentHashMap<>();
 
 
     /**
@@ -201,9 +199,8 @@ public class ApplicationContext implements ServletContext {
     private Set<SessionTrackingMode> supportedSessionTrackingModes = null;
 
     /**
-     * Flag that indicates if a new {@link ServletContextListener} may be added
-     * to the application. Once the first {@link ServletContextListener} is
-     * called, no more may be added.
+     * Flag that indicates if a new {@link ServletContextListener} may be added to the application. Once the first
+     * {@link ServletContextListener} is called, no more may be added.
      */
     private boolean newServletContextListenerAllowed = true;
 
@@ -249,9 +246,9 @@ public class ApplicationContext implements ServletContext {
                     uri = uri.substring(0, i);
                 }
                 // Note: This could be more efficient with a dedicated Mapper
-                //       method but such an implementation would require some
-                //       refactoring of the Mapper to avoid copy/paste of
-                //       existing code.
+                // method but such an implementation would require some
+                // refactoring of the Mapper to avoid copy/paste of
+                // existing code.
                 MessageBytes hostMB = MessageBytes.newInstance();
                 hostMB.setString(host.getName());
 
@@ -294,8 +291,7 @@ public class ApplicationContext implements ServletContext {
     public String getInitParameter(final String name) {
         // Special handling for XML settings as the context setting must
         // always override anything that might have been set by an application.
-        if (Globals.JASPER_XML_VALIDATION_TLD_INIT_PARAM.equals(name) &&
-                context.getTldValidation()) {
+        if (Globals.JASPER_XML_VALIDATION_TLD_INIT_PARAM.equals(name) && context.getTldValidation()) {
             return "true";
         }
         if (Globals.JASPER_XML_BLOCK_EXTERNAL_INIT_PARAM.equals(name)) {
@@ -336,8 +332,7 @@ public class ApplicationContext implements ServletContext {
 
 
     /**
-     * Return the MIME type of the specified file, or <code>null</code> if
-     * the MIME type cannot be determined.
+     * Return the MIME type of the specified file, or <code>null</code> if the MIME type cannot be determined.
      *
      * @param file Filename for which to identify a MIME type
      */
@@ -361,8 +356,7 @@ public class ApplicationContext implements ServletContext {
 
 
     /**
-     * Return a <code>RequestDispatcher</code> object that acts as a
-     * wrapper for the named servlet.
+     * Return a <code>RequestDispatcher</code> object that acts as a wrapper for the named servlet.
      *
      * @param name Name of the servlet for which a dispatcher is requested
      */
@@ -400,8 +394,7 @@ public class ApplicationContext implements ServletContext {
             return null;
         }
         if (!path.startsWith("/")) {
-            throw new IllegalArgumentException(
-                    sm.getString("applicationContext.requestDispatcher.iae", path));
+            throw new IllegalArgumentException(sm.getString("applicationContext.requestDispatcher.iae", path));
         }
 
         // Same processing order as InputBuffer / CoyoteAdapter
@@ -435,8 +428,7 @@ public class ApplicationContext implements ServletContext {
             // Security check to catch attempts to encode /../ sequences
             normalizedUri = RequestUtil.normalize(decodedUri);
             if (!decodedUri.equals(normalizedUri)) {
-                getContext().getLogger().warn(
-                        sm.getString("applicationContext.illegalDispatchPath", path),
+                getContext().getLogger().warn(sm.getString("applicationContext.illegalDispatchPath", path),
                         new IllegalArgumentException());
                 return null;
             }
@@ -485,8 +477,7 @@ public class ApplicationContext implements ServletContext {
             HttpServletMapping mapping = new ApplicationMapping(mappingData).getHttpServletMapping();
 
             // Construct a RequestDispatcher to process this request
-            return new ApplicationDispatcher(wrapper, uri, wrapperPath, pathInfo,
-                    queryString, mapping, null);
+            return new ApplicationDispatcher(wrapper, uri, wrapperPath, pathInfo, queryString, mapping, null);
         } finally {
             // Recycle thread local data at the end of the request so references
             // are not held to a completed request as there is potential for
@@ -534,8 +525,7 @@ public class ApplicationContext implements ServletContext {
         String validatedPath = validateResourcePath(path, !GET_RESOURCE_REQUIRE_SLASH);
 
         if (validatedPath == null) {
-            throw new MalformedURLException(
-                    sm.getString("applicationContext.requestDispatcher.iae", path));
+            throw new MalformedURLException(sm.getString("applicationContext.requestDispatcher.iae", path));
         }
 
         WebResourceRoot resources = context.getResources();
@@ -566,8 +556,7 @@ public class ApplicationContext implements ServletContext {
 
 
     /*
-     * Returns null if the input path is not valid or a path that will be
-     * acceptable to resources.getResource().
+     * Returns null if the input path is not valid or a path that will be acceptable to resources.getResource().
      */
     private String validateResourcePath(String path, boolean addMissingInitialSlash) {
         if (path == null) {
@@ -594,7 +583,7 @@ public class ApplicationContext implements ServletContext {
             return null;
         }
         if (!path.startsWith("/")) {
-            throw new IllegalArgumentException (sm.getString("applicationContext.resourcePaths.iae", path));
+            throw new IllegalArgumentException(sm.getString("applicationContext.resourcePaths.iae", path));
         }
 
         WebResourceRoot resources = context.getResources();
@@ -665,7 +654,7 @@ public class ApplicationContext implements ServletContext {
 
         // Remove the specified attribute
         // Check for read only attribute
-        if (readOnlyAttributes.containsKey(name)){
+        if (readOnlyAttributes.containsKey(name)) {
             return;
         }
         value = attributes.remove(name);
@@ -678,8 +667,7 @@ public class ApplicationContext implements ServletContext {
         if ((listeners == null) || (listeners.length == 0)) {
             return;
         }
-        ServletContextAttributeEvent event = new ServletContextAttributeEvent(
-                context.getServletContext(), name, value);
+        ServletContextAttributeEvent event = new ServletContextAttributeEvent(context.getServletContext(), name, value);
         for (Object obj : listeners) {
             if (!(obj instanceof ServletContextAttributeListener)) {
                 continue;
@@ -775,18 +763,16 @@ public class ApplicationContext implements ServletContext {
 
 
     @Override
-    public FilterRegistration.Dynamic addFilter(String filterName,
-            Class<? extends Filter> filterClass) {
+    public FilterRegistration.Dynamic addFilter(String filterName, Class<? extends Filter> filterClass) {
         return addFilter(filterName, filterClass.getName(), null);
     }
 
 
-    private FilterRegistration.Dynamic addFilter(String filterName,
-            String filterClass, Filter filter) throws IllegalStateException {
+    private FilterRegistration.Dynamic addFilter(String filterName, String filterClass, Filter filter)
+            throws IllegalStateException {
 
         if (filterName == null || filterName.equals("")) {
-            throw new IllegalArgumentException(sm.getString(
-                    "applicationContext.invalidFilterName", filterName));
+            throw new IllegalArgumentException(sm.getString("applicationContext.invalidFilterName", filterName));
         }
 
         // TODO Spec breaking enhancement to ignore this restriction
@@ -801,8 +787,7 @@ public class ApplicationContext implements ServletContext {
             filterDef.setFilterName(filterName);
             context.addFilterDef(filterDef);
         } else {
-            if (filterDef.getFilterName() != null &&
-                    filterDef.getFilterClass() != null) {
+            if (filterDef.getFilterName() != null && filterDef.getFilterClass() != null) {
                 return null;
             }
         }
@@ -856,8 +841,7 @@ public class ApplicationContext implements ServletContext {
 
 
     @Override
-    public ServletRegistration.Dynamic addServlet(String servletName,
-            Class<? extends Servlet> servletClass) {
+    public ServletRegistration.Dynamic addServlet(String servletName, Class<? extends Servlet> servletClass) {
         return addServlet(servletName, servletClass.getName(), null, null);
     }
 
@@ -867,12 +851,11 @@ public class ApplicationContext implements ServletContext {
 
         // jspName is validated in addServlet()
         if (jspFile == null || !jspFile.startsWith("/")) {
-            throw new IllegalArgumentException(
-                    sm.getString("applicationContext.addJspFile.iae", jspFile));
+            throw new IllegalArgumentException(sm.getString("applicationContext.addJspFile.iae", jspFile));
         }
 
         String jspServletClassName = null;
-        Map<String,String> jspFileInitParams = new HashMap<>();
+        Map<String, String> jspFileInitParams = new HashMap<>();
 
         Wrapper jspServlet = (Wrapper) context.findChild("jsp");
 
@@ -898,12 +881,11 @@ public class ApplicationContext implements ServletContext {
     }
 
 
-    private ServletRegistration.Dynamic addServlet(String servletName, String servletClass,
-            Servlet servlet, Map<String,String> initParams) throws IllegalStateException {
+    private ServletRegistration.Dynamic addServlet(String servletName, String servletClass, Servlet servlet,
+            Map<String, String> initParams) throws IllegalStateException {
 
         if (servletName == null || servletName.equals("")) {
-            throw new IllegalArgumentException(sm.getString(
-                    "applicationContext.invalidServletName", servletName));
+            throw new IllegalArgumentException(sm.getString("applicationContext.invalidServletName", servletName));
         }
 
         // TODO Spec breaking enhancement to ignore this restriction
@@ -918,8 +900,7 @@ public class ApplicationContext implements ServletContext {
             wrapper.setName(servletName);
             context.addChild(wrapper);
         } else {
-            if (wrapper.getName() != null &&
-                    wrapper.getServletClass() != null) {
+            if (wrapper.getName() != null && wrapper.getServletClass() != null) {
                 if (wrapper.isOverridable()) {
                     wrapper.setOverridable(false);
                 } else {
@@ -944,13 +925,12 @@ public class ApplicationContext implements ServletContext {
         }
 
         if (initParams != null) {
-            for (Map.Entry<String, String> initParam: initParams.entrySet()) {
+            for (Map.Entry<String, String> initParam : initParams.entrySet()) {
                 wrapper.addInitParameter(initParam.getKey(), initParam.getValue());
             }
         }
 
-        ServletRegistration.Dynamic registration =
-                new ApplicationServletRegistration(wrapper, context);
+        ServletRegistration.Dynamic registration = new ApplicationServletRegistration(wrapper, context);
         if (annotation != null) {
             registration.setServletSecurity(new ServletSecurityElement(annotation));
         }
@@ -1037,8 +1017,7 @@ public class ApplicationContext implements ServletContext {
         // Check that only supported tracking modes have been requested
         for (SessionTrackingMode sessionTrackingMode : sessionTrackingModes) {
             if (!supportedSessionTrackingModes.contains(sessionTrackingMode)) {
-                throw new IllegalArgumentException(sm.getString(
-                        "applicationContext.setSessionTracking.iae.invalid",
+                throw new IllegalArgumentException(sm.getString("applicationContext.setSessionTracking.iae.invalid",
                         sessionTrackingMode.toString(), getContextPath()));
             }
         }
@@ -1046,9 +1025,8 @@ public class ApplicationContext implements ServletContext {
         // Check SSL has not be configured with anything else
         if (sessionTrackingModes.contains(SessionTrackingMode.SSL)) {
             if (sessionTrackingModes.size() > 1) {
-                throw new IllegalArgumentException(sm.getString(
-                        "applicationContext.setSessionTracking.iae.ssl",
-                        getContextPath()));
+                throw new IllegalArgumentException(
+                        sm.getString("applicationContext.setSessionTracking.iae.ssl", getContextPath()));
             }
         }
 
@@ -1073,9 +1051,8 @@ public class ApplicationContext implements ServletContext {
         try {
             listener = createListener(listenerClass);
         } catch (ServletException e) {
-            throw new IllegalArgumentException(sm.getString(
-                    "applicationContext.addListener.iae.init",
-                    listenerClass.getName()), e);
+            throw new IllegalArgumentException(
+                    sm.getString("applicationContext.addListener.iae.init", listenerClass.getName()), e);
         }
         addListener(listener);
     }
@@ -1089,9 +1066,8 @@ public class ApplicationContext implements ServletContext {
                 Object obj = context.getInstanceManager().newInstance(className);
 
                 if (!(obj instanceof EventListener)) {
-                    throw new IllegalArgumentException(sm.getString(
-                            "applicationContext.addListener.iae.wrongType",
-                            className));
+                    throw new IllegalArgumentException(
+                            sm.getString("applicationContext.addListener.iae.wrongType", className));
                 }
 
                 EventListener listener = (EventListener) obj;
@@ -1099,13 +1075,9 @@ public class ApplicationContext implements ServletContext {
             }
         } catch (InvocationTargetException e) {
             ExceptionUtils.handleThrowable(e.getCause());
-            throw new IllegalArgumentException(sm.getString(
-                    "applicationContext.addListener.iae.cnfe", className),
-                    e);
-        } catch (ReflectiveOperationException| NamingException e) {
-            throw new IllegalArgumentException(sm.getString(
-                    "applicationContext.addListener.iae.cnfe", className),
-                    e);
+            throw new IllegalArgumentException(sm.getString("applicationContext.addListener.iae.cnfe", className), e);
+        } catch (ReflectiveOperationException | NamingException e) {
+            throw new IllegalArgumentException(sm.getString("applicationContext.addListener.iae.cnfe", className), e);
         }
 
     }
@@ -1116,10 +1088,8 @@ public class ApplicationContext implements ServletContext {
         checkState("applicationContext.addListener.ise");
 
         boolean match = false;
-        if (t instanceof ServletContextAttributeListener ||
-                t instanceof ServletRequestListener ||
-                t instanceof ServletRequestAttributeListener ||
-                t instanceof HttpSessionIdListener ||
+        if (t instanceof ServletContextAttributeListener || t instanceof ServletRequestListener ||
+                t instanceof ServletRequestAttributeListener || t instanceof HttpSessionIdListener ||
                 t instanceof HttpSessionAttributeListener) {
             context.addApplicationEventListener(t);
             match = true;
@@ -1138,35 +1108,28 @@ public class ApplicationContext implements ServletContext {
         }
 
         if (t instanceof ServletContextListener) {
-            throw new IllegalArgumentException(sm.getString(
-                    "applicationContext.addListener.iae.sclNotAllowed",
-                    t.getClass().getName()));
+            throw new IllegalArgumentException(
+                    sm.getString("applicationContext.addListener.iae.sclNotAllowed", t.getClass().getName()));
         } else {
-            throw new IllegalArgumentException(sm.getString(
-                    "applicationContext.addListener.iae.wrongType",
-                    t.getClass().getName()));
+            throw new IllegalArgumentException(
+                    sm.getString("applicationContext.addListener.iae.wrongType", t.getClass().getName()));
         }
     }
 
 
     @Override
-    public <T extends EventListener> T createListener(Class<T> c)
-            throws ServletException {
+    public <T extends EventListener> T createListener(Class<T> c) throws ServletException {
         try {
             @SuppressWarnings("unchecked")
             T listener = (T) context.getInstanceManager().newInstance(c);
-            if (listener instanceof ServletContextListener ||
-                    listener instanceof ServletContextAttributeListener ||
-                    listener instanceof ServletRequestListener ||
-                    listener instanceof ServletRequestAttributeListener ||
-                    listener instanceof HttpSessionListener ||
-                    listener instanceof HttpSessionIdListener ||
+            if (listener instanceof ServletContextListener || listener instanceof ServletContextAttributeListener ||
+                    listener instanceof ServletRequestListener || listener instanceof ServletRequestAttributeListener ||
+                    listener instanceof HttpSessionListener || listener instanceof HttpSessionIdListener ||
                     listener instanceof HttpSessionAttributeListener) {
                 return listener;
             }
-            throw new IllegalArgumentException(sm.getString(
-                    "applicationContext.addListener.iae.wrongType",
-                    listener.getClass().getName()));
+            throw new IllegalArgumentException(
+                    sm.getString("applicationContext.addListener.iae.wrongType", listener.getClass().getName()));
         } catch (InvocationTargetException e) {
             ExceptionUtils.handleThrowable(e.getCause());
             throw new ServletException(e);
@@ -1183,16 +1146,12 @@ public class ApplicationContext implements ServletContext {
         checkState("applicationContext.addRole.ise");
 
         if (roleNames == null) {
-            throw new IllegalArgumentException(
-                    sm.getString("applicationContext.roles.iae",
-                            getContextPath()));
+            throw new IllegalArgumentException(sm.getString("applicationContext.roles.iae", getContextPath()));
         }
 
         for (String role : roleNames) {
             if (role == null || role.isEmpty()) {
-                throw new IllegalArgumentException(
-                        sm.getString("applicationContext.role.iae",
-                                getContextPath()));
+                throw new IllegalArgumentException(sm.getString("applicationContext.role.iae", getContextPath()));
             }
             context.addSecurityRole(role);
         }
@@ -1212,8 +1171,7 @@ public class ApplicationContext implements ServletContext {
                 parent = parent.getParent();
             }
             if (parent == null) {
-                System.getSecurityManager().checkPermission(
-                        new RuntimePermission("getClassLoader"));
+                System.getSecurityManager().checkPermission(new RuntimePermission("getClassLoader"));
             }
         }
 
@@ -1239,8 +1197,7 @@ public class ApplicationContext implements ServletContext {
 
         FilterDef[] filterDefs = context.findFilterDefs();
         for (FilterDef filterDef : filterDefs) {
-            result.put(filterDef.getFilterName(),
-                    new ApplicationFilterRegistration(filterDef, context));
+            result.put(filterDef.getFilterName(), new ApplicationFilterRegistration(filterDef, context));
         }
 
         return result;
@@ -1259,9 +1216,7 @@ public class ApplicationContext implements ServletContext {
 
         Container[] wrappers = context.findChildren();
         for (Container wrapper : wrappers) {
-            result.put(wrapper.getName(),
-                    new ApplicationServletRegistration(
-                            (Wrapper) wrapper, context));
+            result.put(wrapper.getName(), new ApplicationServletRegistration((Wrapper) wrapper, context));
         }
 
         return result;
@@ -1318,7 +1273,7 @@ public class ApplicationContext implements ServletContext {
 
     private void checkState(String messageKey) {
         if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
-            throw new IllegalStateException(sm.getString(messageKey,getContextPath()));
+            throw new IllegalStateException(sm.getString(messageKey, getContextPath()));
         }
     }
 
@@ -1370,8 +1325,7 @@ public class ApplicationContext implements ServletContext {
     }
 
     /**
-     * Internal class used as thread-local storage when doing path
-     * mapping during dispatch.
+     * Internal class used as thread-local storage when doing path mapping during dispatch.
      */
     private static final class DispatchData {
 
diff --git a/java/org/apache/catalina/core/ApplicationContextFacade.java b/java/org/apache/catalina/core/ApplicationContextFacade.java
index ae8b2ad97a..0a9b49a80f 100644
--- a/java/org/apache/catalina/core/ApplicationContextFacade.java
+++ b/java/org/apache/catalina/core/ApplicationContextFacade.java
@@ -50,8 +50,7 @@ import org.apache.tomcat.util.ExceptionUtils;
 
 
 /**
- * Facade object which masks the internal <code>ApplicationContext</code>
- * object from the web application.
+ * Facade object which masks the internal <code>ApplicationContext</code> object from the web application.
  *
  * @author Remy Maucherat
  */
@@ -61,21 +60,20 @@ public class ApplicationContextFacade implements ServletContext {
     /**
      * Cache Class object used for reflection.
      */
-    private final Map<String,Class<?>[]> classCache;
+    private final Map<String, Class<?>[]> classCache;
 
 
     /**
      * Cache method object.
      */
-    private final Map<String,Method> objectCache;
+    private final Map<String, Method> objectCache;
 
 
     // ----------------------------------------------------------- Constructors
 
 
     /**
-     * Construct a new instance of this class, associated with the specified
-     * Context instance.
+     * Construct a new instance of this class, associated with the specified Context instance.
      *
      * @param context The associated Context instance
      */
@@ -89,8 +87,8 @@ public class ApplicationContextFacade implements ServletContext {
     }
 
 
-    private void initClassCache(){
-        Class<?>[] clazz = new Class[]{String.class};
+    private void initClassCache() {
+        Class<?>[] clazz = new Class[] { String.class };
         classCache.put("getContext", clazz);
         classCache.put("getMimeType", clazz);
         classCache.put("getResourcePaths", clazz);
@@ -99,27 +97,27 @@ public class ApplicationContextFacade implements ServletContext {
         classCache.put("getRequestDispatcher", clazz);
         classCache.put("getNamedDispatcher", clazz);
         classCache.put("getServlet", clazz);
-        classCache.put("setInitParameter", new Class[]{String.class, String.class});
-        classCache.put("createServlet", new Class[]{Class.class});
-        classCache.put("addServlet", new Class[]{String.class, String.class});
-        classCache.put("createFilter", new Class[]{Class.class});
-        classCache.put("addFilter", new Class[]{String.class, String.class});
-        classCache.put("createListener", new Class[]{Class.class});
+        classCache.put("setInitParameter", new Class[] { String.class, String.class });
+        classCache.put("createServlet", new Class[] { Class.class });
+        classCache.put("addServlet", new Class[] { String.class, String.class });
+        classCache.put("createFilter", new Class[] { Class.class });
+        classCache.put("addFilter", new Class[] { String.class, String.class });
+        classCache.put("createListener", new Class[] { Class.class });
         classCache.put("addListener", clazz);
         classCache.put("getFilterRegistration", clazz);
         classCache.put("getServletRegistration", clazz);
         classCache.put("getInitParameter", clazz);
-        classCache.put("setAttribute", new Class[]{String.class, Object.class});
+        classCache.put("setAttribute", new Class[] { String.class, Object.class });
         classCache.put("removeAttribute", clazz);
         classCache.put("getRealPath", clazz);
         classCache.put("getAttribute", clazz);
         classCache.put("log", clazz);
-        classCache.put("setSessionTrackingModes", new Class[]{Set.class} );
-        classCache.put("addJspFile", new Class[]{String.class, String.class});
-        classCache.put("declareRoles", new Class[]{String[].class});
-        classCache.put("setSessionTimeout", new Class[]{int.class});
-        classCache.put("setRequestCharacterEncoding", new Class[]{String.class});
-        classCache.put("setResponseCharacterEncoding", new Class[]{String.class});
+        classCache.put("setSessionTrackingModes", new Class[] { Set.class });
+        classCache.put("addJspFile", new Class[] { String.class, String.class });
+        classCache.put("declareRoles", new Class[] { String[].class });
+        classCache.put("setSessionTimeout", new Class[] { int.class });
+        classCache.put("setRequestCharacterEncoding", new Class[] { String.class });
+        classCache.put("setResponseCharacterEncoding", new Class[] { String.class });
     }
 
 
@@ -139,14 +137,12 @@ public class ApplicationContextFacade implements ServletContext {
     public ServletContext getContext(String uripath) {
         ServletContext theContext = null;
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            theContext = (ServletContext)
-                doPrivileged("getContext", new Object[]{uripath});
+            theContext = (ServletContext) doPrivileged("getContext", new Object[] { uripath });
         } else {
             theContext = context.getContext(uripath);
         }
-        if ((theContext != null) &&
-            (theContext instanceof ApplicationContext)){
-            theContext = ((ApplicationContext)theContext).getFacade();
+        if ((theContext != null) && (theContext instanceof ApplicationContext)) {
+            theContext = ((ApplicationContext) theContext).getFacade();
         }
         return theContext;
     }
@@ -167,7 +163,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public String getMimeType(String file) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (String)doPrivileged("getMimeType", new Object[]{file});
+            return (String) doPrivileged("getMimeType", new Object[] { file });
         } else {
             return context.getMimeType(file);
         }
@@ -176,9 +172,8 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
     public Set<String> getResourcePaths(String path) {
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return (Set<String>)doPrivileged("getResourcePaths",
-                    new Object[]{path});
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            return (Set<String>) doPrivileged("getResourcePaths", new Object[] { path });
         } else {
             return context.getResourcePaths(path);
         }
@@ -186,16 +181,14 @@ public class ApplicationContextFacade implements ServletContext {
 
 
     @Override
-    public URL getResource(String path)
-        throws MalformedURLException {
+    public URL getResource(String path) throws MalformedURLException {
         if (Globals.IS_SECURITY_ENABLED) {
             try {
-                return (URL) invokeMethod(context, "getResource",
-                                          new Object[]{path});
-            } catch(Throwable t) {
+                return (URL) invokeMethod(context, "getResource", new Object[] { path });
+            } catch (Throwable t) {
                 ExceptionUtils.handleThrowable(t);
-                if (t instanceof MalformedURLException){
-                    throw (MalformedURLException)t;
+                if (t instanceof MalformedURLException) {
+                    throw (MalformedURLException) t;
                 }
                 return null;
             }
@@ -208,8 +201,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public InputStream getResourceAsStream(String path) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (InputStream) doPrivileged("getResourceAsStream",
-                                              new Object[]{path});
+            return (InputStream) doPrivileged("getResourceAsStream", new Object[] { path });
         } else {
             return context.getResourceAsStream(path);
         }
@@ -219,8 +211,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public RequestDispatcher getRequestDispatcher(final String path) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (RequestDispatcher) doPrivileged("getRequestDispatcher",
-                                                    new Object[]{path});
+            return (RequestDispatcher) doPrivileged("getRequestDispatcher", new Object[] { path });
         } else {
             return context.getRequestDispatcher(path);
         }
@@ -230,8 +221,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public RequestDispatcher getNamedDispatcher(String name) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (RequestDispatcher) doPrivileged("getNamedDispatcher",
-                                                    new Object[]{name});
+            return (RequestDispatcher) doPrivileged("getNamedDispatcher", new Object[] { name });
         } else {
             return context.getNamedDispatcher(name);
         }
@@ -243,12 +233,10 @@ public class ApplicationContextFacade implements ServletContext {
      */
     @Override
     @Deprecated
-    public Servlet getServlet(String name)
-        throws ServletException {
+    public Servlet getServlet(String name) throws ServletException {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             try {
-                return (Servlet) invokeMethod(context, "getServlet",
-                                              new Object[]{name});
+                return (Servlet) invokeMethod(context, "getServlet", new Object[] { name });
             } catch (Throwable t) {
                 ExceptionUtils.handleThrowable(t);
                 if (t instanceof ServletException) {
@@ -289,13 +277,13 @@ public class ApplicationContextFacade implements ServletContext {
         } else {
             return context.getServletNames();
         }
-   }
+    }
 
 
     @Override
     public void log(String msg) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            doPrivileged("log", new Object[]{msg} );
+            doPrivileged("log", new Object[] { msg });
         } else {
             context.log(msg);
         }
@@ -303,15 +291,13 @@ public class ApplicationContextFacade implements ServletContext {
 
 
     /**
-     * @deprecated As of Java Servlet API 2.1, use
-     *  <code>log(String, Throwable)</code> instead
+     * @deprecated As of Java Servlet API 2.1, use <code>log(String, Throwable)</code> instead
      */
     @Override
     @Deprecated
     public void log(Exception exception, String msg) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            doPrivileged("log", new Class[]{Exception.class, String.class},
-                         new Object[]{exception,msg});
+            doPrivileged("log", new Class[] { Exception.class, String.class }, new Object[] { exception, msg });
         } else {
             context.log(exception, msg);
         }
@@ -321,8 +307,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public void log(String message, Throwable throwable) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            doPrivileged("log", new Class[]{String.class, Throwable.class},
-                         new Object[]{message, throwable});
+            doPrivileged("log", new Class[] { String.class, Throwable.class }, new Object[] { message, throwable });
         } else {
             context.log(message, throwable);
         }
@@ -332,7 +317,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public String getRealPath(String path) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (String) doPrivileged("getRealPath", new Object[]{path});
+            return (String) doPrivileged("getRealPath", new Object[] { path });
         } else {
             return context.getRealPath(path);
         }
@@ -352,8 +337,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public String getInitParameter(String name) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (String) doPrivileged("getInitParameter",
-                                         new Object[]{name});
+            return (String) doPrivileged("getInitParameter", new Object[] { name });
         } else {
             return context.getInitParameter(name);
         }
@@ -364,8 +348,7 @@ public class ApplicationContextFacade implements ServletContext {
     @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
     public Enumeration<String> getInitParameterNames() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (Enumeration<String>) doPrivileged(
-                    "getInitParameterNames", null);
+            return (Enumeration<String>) doPrivileged("getInitParameterNames", null);
         } else {
             return context.getInitParameterNames();
         }
@@ -375,19 +358,18 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public Object getAttribute(String name) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return doPrivileged("getAttribute", new Object[]{name});
+            return doPrivileged("getAttribute", new Object[] { name });
         } else {
             return context.getAttribute(name);
         }
-     }
+    }
 
 
     @Override
     @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
     public Enumeration<String> getAttributeNames() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (Enumeration<String>) doPrivileged(
-                    "getAttributeNames", null);
+            return (Enumeration<String>) doPrivileged("getAttributeNames", null);
         } else {
             return context.getAttributeNames();
         }
@@ -397,7 +379,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public void setAttribute(String name, Object object) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            doPrivileged("setAttribute", new Object[]{name,object});
+            doPrivileged("setAttribute", new Object[] { name, object });
         } else {
             context.setAttribute(name, object);
         }
@@ -407,7 +389,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public void removeAttribute(String name) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            doPrivileged("removeAttribute", new Object[]{name});
+            doPrivileged("removeAttribute", new Object[] { name });
         } else {
             context.removeAttribute(name);
         }
@@ -435,11 +417,9 @@ public class ApplicationContextFacade implements ServletContext {
 
 
     @Override
-    public FilterRegistration.Dynamic addFilter(String filterName,
-            String className) {
+    public FilterRegistration.Dynamic addFilter(String filterName, String className) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (FilterRegistration.Dynamic) doPrivileged(
-                    "addFilter", new Object[]{filterName, className});
+            return (FilterRegistration.Dynamic) doPrivileged("addFilter", new Object[] { filterName, className });
         } else {
             return context.addFilter(filterName, className);
         }
@@ -447,12 +427,10 @@ public class ApplicationContextFacade implements ServletContext {
 
 
     @Override
-    public FilterRegistration.Dynamic addFilter(String filterName,
-            Filter filter) {
+    public FilterRegistration.Dynamic addFilter(String filterName, Filter filter) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (FilterRegistration.Dynamic) doPrivileged("addFilter",
-                    new Class[]{String.class, Filter.class},
-                    new Object[]{filterName, filter});
+            return (FilterRegistration.Dynamic) doPrivileged("addFilter", new Class[] { String.class, Filter.class },
+                    new Object[] { filterName, filter });
         } else {
             return context.addFilter(filterName, filter);
         }
@@ -460,12 +438,10 @@ public class ApplicationContextFacade implements ServletContext {
 
 
     @Override
-    public FilterRegistration.Dynamic addFilter(String filterName,
-            Class<? extends Filter> filterClass) {
+    public FilterRegistration.Dynamic addFilter(String filterName, Class<? extends Filter> filterClass) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (FilterRegistration.Dynamic) doPrivileged("addFilter",
-                    new Class[]{String.class, Class.class},
-                    new Object[]{filterName, filterClass});
+            return (FilterRegistration.Dynamic) doPrivileged("addFilter", new Class[] { String.class, Class.class },
+                    new Object[] { filterName, filterClass });
         } else {
             return context.addFilter(filterName, filterClass);
         }
@@ -473,12 +449,10 @@ public class ApplicationContextFacade implements ServletContext {
 
     @Override
     @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
-    public <T extends Filter> T createFilter(Class<T> c)
-    throws ServletException {
+    public <T extends Filter> T createFilter(Class<T> c) throws ServletException {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             try {
-                return (T) invokeMethod(context, "createFilter",
-                                              new Object[]{c});
+                return (T) invokeMethod(context, "createFilter", new Object[] { c });
             } catch (Throwable t) {
                 ExceptionUtils.handleThrowable(t);
                 if (t instanceof ServletException) {
@@ -495,8 +469,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public FilterRegistration getFilterRegistration(String filterName) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (FilterRegistration) doPrivileged(
-                    "getFilterRegistration", new Object[]{filterName});
+            return (FilterRegistration) doPrivileged("getFilterRegistration", new Object[] { filterName });
         } else {
             return context.getFilterRegistration(filterName);
         }
@@ -504,11 +477,9 @@ public class ApplicationContextFacade implements ServletContext {
 
 
     @Override
-    public ServletRegistration.Dynamic addServlet(String servletName,
-            String className) {
+    public ServletRegistration.Dynamic addServlet(String servletName, String className) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (ServletRegistration.Dynamic) doPrivileged(
-                    "addServlet", new Object[]{servletName, className});
+            return (ServletRegistration.Dynamic) doPrivileged("addServlet", new Object[] { servletName, className });
         } else {
             return context.addServlet(servletName, className);
         }
@@ -516,12 +487,10 @@ public class ApplicationContextFacade implements ServletContext {
 
 
     @Override
-    public ServletRegistration.Dynamic addServlet(String servletName,
-            Servlet servlet) {
+    public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (ServletRegistration.Dynamic) doPrivileged("addServlet",
-                    new Class[]{String.class, Servlet.class},
-                    new Object[]{servletName, servlet});
+            return (ServletRegistration.Dynamic) doPrivileged("addServlet", new Class[] { String.class, Servlet.class },
+                    new Object[] { servletName, servlet });
         } else {
             return context.addServlet(servletName, servlet);
         }
@@ -529,12 +498,10 @@ public class ApplicationContextFacade implements ServletContext {
 
 
     @Override
-    public ServletRegistration.Dynamic addServlet(String servletName,
-            Class<? extends Servlet> servletClass) {
+    public ServletRegistration.Dynamic addServlet(String servletName, Class<? extends Servlet> servletClass) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (ServletRegistration.Dynamic) doPrivileged("addServlet",
-                    new Class[]{String.class, Class.class},
-                    new Object[]{servletName, servletClass});
+            return (ServletRegistration.Dynamic) doPrivileged("addServlet", new Class[] { String.class, Class.class },
+                    new Object[] { servletName, servletClass });
         } else {
             return context.addServlet(servletName, servletClass);
         }
@@ -544,8 +511,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public Dynamic addJspFile(String jspName, String jspFile) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (ServletRegistration.Dynamic) doPrivileged("addJspFile",
-                    new Object[]{jspName, jspFile});
+            return (ServletRegistration.Dynamic) doPrivileged("addJspFile", new Object[] { jspName, jspFile });
         } else {
             return context.addJspFile(jspName, jspFile);
         }
@@ -554,12 +520,10 @@ public class ApplicationContextFacade implements ServletContext {
 
     @Override
     @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
-    public <T extends Servlet> T createServlet(Class<T> c)
-    throws ServletException {
+    public <T extends Servlet> T createServlet(Class<T> c) throws ServletException {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             try {
-                return (T) invokeMethod(context, "createServlet",
-                                              new Object[]{c});
+                return (T) invokeMethod(context, "createServlet", new Object[] { c });
             } catch (Throwable t) {
                 ExceptionUtils.handleThrowable(t);
                 if (t instanceof ServletException) {
@@ -576,8 +540,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public ServletRegistration getServletRegistration(String servletName) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (ServletRegistration) doPrivileged(
-                    "getServletRegistration", new Object[]{servletName});
+            return (ServletRegistration) doPrivileged("getServletRegistration", new Object[] { servletName });
         } else {
             return context.getServletRegistration(servletName);
         }
@@ -588,8 +551,7 @@ public class ApplicationContextFacade implements ServletContext {
     @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
     public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (Set<SessionTrackingMode>)
-                doPrivileged("getDefaultSessionTrackingModes", null);
+            return (Set<SessionTrackingMode>) doPrivileged("getDefaultSessionTrackingModes", null);
         } else {
             return context.getDefaultSessionTrackingModes();
         }
@@ -599,8 +561,7 @@ public class ApplicationContextFacade implements ServletContext {
     @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
     public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (Set<SessionTrackingMode>)
-                doPrivileged("getEffectiveSessionTrackingModes", null);
+            return (Set<SessionTrackingMode>) doPrivileged("getEffectiveSessionTrackingModes", null);
         } else {
             return context.getEffectiveSessionTrackingModes();
         }
@@ -610,8 +571,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public SessionCookieConfig getSessionCookieConfig() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (SessionCookieConfig)
-                doPrivileged("getSessionCookieConfig", null);
+            return (SessionCookieConfig) doPrivileged("getSessionCookieConfig", null);
         } else {
             return context.getSessionCookieConfig();
         }
@@ -619,11 +579,9 @@ public class ApplicationContextFacade implements ServletContext {
 
 
     @Override
-    public void setSessionTrackingModes(
-            Set<SessionTrackingMode> sessionTrackingModes) {
+    public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            doPrivileged("setSessionTrackingModes",
-                    new Object[]{sessionTrackingModes});
+            doPrivileged("setSessionTrackingModes", new Object[] { sessionTrackingModes });
         } else {
             context.setSessionTrackingModes(sessionTrackingModes);
         }
@@ -633,8 +591,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public boolean setInitParameter(String name, String value) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return ((Boolean) doPrivileged("setInitParameter",
-                    new Object[]{name, value})).booleanValue();
+            return ((Boolean) doPrivileged("setInitParameter", new Object[] { name, value })).booleanValue();
         } else {
             return context.setInitParameter(name, value);
         }
@@ -644,9 +601,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public void addListener(Class<? extends EventListener> listenerClass) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            doPrivileged("addListener",
-                    new Class[]{Class.class},
-                    new Object[]{listenerClass});
+            doPrivileged("addListener", new Class[] { Class.class }, new Object[] { listenerClass });
         } else {
             context.addListener(listenerClass);
         }
@@ -656,8 +611,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public void addListener(String className) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            doPrivileged("addListener",
-                    new Object[]{className});
+            doPrivileged("addListener", new Object[] { className });
         } else {
             context.addListener(className);
         }
@@ -667,9 +621,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public <T extends EventListener> void addListener(T t) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            doPrivileged("addListener",
-                    new Class[]{EventListener.class},
-                    new Object[]{t});
+            doPrivileged("addListener", new Class[] { EventListener.class }, new Object[] { t });
         } else {
             context.addListener(t);
         }
@@ -678,12 +630,10 @@ public class ApplicationContextFacade implements ServletContext {
 
     @Override
     @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
-    public <T extends EventListener> T createListener(Class<T> c)
-            throws ServletException {
+    public <T extends EventListener> T createListener(Class<T> c) throws ServletException {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             try {
-                return (T) invokeMethod(context, "createListener",
-                                              new Object[]{c});
+                return (T) invokeMethod(context, "createListener", new Object[] { c });
             } catch (Throwable t) {
                 ExceptionUtils.handleThrowable(t);
                 if (t instanceof ServletException) {
@@ -700,7 +650,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public void declareRoles(String... roleNames) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            doPrivileged("declareRoles", new Object[]{roleNames});
+            doPrivileged("declareRoles", new Object[] { roleNames });
         } else {
             context.declareRoles(roleNames);
         }
@@ -720,9 +670,8 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public int getEffectiveMajorVersion() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return ((Integer) doPrivileged("getEffectiveMajorVersion",
-                    null)).intValue();
-        } else  {
+            return ((Integer) doPrivileged("getEffectiveMajorVersion", null)).intValue();
+        } else {
             return context.getEffectiveMajorVersion();
         }
     }
@@ -731,9 +680,8 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public int getEffectiveMinorVersion() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return ((Integer) doPrivileged("getEffectiveMinorVersion",
-                    null)).intValue();
-        } else  {
+            return ((Integer) doPrivileged("getEffectiveMinorVersion", null)).intValue();
+        } else {
             return context.getEffectiveMinorVersion();
         }
     }
@@ -743,8 +691,7 @@ public class ApplicationContextFacade implements ServletContext {
     @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
     public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (Map<String, ? extends FilterRegistration>) doPrivileged(
-                    "getFilterRegistrations", null);
+            return (Map<String, ? extends FilterRegistration>) doPrivileged("getFilterRegistrations", null);
         } else {
             return context.getFilterRegistrations();
         }
@@ -754,8 +701,7 @@ public class ApplicationContextFacade implements ServletContext {
     @Override
     public JspConfigDescriptor getJspConfigDescriptor() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (JspConfigDescriptor) doPrivileged("getJspConfigDescriptor",
-                    null);
+            return (JspConfigDescriptor) doPrivileged("getJspConfigDescriptor", null);
         } else {
             return context.getJspConfigDescriptor();
         }
@@ -766,8 +712,7 @@ public class ApplicationContextFacade implements ServletContext {
     @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
     public Map<String, ? extends ServletRegistration> getServletRegistrations() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (Map<String, ? extends ServletRegistration>) doPrivileged(
-                    "getServletRegistrations", null);
+            return (Map<String, ? extends ServletRegistration>) doPrivileged("getServletRegistrations", null);
         } else {
             return context.getServletRegistrations();
         }
@@ -778,7 +723,7 @@ public class ApplicationContextFacade implements ServletContext {
     public String getVirtualServerName() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             return (String) doPrivileged("getVirtualServerName", null);
-        } else  {
+        } else {
             return context.getVirtualServerName();
         }
     }
@@ -788,7 +733,7 @@ public class ApplicationContextFacade implements ServletContext {
     public int getSessionTimeout() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             return ((Integer) doPrivileged("getSessionTimeout", null)).intValue();
-        } else  {
+        } else {
             return context.getSessionTimeout();
         }
     }
@@ -798,7 +743,7 @@ public class ApplicationContextFacade implements ServletContext {
     public void setSessionTimeout(int sessionTimeout) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             doPrivileged("setSessionTimeout", new Object[] { Integer.valueOf(sessionTimeout) });
-        } else  {
+        } else {
             context.setSessionTimeout(sessionTimeout);
         }
     }
@@ -808,7 +753,7 @@ public class ApplicationContextFacade implements ServletContext {
     public String getRequestCharacterEncoding() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             return (String) doPrivileged("getRequestCharacterEncoding", null);
-        } else  {
+        } else {
             return context.getRequestCharacterEncoding();
         }
     }
@@ -818,7 +763,7 @@ public class ApplicationContextFacade implements ServletContext {
     public void setRequestCharacterEncoding(String encoding) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             doPrivileged("setRequestCharacterEncoding", new Object[] { encoding });
-        } else  {
+        } else {
             context.setRequestCharacterEncoding(encoding);
         }
     }
@@ -828,7 +773,7 @@ public class ApplicationContextFacade implements ServletContext {
     public String getResponseCharacterEncoding() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             return (String) doPrivileged("getResponseCharacterEncoding", null);
-        } else  {
+        } else {
             return context.getResponseCharacterEncoding();
         }
     }
@@ -838,22 +783,22 @@ public class ApplicationContextFacade implements ServletContext {
     public void setResponseCharacterEncoding(String encoding) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             doPrivileged("setResponseCharacterEncoding", new Object[] { encoding });
-        } else  {
+        } else {
             context.setResponseCharacterEncoding(encoding);
         }
     }
 
 
     /**
-     * Use reflection to invoke the requested method. Cache the method object
-     * to speed up the process
+     * Use reflection to invoke the requested method. Cache the method object to speed up the process
+     *
      * @param methodName The method to call.
-     * @param params The arguments passed to the called method.
+     * @param params     The arguments passed to the called method.
      */
     private Object doPrivileged(final String methodName, final Object[] params) {
-        try{
+        try {
             return invokeMethod(context, methodName, params);
-        }catch(Throwable t){
+        } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);
             throw new RuntimeException(t.getMessage(), t);
         }
@@ -861,28 +806,24 @@ public class ApplicationContextFacade implements ServletContext {
 
 
     /**
-     * Use reflection to invoke the requested method. Cache the method object
-     * to speed up the process
-     * @param appContext The ApplicationContext object on which the method
-     *                   will be invoked
+     * Use reflection to invoke the requested method. Cache the method object to speed up the process
+     *
+     * @param appContext The ApplicationContext object on which the method will be invoked
      * @param methodName The method to call.
-     * @param params The arguments passed to the called method.
+     * @param params     The arguments passed to the called method.
      */
-    private Object invokeMethod(ApplicationContext appContext,
-                                final String methodName,
-                                Object[] params)
-        throws Throwable{
+    private Object invokeMethod(ApplicationContext appContext, final String methodName, Object[] params)
+            throws Throwable {
 
-        try{
+        try {
             Method method = objectCache.get(methodName);
-            if (method == null){
-                method = appContext.getClass()
-                    .getMethod(methodName, classCache.get(methodName));
+            if (method == null) {
+                method = appContext.getClass().getMethod(methodName, classCache.get(methodName));
                 objectCache.put(methodName, method);
             }
 
-            return executeMethod(method,appContext,params);
-        } catch (Exception ex){
+            return executeMethod(method, appContext, params);
+        } catch (Exception ex) {
             handleException(ex);
             return null;
         } finally {
@@ -891,23 +832,21 @@ public class ApplicationContextFacade implements ServletContext {
     }
 
     /**
-     * Use reflection to invoke the requested method. Cache the method object
-     * to speed up the process
+     * Use reflection to invoke the requested method. Cache the method object to speed up the process
+     *
      * @param methodName The method to invoke.
-     * @param clazz The class where the method is.
-     * @param params The arguments passed to the called method.
+     * @param clazz      The class where the method is.
+     * @param params     The arguments passed to the called method.
      */
-    private Object doPrivileged(final String methodName,
-                                final Class<?>[] clazz,
-                                Object[] params) {
+    private Object doPrivileged(final String methodName, final Class<?>[] clazz, Object[] params) {
 
-        try{
+        try {
             Method method = context.getClass().getMethod(methodName, clazz);
-            return executeMethod(method,context,params);
-        } catch (Exception ex){
+            return executeMethod(method, context, params);
+        } catch (Exception ex) {
             try {
                 handleException(ex);
-            } catch (Throwable t){
+            } catch (Throwable t) {
                 ExceptionUtils.handleThrowable(t);
                 throw new RuntimeException(t.getMessage());
             }
@@ -920,21 +859,16 @@ public class ApplicationContextFacade implements ServletContext {
 
     /**
      * Executes the method of the specified <code>ApplicationContext</code>
-     * @param method The method object to be invoked.
-     * @param context The ApplicationContext object on which the method
-     *                   will be invoked
-     * @param params The arguments passed to the called method.
+     *
+     * @param method  The method object to be invoked.
+     * @param context The ApplicationContext object on which the method will be invoked
+     * @param params  The arguments passed to the called method.
      */
-    private Object executeMethod(final Method method,
-                                 final ApplicationContext context,
-                                 final Object[] params)
-            throws PrivilegedActionException,
-                   IllegalAccessException,
-                   InvocationTargetException {
+    private Object executeMethod(final Method method, final ApplicationContext context, final Object[] params)
+            throws PrivilegedActionException, IllegalAccessException, InvocationTargetException {
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-           return AccessController.doPrivileged(
-                   new PrivilegedExecuteMethod(method, context,  params));
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new PrivilegedExecuteMethod(method, context, params));
         } else {
             return method.invoke(context, params);
         }
@@ -946,8 +880,7 @@ public class ApplicationContextFacade implements ServletContext {
      *
      * @param ex The current exception
      */
-    private void handleException(Exception ex)
-        throws Throwable {
+    private void handleException(Exception ex) throws Throwable {
 
         Throwable realException;
 
diff --git a/java/org/apache/catalina/core/ApplicationDispatcher.java b/java/org/apache/catalina/core/ApplicationDispatcher.java
index d928ae253c..eb06188c93 100644
--- a/java/org/apache/catalina/core/ApplicationDispatcher.java
+++ b/java/org/apache/catalina/core/ApplicationDispatcher.java
@@ -50,14 +50,11 @@ import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * Standard implementation of <code>RequestDispatcher</code> that allows a
- * request to be forwarded to a different resource to create the ultimate
- * response, or to include the output of another resource in the response
- * from this resource.  This implementation allows application level servlets
- * to wrap the request and/or response objects that are passed on to the
- * called resource, as long as the wrapping classes extend
- * <code>javax.servlet.ServletRequestWrapper</code> and
- * <code>javax.servlet.ServletResponseWrapper</code>.
+ * Standard implementation of <code>RequestDispatcher</code> that allows a request to be forwarded to a different
+ * resource to create the ultimate response, or to include the output of another resource in the response from this
+ * resource. This implementation allows application level servlets to wrap the request and/or response objects that are
+ * passed on to the called resource, as long as the wrapping classes extend
+ * <code>javax.servlet.ServletRequestWrapper</code> and <code>javax.servlet.ServletResponseWrapper</code>.
  *
  * @author Craig R. McClanahan
  */
@@ -71,8 +68,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
     static {
         STRICT_SERVLET_COMPLIANCE = Globals.STRICT_SERVLET_COMPLIANCE;
 
-        String wrapSameObject = System.getProperty(
-                "org.apache.catalina.core.ApplicationDispatcher.WRAP_SAME_OBJECT");
+        String wrapSameObject = System.getProperty("org.apache.catalina.core.ApplicationDispatcher.WRAP_SAME_OBJECT");
         if (wrapSameObject == null) {
             WRAP_SAME_OBJECT = STRICT_SERVLET_COMPLIANCE;
         } else {
@@ -81,8 +77,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
     }
 
 
-    protected class PrivilegedForward
-            implements PrivilegedExceptionAction<Void> {
+    protected class PrivilegedForward implements PrivilegedExceptionAction<Void> {
         private final ServletRequest request;
         private final ServletResponse response;
 
@@ -93,13 +88,12 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
         @Override
         public Void run() throws java.lang.Exception {
-            doForward(request,response);
+            doForward(request, response);
             return null;
         }
     }
 
-    protected class PrivilegedInclude implements
-            PrivilegedExceptionAction<Void> {
+    protected class PrivilegedInclude implements PrivilegedExceptionAction<Void> {
         private final ServletRequest request;
         private final ServletResponse response;
 
@@ -115,8 +109,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
         }
     }
 
-    protected class PrivilegedDispatch implements
-            PrivilegedExceptionAction<Void> {
+    protected class PrivilegedDispatch implements PrivilegedExceptionAction<Void> {
         private final ServletRequest request;
         private final ServletResponse response;
 
@@ -134,13 +127,11 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
 
     /**
-     * Used to pass state when the request dispatcher is used. Using instance
-     * variables causes threading issues and state is too complex to pass and
-     * return single ServletRequest or ServletResponse objects.
+     * Used to pass state when the request dispatcher is used. Using instance variables causes threading issues and
+     * state is too complex to pass and return single ServletRequest or ServletResponse objects.
      */
     private static class State {
-        State(ServletRequest request, ServletResponse response,
-                boolean including) {
+        State(ServletRequest request, ServletResponse response, boolean including) {
             this.outerRequest = request;
             this.outerResponse = response;
             this.including = including;
@@ -188,26 +179,20 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
 
     /**
-     * Construct a new instance of this class, configured according to the
-     * specified parameters.  If both servletPath and pathInfo are
-     * <code>null</code>, it will be assumed that this RequestDispatcher
-     * was acquired by name, rather than by path.
+     * Construct a new instance of this class, configured according to the specified parameters. If both servletPath and
+     * pathInfo are <code>null</code>, it will be assumed that this RequestDispatcher was acquired by name, rather than
+     * by path.
      *
-     * @param wrapper The Wrapper associated with the resource that will
-     *  be forwarded to or included (required)
-     * @param requestURI The request URI to this resource (if any)
+     * @param wrapper     The Wrapper associated with the resource that will be forwarded to or included (required)
+     * @param requestURI  The request URI to this resource (if any)
      * @param servletPath The revised servlet path to this resource (if any)
-     * @param pathInfo The revised extra path information to this resource
-     *  (if any)
-     * @param queryString Query string parameters included with this request
-     *  (if any)
-     * @param mapping The mapping for this resource (if any)
-     * @param name Servlet name (if a named dispatcher was created)
-     *  else <code>null</code>
+     * @param pathInfo    The revised extra path information to this resource (if any)
+     * @param queryString Query string parameters included with this request (if any)
+     * @param mapping     The mapping for this resource (if any)
+     * @param name        Servlet name (if a named dispatcher was created) else <code>null</code>
      */
-    public ApplicationDispatcher
-        (Wrapper wrapper, String requestURI, String servletPath,
-         String pathInfo, String queryString, HttpServletMapping mapping, String name) {
+    public ApplicationDispatcher(Wrapper wrapper, String requestURI, String servletPath, String pathInfo,
+            String queryString, HttpServletMapping mapping, String name) {
 
         super();
 
@@ -274,8 +259,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
 
     /**
-     * The Wrapper associated with the resource that will be forwarded to
-     * or included.
+     * The Wrapper associated with the resource that will be forwarded to or included.
      */
     private final Wrapper wrapper;
 
@@ -284,23 +268,20 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
 
     /**
-     * Forward this request and response to another resource for processing.
-     * Any runtime exception, IOException, or ServletException thrown by the
-     * called servlet will be propagated to the caller.
+     * Forward this request and response to another resource for processing. Any runtime exception, IOException, or
+     * ServletException thrown by the called servlet will be propagated to the caller.
      *
-     * @param request The servlet request to be forwarded
+     * @param request  The servlet request to be forwarded
      * @param response The servlet response to be forwarded
      *
-     * @exception IOException if an input/output error occurs
+     * @exception IOException      if an input/output error occurs
      * @exception ServletException if a servlet exception occurs
      */
     @Override
-    public void forward(ServletRequest request, ServletResponse response)
-        throws ServletException, IOException
-    {
+    public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
         if (Globals.IS_SECURITY_ENABLED) {
             try {
-                PrivilegedForward dp = new PrivilegedForward(request,response);
+                PrivilegedForward dp = new PrivilegedForward(request, response);
                 AccessController.doPrivileged(dp);
             } catch (PrivilegedActionException pe) {
                 Exception e = pe.getException();
@@ -310,18 +291,15 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
                 throw (IOException) e;
             }
         } else {
-            doForward(request,response);
+            doForward(request, response);
         }
     }
 
-    private void doForward(ServletRequest request, ServletResponse response)
-        throws ServletException, IOException
-    {
+    private void doForward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
 
         // Reset any output that has been buffered, but keep headers/cookies
         if (response.isCommitted()) {
-            throw new IllegalStateException
-                (sm.getString("applicationDispatcher.forward.ise"));
+            throw new IllegalStateException(sm.getString("applicationDispatcher.forward.ise"));
         }
         try {
             response.resetBuffer();
@@ -341,8 +319,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
         // Handle an HTTP named dispatcher forward
         if ((servletPath == null) && (pathInfo == null)) {
 
-            ApplicationHttpRequest wrequest =
-                (ApplicationHttpRequest) wrapRequest(state);
+            ApplicationHttpRequest wrequest = (ApplicationHttpRequest) wrapRequest(state);
             HttpServletRequest hrequest = state.hrequest;
             wrequest.setRequestURI(hrequest.getRequestURI());
             wrequest.setContextPath(hrequest.getContextPath());
@@ -350,7 +327,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
             wrequest.setPathInfo(hrequest.getPathInfo());
             wrequest.setQueryString(hrequest.getQueryString());
 
-            processRequest(request,response,state);
+            processRequest(request, response, state);
         }
 
         // Handle an HTTP path-based forward
@@ -359,16 +336,11 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
             ApplicationHttpRequest wrequest = (ApplicationHttpRequest) wrapRequest(state);
             HttpServletRequest hrequest = state.hrequest;
             if (hrequest.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI) == null) {
-                wrequest.setAttribute(RequestDispatcher.FORWARD_REQUEST_URI,
-                                      hrequest.getRequestURI());
-                wrequest.setAttribute(RequestDispatcher.FORWARD_CONTEXT_PATH,
-                                      hrequest.getContextPath());
-                wrequest.setAttribute(RequestDispatcher.FORWARD_SERVLET_PATH,
-                                      hrequest.getServletPath());
-                wrequest.setAttribute(RequestDispatcher.FORWARD_PATH_INFO,
-                                      hrequest.getPathInfo());
-                wrequest.setAttribute(RequestDispatcher.FORWARD_QUERY_STRING,
-                                      hrequest.getQueryString());
+                wrequest.setAttribute(RequestDispatcher.FORWARD_REQUEST_URI, hrequest.getRequestURI());
+                wrequest.setAttribute(RequestDispatcher.FORWARD_CONTEXT_PATH, hrequest.getContextPath());
+                wrequest.setAttribute(RequestDispatcher.FORWARD_SERVLET_PATH, hrequest.getServletPath());
+                wrequest.setAttribute(RequestDispatcher.FORWARD_PATH_INFO, hrequest.getPathInfo());
+                wrequest.setAttribute(RequestDispatcher.FORWARD_QUERY_STRING, hrequest.getQueryString());
                 wrequest.setAttribute(RequestDispatcher.FORWARD_MAPPING, hrequest.getHttpServletMapping());
             }
 
@@ -382,7 +354,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
             }
             wrequest.setMapping(mapping);
 
-            processRequest(request,response,state);
+            processRequest(request, response, state);
         }
 
         if (request.isAsyncStarted()) {
@@ -392,18 +364,18 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
         }
 
         // This is not a real close in order to support error processing
-        if (wrapper.getLogger().isDebugEnabled() ) {
+        if (wrapper.getLogger().isDebugEnabled()) {
             wrapper.getLogger().debug(" Disabling the response for further output");
         }
 
-        if  (response instanceof ResponseFacade) {
+        if (response instanceof ResponseFacade) {
             ((ResponseFacade) response).finish();
         } else {
             // Servlet SRV.6.2.2. The Request/Response may have been wrapped
             // and may no longer be instance of RequestFacade
-            if (wrapper.getLogger().isDebugEnabled()){
-                wrapper.getLogger().debug( " The Response is vehiculed using a wrapper: "
-                           + response.getClass().getName() );
+            if (wrapper.getLogger().isDebugEnabled()) {
+                wrapper.getLogger()
+                        .debug(" The Response is vehiculed using a wrapper: " + response.getClass().getName());
             }
 
             // Close anyway
@@ -427,35 +399,29 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
     /**
      * Prepare the request based on the filter configuration.
-     * @param request The servlet request we are processing
+     *
+     * @param request  The servlet request we are processing
      * @param response The servlet response we are creating
-     * @param state The RD state
+     * @param state    The RD state
      *
-     * @exception IOException if an input/output error occurs
+     * @exception IOException      if an input/output error occurs
      * @exception ServletException if a servlet error occurs
      */
-    private void processRequest(ServletRequest request,
-                                ServletResponse response,
-                                State state)
-        throws IOException, ServletException {
+    private void processRequest(ServletRequest request, ServletResponse response, State state)
+            throws IOException, ServletException {
 
         DispatcherType disInt = (DispatcherType) request.getAttribute(Globals.DISPATCHER_TYPE_ATTR);
         if (disInt != null) {
             boolean doInvoke = true;
 
-            if (context.getFireRequestListenersOnForwards() &&
-                    !context.fireRequestInitEvent(request)) {
+            if (context.getFireRequestListenersOnForwards() && !context.fireRequestInitEvent(request)) {
                 doInvoke = false;
             }
 
             if (doInvoke) {
                 if (disInt != DispatcherType.ERROR) {
-                    state.outerRequest.setAttribute(
-                            Globals.DISPATCHER_REQUEST_PATH_ATTR,
-                            getCombinedPath());
-                    state.outerRequest.setAttribute(
-                            Globals.DISPATCHER_TYPE_ATTR,
-                            DispatcherType.FORWARD);
+                    state.outerRequest.setAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR, getCombinedPath());
+                    state.outerRequest.setAttribute(Globals.DISPATCHER_TYPE_ATTR, DispatcherType.FORWARD);
                     invoke(state.outerRequest, response, state);
                 } else {
                     invoke(state.outerRequest, response, state);
@@ -470,9 +436,9 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
 
     /**
-     * Combine the servletPath and the pathInfo. If pathInfo is
-     * <code>null</code> it is ignored. If servletPath is <code>null</code> then
-     * <code>null</code> is returned.
+     * Combine the servletPath and the pathInfo. If pathInfo is <code>null</code> it is ignored. If servletPath is
+     * <code>null</code> then <code>null</code> is returned.
+     *
      * @return The combined path with pathInfo appended to servletInfo
      */
     private String getCombinedPath() {
@@ -487,23 +453,20 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
 
     /**
-     * Include the response from another resource in the current response.
-     * Any runtime exception, IOException, or ServletException thrown by the
-     * called servlet will be propagated to the caller.
+     * Include the response from another resource in the current response. Any runtime exception, IOException, or
+     * ServletException thrown by the called servlet will be propagated to the caller.
      *
-     * @param request The servlet request that is including this one
+     * @param request  The servlet request that is including this one
      * @param response The servlet response to be appended to
      *
-     * @exception IOException if an input/output error occurs
+     * @exception IOException      if an input/output error occurs
      * @exception ServletException if a servlet exception occurs
      */
     @Override
-    public void include(ServletRequest request, ServletResponse response)
-        throws ServletException, IOException
-    {
+    public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
         if (Globals.IS_SECURITY_ENABLED) {
             try {
-                PrivilegedInclude dp = new PrivilegedInclude(request,response);
+                PrivilegedInclude dp = new PrivilegedInclude(request, response);
                 AccessController.doPrivileged(dp);
             } catch (PrivilegedActionException pe) {
                 Exception e = pe.getException();
@@ -518,8 +481,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
         }
     }
 
-    private void doInclude(ServletRequest request, ServletResponse response)
-            throws ServletException, IOException {
+    private void doInclude(ServletRequest request, ServletResponse response) throws ServletException, IOException {
 
         // Set up to handle the specified request and response
         State state = new State(request, response, true);
@@ -548,8 +510,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
         // Handle an HTTP path based include
         else {
 
-            ApplicationHttpRequest wrequest =
-                (ApplicationHttpRequest) wrapRequest(state);
+            ApplicationHttpRequest wrequest = (ApplicationHttpRequest) wrapRequest(state);
             String contextPath = context.getPath();
             if (requestURI != null) {
                 wrequest.setAttribute(RequestDispatcher.INCLUDE_REQUEST_URI, requestURI);
@@ -571,10 +532,8 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
                 wrequest.setAttribute(RequestDispatcher.INCLUDE_MAPPING, mapping);
             }
 
-            wrequest.setAttribute(Globals.DISPATCHER_TYPE_ATTR,
-                    DispatcherType.INCLUDE);
-            wrequest.setAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR,
-                    getCombinedPath());
+            wrequest.setAttribute(Globals.DISPATCHER_TYPE_ATTR, DispatcherType.INCLUDE);
+            wrequest.setAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR, getCombinedPath());
             invoke(state.outerRequest, state.outerResponse, state);
         }
 
@@ -582,11 +541,10 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
 
     @Override
-    public void dispatch(ServletRequest request, ServletResponse response)
-            throws ServletException, IOException {
+    public void dispatch(ServletRequest request, ServletResponse response) throws ServletException, IOException {
         if (Globals.IS_SECURITY_ENABLED) {
             try {
-                PrivilegedDispatch dp = new PrivilegedDispatch(request,response);
+                PrivilegedDispatch dp = new PrivilegedDispatch(request, response);
                 AccessController.doPrivileged(dp);
             } catch (PrivilegedActionException pe) {
                 Exception e = pe.getException();
@@ -601,8 +559,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
         }
     }
 
-    private void doDispatch(ServletRequest request, ServletResponse response)
-            throws ServletException, IOException {
+    private void doDispatch(ServletRequest request, ServletResponse response) throws ServletException, IOException {
 
         // Set up to handle the specified request and response
         State state = new State(request, response, false);
@@ -637,22 +594,20 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
 
     /**
-     * Ask the resource represented by this RequestDispatcher to process
-     * the associated request, and create (or append to) the associated
-     * response.
+     * Ask the resource represented by this RequestDispatcher to process the associated request, and create (or append
+     * to) the associated response.
      * <p>
-     * <strong>IMPLEMENTATION NOTE</strong>: This implementation assumes
-     * that no filters are applied to a forwarded or included resource,
-     * because they were already done for the original request.
+     * <strong>IMPLEMENTATION NOTE</strong>: This implementation assumes that no filters are applied to a forwarded or
+     * included resource, because they were already done for the original request.
      *
-     * @param request The servlet request we are processing
+     * @param request  The servlet request we are processing
      * @param response The servlet response we are creating
      *
-     * @exception IOException if an input/output error occurs
+     * @exception IOException      if an input/output error occurs
      * @exception ServletException if a servlet error occurs
      */
-    private void invoke(ServletRequest request, ServletResponse response,
-            State state) throws IOException, ServletException {
+    private void invoke(ServletRequest request, ServletResponse response, State state)
+            throws IOException, ServletException {
 
         // Checking to see if the context classloader is the current context
         // classloader. If it's not, we're saving it, and setting the context
@@ -669,9 +624,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
         // Check for the servlet being marked unavailable
         if (wrapper.isUnavailable()) {
-            wrapper.getLogger().warn(
-                    sm.getString("applicationDispatcher.isUnavailable",
-                    wrapper.getName()));
+            wrapper.getLogger().warn(sm.getString("applicationDispatcher.isUnavailable", wrapper.getName()));
             long available = wrapper.getAvailable();
             if ((available > 0L) && (available < Long.MAX_VALUE)) {
                 hresponse.setDateHeader("Retry-After", available);
@@ -687,51 +640,45 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
                 servlet = wrapper.allocate();
             }
         } catch (ServletException e) {
-            wrapper.getLogger().error(sm.getString("applicationDispatcher.allocateException",
-                             wrapper.getName()), StandardWrapper.getRootCause(e));
+            wrapper.getLogger().error(sm.getString("applicationDispatcher.allocateException", wrapper.getName()),
+                    StandardWrapper.getRootCause(e));
             servletException = e;
         } catch (Throwable e) {
             ExceptionUtils.handleThrowable(e);
-            wrapper.getLogger().error(sm.getString("applicationDispatcher.allocateException",
-                             wrapper.getName()), e);
-            servletException = new ServletException
-                (sm.getString("applicationDispatcher.allocateException",
-                              wrapper.getName()), e);
+            wrapper.getLogger().error(sm.getString("applicationDispatcher.allocateException", wrapper.getName()), e);
+            servletException = new ServletException(
+                    sm.getString("applicationDispatcher.allocateException", wrapper.getName()), e);
             servlet = null;
         }
 
         // Get the FilterChain Here
-        ApplicationFilterChain filterChain =
-                ApplicationFilterFactory.createFilterChain(request, wrapper, servlet);
+        ApplicationFilterChain filterChain = ApplicationFilterFactory.createFilterChain(request, wrapper, servlet);
 
         // Call the service() method for the allocated servlet instance
         try {
             // for includes/forwards
             if ((servlet != null) && (filterChain != null)) {
-               filterChain.doFilter(request, response);
-             }
+                filterChain.doFilter(request, response);
+            }
             // Servlet Service Method is called by the FilterChain
         } catch (ClientAbortException e) {
             ioException = e;
         } catch (IOException e) {
-            wrapper.getLogger().error(sm.getString("applicationDispatcher.serviceException",
-                             wrapper.getName()), e);
+            wrapper.getLogger().error(sm.getString("applicationDispatcher.serviceException", wrapper.getName()), e);
             ioException = e;
         } catch (UnavailableException e) {
-            wrapper.getLogger().error(sm.getString("applicationDispatcher.serviceException",
-                             wrapper.getName()), e);
+            wrapper.getLogger().error(sm.getString("applicationDispatcher.serviceException", wrapper.getName()), e);
             servletException = e;
             wrapper.unavailable(e);
         } catch (ServletException e) {
             Throwable rootCause = StandardWrapper.getRootCause(e);
             if (!(rootCause instanceof ClientAbortException)) {
-                wrapper.getLogger().error(sm.getString("applicationDispatcher.serviceException",
-                        wrapper.getName()), rootCause);
+                wrapper.getLogger().error(sm.getString("applicationDispatcher.serviceException", wrapper.getName()),
+                        rootCause);
             }
             servletException = e;
         } catch (RuntimeException e) {
-            wrapper.getLogger().error(sm.getString("applicationDispatcher.serviceException",
-                             wrapper.getName()), e);
+            wrapper.getLogger().error(sm.getString("applicationDispatcher.serviceException", wrapper.getName()), e);
             runtimeException = e;
         }
 
@@ -746,16 +693,13 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
                 wrapper.deallocate(servlet);
             }
         } catch (ServletException e) {
-            wrapper.getLogger().error(sm.getString("applicationDispatcher.deallocateException",
-                             wrapper.getName()), e);
+            wrapper.getLogger().error(sm.getString("applicationDispatcher.deallocateException", wrapper.getName()), e);
             servletException = e;
         } catch (Throwable e) {
             ExceptionUtils.handleThrowable(e);
-            wrapper.getLogger().error(sm.getString("applicationDispatcher.deallocateException",
-                             wrapper.getName()), e);
-            servletException = new ServletException
-                (sm.getString("applicationDispatcher.deallocateException",
-                              wrapper.getName()), e);
+            wrapper.getLogger().error(sm.getString("applicationDispatcher.deallocateException", wrapper.getName()), e);
+            servletException = new ServletException(
+                    sm.getString("applicationDispatcher.deallocateException", wrapper.getName()), e);
         }
 
         // Reset the old context class loader
@@ -807,8 +751,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
             // Remove the current request if it is our wrapper
             if (current == state.wrapRequest) {
-                ServletRequest next =
-                  ((ServletRequestWrapper) current).getRequest();
+                ServletRequest next = ((ServletRequestWrapper) current).getRequest();
                 if (previous == null) {
                     state.outerRequest = next;
                 } else {
@@ -851,8 +794,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
             // Remove the current response if it is our wrapper
             if (current == state.wrapResponse) {
-                ServletResponse next =
-                  ((ServletResponseWrapper) current).getResponse();
+                ServletResponse next = ((ServletResponseWrapper) current).getResponse();
                 if (previous == null) {
                     state.outerResponse = next;
                 } else {
@@ -871,8 +813,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
 
     /**
-     * Create and return a request wrapper that has been inserted in the
-     * appropriate spot in the request chain.
+     * Create and return a request wrapper that has been inserted in the appropriate spot in the request chain.
      */
     private ServletRequest wrapRequest(State state) {
 
@@ -880,8 +821,8 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
         ServletRequest previous = null;
         ServletRequest current = state.outerRequest;
         while (current != null) {
-            if(state.hrequest == null && (current instanceof HttpServletRequest)) {
-                state.hrequest = (HttpServletRequest)current;
+            if (state.hrequest == null && (current instanceof HttpServletRequest)) {
+                state.hrequest = (HttpServletRequest) current;
             }
             if (!(current instanceof ServletRequestWrapper)) {
                 break;
@@ -898,27 +839,22 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
         // Instantiate a new wrapper at this point and insert it in the chain
         ServletRequest wrapper = null;
-        if ((current instanceof ApplicationHttpRequest) ||
-            (current instanceof Request) ||
-            (current instanceof HttpServletRequest)) {
+        if ((current instanceof ApplicationHttpRequest) || (current instanceof Request) ||
+                (current instanceof HttpServletRequest)) {
             // Compute a crossContext flag
             HttpServletRequest hcurrent = (HttpServletRequest) current;
             boolean crossContext = false;
-            if ((state.outerRequest instanceof ApplicationHttpRequest) ||
-                (state.outerRequest instanceof Request) ||
-                (state.outerRequest instanceof HttpServletRequest)) {
-                HttpServletRequest houterRequest =
-                    (HttpServletRequest) state.outerRequest;
-                Object contextPath = houterRequest.getAttribute(
-                        RequestDispatcher.INCLUDE_CONTEXT_PATH);
+            if ((state.outerRequest instanceof ApplicationHttpRequest) || (state.outerRequest instanceof Request) ||
+                    (state.outerRequest instanceof HttpServletRequest)) {
+                HttpServletRequest houterRequest = (HttpServletRequest) state.outerRequest;
+                Object contextPath = houterRequest.getAttribute(RequestDispatcher.INCLUDE_CONTEXT_PATH);
                 if (contextPath == null) {
                     // Forward
                     contextPath = houterRequest.getContextPath();
                 }
                 crossContext = !(context.getPath().equals(contextPath));
             }
-            wrapper = new ApplicationHttpRequest
-                (hcurrent, context, crossContext);
+            wrapper = new ApplicationHttpRequest(hcurrent, context, crossContext);
         } else {
             wrapper = new ApplicationRequest(current);
         }
@@ -934,8 +870,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
 
     /**
-     * Create and return a response wrapper that has been inserted in the
-     * appropriate spot in the response chain.
+     * Create and return a response wrapper that has been inserted in the appropriate spot in the response chain.
      */
     private ServletResponse wrapResponse(State state) {
 
@@ -944,7 +879,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
         ServletResponse current = state.outerResponse;
         while (current != null) {
             if (state.hresponse == null && (current instanceof HttpServletResponse)) {
-                state.hresponse = (HttpServletResponse)current;
+                state.hresponse = (HttpServletResponse) current;
                 if (!state.including) { // Forward only needs hresponse
                     return null;
                 }
@@ -980,12 +915,9 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
 
     }
 
-    private void checkSameObjects(ServletRequest appRequest,
-            ServletResponse appResponse) throws ServletException {
-        ServletRequest originalRequest =
-            ApplicationFilterChain.getLastServicedRequest();
-        ServletResponse originalResponse =
-            ApplicationFilterChain.getLastServicedResponse();
+    private void checkSameObjects(ServletRequest appRequest, ServletResponse appResponse) throws ServletException {
+        ServletRequest originalRequest = ApplicationFilterChain.getLastServicedRequest();
+        ServletResponse originalResponse = ApplicationFilterChain.getLastServicedResponse();
 
         // Some forwards, eg from valves will not set original values
         if (originalRequest == null || originalResponse == null) {
@@ -995,56 +927,49 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher
         boolean same = false;
         ServletRequest dispatchedRequest = appRequest;
 
-        //find the request that was passed into the service method
+        // find the request that was passed into the service method
         while (originalRequest instanceof ServletRequestWrapper &&
-                ((ServletRequestWrapper) originalRequest).getRequest()!=null ) {
-            originalRequest =
-                ((ServletRequestWrapper) originalRequest).getRequest();
+                ((ServletRequestWrapper) originalRequest).getRequest() != null) {
+            originalRequest = ((ServletRequestWrapper) originalRequest).getRequest();
         }
-        //compare with the dispatched request
+        // compare with the dispatched request
         while (!same) {
             if (originalRequest.equals(dispatchedRequest)) {
                 same = true;
             }
             if (!same && dispatchedRequest instanceof ServletRequestWrapper) {
-                dispatchedRequest =
-                    ((ServletRequestWrapper) dispatchedRequest).getRequest();
+                dispatchedRequest = ((ServletRequestWrapper) dispatchedRequest).getRequest();
             } else {
                 break;
             }
         }
         if (!same) {
-            throw new ServletException(sm.getString(
-                    "applicationDispatcher.specViolation.request"));
+            throw new ServletException(sm.getString("applicationDispatcher.specViolation.request"));
         }
 
         same = false;
         ServletResponse dispatchedResponse = appResponse;
 
-        //find the response that was passed into the service method
+        // find the response that was passed into the service method
         while (originalResponse instanceof ServletResponseWrapper &&
-                ((ServletResponseWrapper) originalResponse).getResponse() !=
-                    null ) {
-            originalResponse =
-                ((ServletResponseWrapper) originalResponse).getResponse();
+                ((ServletResponseWrapper) originalResponse).getResponse() != null) {
+            originalResponse = ((ServletResponseWrapper) originalResponse).getResponse();
         }
-        //compare with the dispatched response
+        // compare with the dispatched response
         while (!same) {
             if (originalResponse.equals(dispatchedResponse)) {
                 same = true;
             }
 
             if (!same && dispatchedResponse instanceof ServletResponseWrapper) {
-                dispatchedResponse =
-                    ((ServletResponseWrapper) dispatchedResponse).getResponse();
+                dispatchedResponse = ((ServletResponseWrapper) dispatchedResponse).getResponse();
             } else {
                 break;
             }
         }
 
         if (!same) {
-            throw new ServletException(sm.getString(
-                    "applicationDispatcher.specViolation.response"));
+            throw new ServletException(sm.getString("applicationDispatcher.specViolation.response"));
         }
     }
 
diff --git a/java/org/apache/catalina/core/ApplicationFilterChain.java b/java/org/apache/catalina/core/ApplicationFilterChain.java
index 642f69ea8b..5ef4a4eb56 100644
--- a/java/org/apache/catalina/core/ApplicationFilterChain.java
+++ b/java/org/apache/catalina/core/ApplicationFilterChain.java
@@ -36,11 +36,9 @@ import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * Implementation of <code>javax.servlet.FilterChain</code> used to manage
- * the execution of a set of filters for a particular request.  When the
- * set of defined filters has all been executed, the next call to
- * <code>doFilter()</code> will execute the servlet's <code>service()</code>
- * method itself.
+ * Implementation of <code>javax.servlet.FilterChain</code> used to manage the execution of a set of filters for a
+ * particular request. When the set of defined filters has all been executed, the next call to <code>doFilter()</code>
+ * will execute the servlet's <code>service()</code> method itself.
  *
  * @author Craig R. McClanahan
  */
@@ -75,8 +73,7 @@ public final class ApplicationFilterChain implements FilterChain {
 
 
     /**
-     * The int which is used to maintain the current position
-     * in the filter chain.
+     * The int which is used to maintain the current position in the filter chain.
      */
     private int pos = 0;
 
@@ -105,48 +102,42 @@ public final class ApplicationFilterChain implements FilterChain {
 
 
     /**
-     * Static class array used when the SecurityManager is turned on and
-     * <code>doFilter</code> is invoked.
+     * Static class array used when the SecurityManager is turned on and <code>doFilter</code> is invoked.
      */
-    private static final Class<?>[] classType = new Class[]{
-        ServletRequest.class, ServletResponse.class, FilterChain.class};
+    private static final Class<?>[] classType = new Class[] { ServletRequest.class, ServletResponse.class,
+            FilterChain.class };
 
     /**
-     * Static class array used when the SecurityManager is turned on and
-     * <code>service</code> is invoked.
+     * Static class array used when the SecurityManager is turned on and <code>service</code> is invoked.
      */
-    private static final Class<?>[] classTypeUsedInService = new Class[]{
-        ServletRequest.class, ServletResponse.class};
+    private static final Class<?>[] classTypeUsedInService = new Class[] { ServletRequest.class,
+            ServletResponse.class };
 
 
     // ---------------------------------------------------- FilterChain Methods
 
     /**
-     * Invoke the next filter in this chain, passing the specified request
-     * and response.  If there are no more filters in this chain, invoke
-     * the <code>service()</code> method of the servlet itself.
+     * Invoke the next filter in this chain, passing the specified request and response. If there are no more filters in
+     * this chain, invoke the <code>service()</code> method of the servlet itself.
      *
-     * @param request The servlet request we are processing
+     * @param request  The servlet request we are processing
      * @param response The servlet response we are creating
      *
-     * @exception IOException if an input/output error occurs
+     * @exception IOException      if an input/output error occurs
      * @exception ServletException if a servlet exception occurs
      */
     @Override
-    public void doFilter(ServletRequest request, ServletResponse response)
-        throws IOException, ServletException {
+    public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
 
-        if( Globals.IS_SECURITY_ENABLED ) {
+        if (Globals.IS_SECURITY_ENABLED) {
             final ServletRequest req = request;
             final ServletResponse res = response;
             try {
-                java.security.AccessController.doPrivileged(
-                        (java.security.PrivilegedExceptionAction<Void>) () -> {
-                            internalDoFilter(req,res);
-                            return null;
-                        }
-                );
-            } catch( PrivilegedActionException pe) {
+                java.security.AccessController.doPrivileged((java.security.PrivilegedExceptionAction<Void>) () -> {
+                    internalDoFilter(req, res);
+                    return null;
+                });
+            } catch (PrivilegedActionException pe) {
                 Exception e = pe.getException();
                 if (e instanceof ServletException) {
                     throw (ServletException) e;
@@ -159,13 +150,12 @@ public final class ApplicationFilterChain implements FilterChain {
                 }
             }
         } else {
-            internalDoFilter(request,response);
+            internalDoFilter(request, response);
         }
     }
 
-    private void internalDoFilter(ServletRequest request,
-                                  ServletResponse response)
-        throws IOException, ServletException {
+    private void internalDoFilter(ServletRequest request, ServletResponse response)
+            throws IOException, ServletException {
 
         // Call the next filter if there is one
         if (pos < n) {
@@ -173,18 +163,17 @@ public final class ApplicationFilterChain implements FilterChain {
             try {
                 Filter filter = filterConfig.getFilter();
 
-                if (request.isAsyncSupported() && "false".equalsIgnoreCase(
-                        filterConfig.getFilterDef().getAsyncSupported())) {
+                if (request.isAsyncSupported() &&
+                        "false".equalsIgnoreCase(filterConfig.getFilterDef().getAsyncSupported())) {
                     request.setAttribute(Globals.ASYNC_SUPPORTED_ATTR, Boolean.FALSE);
                 }
-                if( Globals.IS_SECURITY_ENABLED ) {
+                if (Globals.IS_SECURITY_ENABLED) {
                     final ServletRequest req = request;
                     final ServletResponse res = response;
-                    Principal principal =
-                        ((HttpServletRequest) req).getUserPrincipal();
+                    Principal principal = ((HttpServletRequest) req).getUserPrincipal();
 
-                    Object[] args = new Object[]{req, res, this};
-                    SecurityUtil.doAsPrivilege ("doFilter", filter, classType, args, principal);
+                    Object[] args = new Object[] { req, res, this };
+                    SecurityUtil.doAsPrivilege("doFilter", filter, classType, args, principal);
                 } else {
                     filter.doFilter(request, response, this);
                 }
@@ -206,23 +195,16 @@ public final class ApplicationFilterChain implements FilterChain {
             }
 
             if (request.isAsyncSupported() && !servletSupportsAsync) {
-                request.setAttribute(Globals.ASYNC_SUPPORTED_ATTR,
-                        Boolean.FALSE);
+                request.setAttribute(Globals.ASYNC_SUPPORTED_ATTR, Boolean.FALSE);
             }
             // Use potentially wrapped request from this point
-            if ((request instanceof HttpServletRequest) &&
-                    (response instanceof HttpServletResponse) &&
-                    Globals.IS_SECURITY_ENABLED ) {
+            if ((request instanceof HttpServletRequest) && (response instanceof HttpServletResponse) &&
+                    Globals.IS_SECURITY_ENABLED) {
                 final ServletRequest req = request;
                 final ServletResponse res = response;
-                Principal principal =
-                    ((HttpServletRequest) req).getUserPrincipal();
-                Object[] args = new Object[]{req, res};
-                SecurityUtil.doAsPrivilege("service",
-                                           servlet,
-                                           classTypeUsedInService,
-                                           args,
-                                           principal);
+                Principal principal = ((HttpServletRequest) req).getUserPrincipal();
+                Object[] args = new Object[] { req, res };
+                SecurityUtil.doAsPrivilege("service", servlet, classTypeUsedInService, args, principal);
             } else {
                 servlet.service(request, response);
             }
@@ -242,8 +224,7 @@ public final class ApplicationFilterChain implements FilterChain {
 
 
     /**
-     * The last request passed to a servlet for servicing from the current
-     * thread.
+     * The last request passed to a servlet for servicing from the current thread.
      *
      * @return The last request to be serviced.
      */
@@ -253,8 +234,7 @@ public final class ApplicationFilterChain implements FilterChain {
 
 
     /**
-     * The last response passed to a servlet for servicing from the current
-     * thread.
+     * The last response passed to a servlet for servicing from the current thread.
      *
      * @return The last response to be serviced.
      */
@@ -273,15 +253,14 @@ public final class ApplicationFilterChain implements FilterChain {
     void addFilter(ApplicationFilterConfig filterConfig) {
 
         // Prevent the same filter being added multiple times
-        for(ApplicationFilterConfig filter:filters) {
-            if(filter==filterConfig) {
+        for (ApplicationFilterConfig filter : filters) {
+            if (filter == filterConfig) {
                 return;
             }
         }
 
         if (n == filters.length) {
-            ApplicationFilterConfig[] newFilters =
-                new ApplicationFilterConfig[n + INCREMENT];
+            ApplicationFilterConfig[] newFilters = new ApplicationFilterConfig[n + INCREMENT];
             System.arraycopy(filters, 0, newFilters, 0, n);
             filters = newFilters;
         }
@@ -328,15 +307,13 @@ public final class ApplicationFilterChain implements FilterChain {
 
 
     /**
-     * Identifies the Filters, if any, in this FilterChain that do not support
-     * async.
+     * Identifies the Filters, if any, in this FilterChain that do not support async.
      *
-     * @param result The Set to which the fully qualified class names of each
-     *               Filter in this FilterChain that does not support async will
-     *               be added
+     * @param result The Set to which the fully qualified class names of each Filter in this FilterChain that does not
+     *                   support async will be added
      */
     public void findNonAsyncFilters(Set<String> result) {
-        for (int i = 0; i < n ; i++) {
+        for (int i = 0; i < n; i++) {
             ApplicationFilterConfig filter = filters[i];
             if ("false".equalsIgnoreCase(filter.getFilterDef().getAsyncSupported())) {
                 result.add(filter.getFilterClass());
diff --git a/java/org/apache/catalina/core/ApplicationFilterConfig.java b/java/org/apache/catalina/core/ApplicationFilterConfig.java
index c33040c50c..63bb70bbc0 100644
--- a/java/org/apache/catalina/core/ApplicationFilterConfig.java
+++ b/java/org/apache/catalina/core/ApplicationFilterConfig.java
@@ -46,9 +46,8 @@ import org.apache.tomcat.util.res.StringManager;
 
 
 /**
- * Implementation of a <code>javax.servlet.FilterConfig</code> useful in
- * managing the filter instances instantiated when a web application
- * is first started.
+ * Implementation of a <code>javax.servlet.FilterConfig</code> useful in managing the filter instances instantiated when
+ * a web application is first started.
  *
  * @author Craig R. McClanahan
  */
@@ -69,29 +68,25 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable
 
 
     /**
-     * Construct a new ApplicationFilterConfig for the specified filter
-     * definition.
+     * Construct a new ApplicationFilterConfig for the specified filter definition.
      *
-     * @param context The context with which we are associated
-     * @param filterDef Filter definition for which a FilterConfig is to be
-     *  constructed
+     * @param context   The context with which we are associated
+     * @param filterDef Filter definition for which a FilterConfig is to be constructed
      *
-     * @exception ClassCastException if the specified class does not implement
-     *  the <code>javax.servlet.Filter</code> interface
+     * @exception ClassCastException     if the specified class does not implement the <code>javax.servlet.Filter</code>
+     *                                       interface
      * @exception ClassNotFoundException if the filter class cannot be found
-     * @exception IllegalAccessException if the filter class cannot be
-     *  publicly instantiated
-     * @exception InstantiationException if an exception occurs while
-     *  instantiating the filter object
-     * @exception ServletException if thrown by the filter's init() method
-     * @throws NamingException If a JNDI lookup fails
-     * @throws SecurityException If a security manager prevents the creation
-     * @throws IllegalArgumentException If the provided configuration is not
-     *         valid
+     * @exception IllegalAccessException if the filter class cannot be publicly instantiated
+     * @exception InstantiationException if an exception occurs while instantiating the filter object
+     * @exception ServletException       if thrown by the filter's init() method
+     *
+     * @throws NamingException          If a JNDI lookup fails
+     * @throws SecurityException        If a security manager prevents the creation
+     * @throws IllegalArgumentException If the provided configuration is not valid
      */
     ApplicationFilterConfig(Context context, FilterDef filterDef)
-            throws ClassCastException, ReflectiveOperationException, ServletException,
-            NamingException, IllegalArgumentException, SecurityException {
+            throws ClassCastException, ReflectiveOperationException, ServletException, NamingException,
+            IllegalArgumentException, SecurityException {
 
         super();
 
@@ -152,16 +147,15 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable
     }
 
     /**
-     * Return a <code>String</code> containing the value of the named
-     * initialization parameter, or <code>null</code> if the parameter
-     * does not exist.
+     * Return a <code>String</code> containing the value of the named initialization parameter, or <code>null</code> if
+     * the parameter does not exist.
      *
      * @param name Name of the requested initialization parameter
      */
     @Override
     public String getInitParameter(String name) {
 
-        Map<String,String> map = filterDef.getParameterMap();
+        Map<String, String> map = filterDef.getParameterMap();
         if (map == null) {
             return null;
         }
@@ -172,12 +166,11 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable
 
 
     /**
-     * Return an <code>Enumeration</code> of the names of the initialization
-     * parameters for this Filter.
+     * Return an <code>Enumeration</code> of the names of the initialization parameters for this Filter.
      */
     @Override
     public Enumeration<String> getInitParameterNames() {
-        Map<String,String> map = filterDef.getParameterMap();
+        Map<String, String> map = filterDef.getParameterMap();
 
         if (map == null) {
             return Collections.enumeration(emptyString);
@@ -224,22 +217,20 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable
     /**
      * Return the application Filter we are configured for.
      *
-     * @exception ClassCastException if the specified class does not implement
-     *  the <code>javax.servlet.Filter</code> interface
+     * @exception ClassCastException     if the specified class does not implement the <code>javax.servlet.Filter</code>
+     *                                       interface
      * @exception ClassNotFoundException if the filter class cannot be found
-     * @exception IllegalAccessException if the filter class cannot be
-     *  publicly instantiated
-     * @exception InstantiationException if an exception occurs while
-     *  instantiating the filter object
-     * @exception ServletException if thrown by the filter's init() method
-     * @throws NamingException If a JNDI lookup fails
+     * @exception IllegalAccessException if the filter class cannot be publicly instantiated
+     * @exception InstantiationException if an exception occurs while instantiating the filter object
+     * @exception ServletException       if thrown by the filter's init() method
+     *
+     * @throws NamingException              If a JNDI lookup fails
      * @throws ReflectiveOperationException If the creation of the filter fails
-     * @throws SecurityException If a security manager prevents the creation
-     * @throws IllegalArgumentException If the provided configuration is not
-     *         valid
+     * @throws SecurityException            If a security manager prevents the creation
+     * @throws IllegalArgumentException     If the provided configuration is not valid
      */
-    Filter getFilter() throws ClassCastException, ReflectiveOperationException, ServletException,
-            NamingException, IllegalArgumentException, SecurityException {
+    Filter getFilter() throws ClassCastException, ReflectiveOperationException, ServletException, NamingException,
+            IllegalArgumentException, SecurityException {
 
         // Return the existing filter instance, if any
         if (this.filter != null) {
@@ -257,8 +248,7 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable
     }
 
     private void initFilter() throws ServletException {
-        if (context instanceof StandardContext &&
-                context.getSwallowOutput()) {
+        if (context instanceof StandardContext && context.getSwallowOutput()) {
             try {
                 SystemLogHandler.startCapture();
                 filter.init(this);
@@ -284,8 +274,7 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable
     }
 
     /**
-     * Release the Filter instance associated with this FilterConfig,
-     * if there is one.
+     * Release the Filter instance associated with this FilterConfig, if there is one.
      */
     void release() {
 
@@ -304,27 +293,23 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable
                 }
             } catch (Throwable t) {
                 ExceptionUtils.handleThrowable(t);
-                context.getLogger().error(sm.getString(
-                        "applicationFilterConfig.release",
-                        filterDef.getFilterName(),
+                context.getLogger().error(sm.getString("applicationFilterConfig.release", filterDef.getFilterName(),
                         filterDef.getFilterClass()), t);
             }
             if (!context.getIgnoreAnnotations()) {
                 try {
                     context.getInstanceManager().destroyInstance(this.filter);
                 } catch (Exception e) {
-                    Throwable t = ExceptionUtils
-                            .unwrapInvocationTargetException(e);
+                    Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
                     ExceptionUtils.handleThrowable(t);
-                    context.getLogger().error(
-                            sm.getString("applicationFilterConfig.preDestroy",
-                                    filterDef.getFilterName(), filterDef.getFilterClass()), t);
+                    context.getLogger().error(sm.getString("applicationFilterConfig.preDestroy",
+                            filterDef.getFilterName(), filterDef.getFilterClass()), t);
                 }
             }
         }
         this.filter = null;
 
-     }
+    }
 
 
     // -------------------------------------------------------- Private Methods
@@ -349,20 +334,16 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable
         }
         if (context instanceof StandardContext) {
             StandardContext standardContext = (StandardContext) context;
-            onameStr = domain + ":j2eeType=Filter,WebModule=" + webMod +
-                    ",name=" + filterName + ",J2EEApplication=" +
-                    standardContext.getJ2EEApplication() + ",J2EEServer=" +
-                    standardContext.getJ2EEServer();
+            onameStr = domain + ":j2eeType=Filter,WebModule=" + webMod + ",name=" + filterName + ",J2EEApplication=" +
+                    standardContext.getJ2EEApplication() + ",J2EEServer=" + standardContext.getJ2EEServer();
         } else {
-            onameStr = domain + ":j2eeType=Filter,name=" + filterName +
-                 ",WebModule=" + webMod;
+            onameStr = domain + ":j2eeType=Filter,name=" + filterName + ",WebModule=" + webMod;
         }
         try {
             oname = new ObjectName(onameStr);
             Registry.getRegistry(null, null).registerComponent(this, oname, null);
         } catch (Exception ex) {
-            log.warn(sm.getString("applicationFilterConfig.jmxRegisterFail",
-                    getFilterClass(), getFilterName()), ex);
+            log.warn(sm.getString("applicationFilterConfig.jmxRegisterFail", getFilterClass(), getFilterName()), ex);
         }
     }
 
@@ -373,12 +354,11 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable
             try {
                 Registry.getRegistry(null, null).unregisterComponent(oname);
                 if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("applicationFilterConfig.jmxUnregister",
-                            getFilterClass(), getFilterName()));
+                    log.debug(sm.getString("applicationFilterConfig.jmxUnregister", getFilterClass(), getFilterName()));
                 }
-            } catch(Exception ex) {
-                log.warn(sm.getString("applicationFilterConfig.jmxUnregisterFail",
-                        getFilterClass(), getFilterName()), ex);
+            } catch (Exception ex) {
+                log.warn(sm.getString("applicationFilterConfig.jmxUnregisterFail", getFilterClass(), getFilterName()),
+                        ex);
             }
         }
     }
diff --git a/java/org/apache/catalina/core/ApplicationFilterFactory.java b/java/org/apache/catalina/core/ApplicationFilterFactory.java
index 3f3ddee995..daea8d7746 100644
--- a/java/org/apache/catalina/core/ApplicationFilterFactory.java
+++ b/java/org/apache/catalina/core/ApplicationFilterFactory.java
@@ -26,8 +26,7 @@ import org.apache.catalina.connector.Request;
 import org.apache.tomcat.util.descriptor.web.FilterMap;
 
 /**
- * Factory for the creation and caching of Filters and creation
- * of Filter Chains.
+ * Factory for the creation and caching of Filters and creation of Filter Chains.
  *
  * @author Greg Murray
  * @author Remy Maucherat
@@ -40,18 +39,15 @@ public final class ApplicationFilterFactory {
 
 
     /**
-     * Construct a FilterChain implementation that will wrap the execution of
-     * the specified servlet instance.
+     * Construct a FilterChain implementation that will wrap the execution of the specified servlet instance.
      *
      * @param request The servlet request we are processing
      * @param wrapper The wrapper managing the servlet instance
      * @param servlet The servlet instance to be wrapped
      *
-     * @return The configured FilterChain instance or null if none is to be
-     *         executed.
+     * @return The configured FilterChain instance or null if none is to be executed.
      */
-    public static ApplicationFilterChain createFilterChain(ServletRequest request,
-            Wrapper wrapper, Servlet servlet) {
+    public static ApplicationFilterChain createFilterChain(ServletRequest request, Wrapper wrapper, Servlet servlet) {
 
         // If there is no servlet to execute, return null
         if (servlet == null) {
@@ -90,12 +86,11 @@ public final class ApplicationFilterFactory {
         }
 
         // Acquire the information we will need to match filter mappings
-        DispatcherType dispatcher =
-                (DispatcherType) request.getAttribute(Globals.DISPATCHER_TYPE_ATTR);
+        DispatcherType dispatcher = (DispatcherType) request.getAttribute(Globals.DISPATCHER_TYPE_ATTR);
 
         String requestPath = null;
         Object attribute = request.getAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR);
-        if (attribute != null){
+        if (attribute != null) {
             requestPath = attribute.toString();
         }
 
@@ -109,8 +104,8 @@ public final class ApplicationFilterFactory {
             if (!matchFiltersURL(filterMap, requestPath)) {
                 continue;
             }
-            ApplicationFilterConfig filterConfig = (ApplicationFilterConfig)
-                    context.findFilterConfig(filterMap.getFilterName());
+            ApplicationFilterConfig filterConfig = (ApplicationFilterConfig) context
+                    .findFilterConfig(filterMap.getFilterName());
             if (filterConfig == null) {
                 // FIXME - log configuration problem
                 continue;
@@ -126,8 +121,8 @@ public final class ApplicationFilterFactory {
             if (!matchFiltersServlet(filterMap, servletName)) {
                 continue;
             }
-            ApplicationFilterConfig filterConfig = (ApplicationFilterConfig)
-                    context.findFilterConfig(filterMap.getFilterName());
+            ApplicationFilterConfig filterConfig = (ApplicationFilterConfig) context
+                    .findFilterConfig(filterMap.getFilterName());
             if (filterConfig == null) {
                 // FIXME - log configuration problem
                 continue;
@@ -144,11 +139,10 @@ public final class ApplicationFilterFactory {
 
 
     /**
-     * Return <code>true</code> if the context-relative request path
-     * matches the requirements of the specified filter mapping;
-     * otherwise, return <code>false</code>.
+     * Return <code>true</code> if the context-relative request path matches the requirements of the specified filter
+     * mapping; otherwise, return <code>false</code>.
      *
-     * @param filterMap Filter mapping being checked
+     * @param filterMap   Filter mapping being checked
      * @param requestPath Context-relative request path of this request
      */
     private static boolean matchFiltersURL(FilterMap filterMap, String requestPath) {
@@ -179,11 +173,10 @@ public final class ApplicationFilterFactory {
 
 
     /**
-     * Return <code>true</code> if the context-relative request path
-     * matches the requirements of the specified filter mapping;
-     * otherwise, return <code>false</code>.
+     * Return <code>true</code> if the context-relative request path matches the requirements of the specified filter
+     * mapping; otherwise, return <code>false</code>.
      *
-     * @param testPath URL mapping being checked
+     * @param testPath    URL mapping being checked
      * @param requestPath Context-relative request path of this request
      */
     private static boolean matchFiltersURL(String testPath, String requestPath) {
@@ -202,8 +195,7 @@ public final class ApplicationFilterFactory {
             return true;
         }
         if (testPath.endsWith("/*")) {
-            if (testPath.regionMatches(0, requestPath, 0,
-                                       testPath.length() - 2)) {
+            if (testPath.regionMatches(0, requestPath, 0, testPath.length() - 2)) {
                 if (requestPath.length() == (testPath.length() - 2)) {
                     return true;
                 } else if ('/' == requestPath.charAt(testPath.length() - 2)) {
@@ -217,12 +209,9 @@ public final class ApplicationFilterFactory {
         if (testPath.startsWith("*.")) {
             int slash = requestPath.lastIndexOf('/');
             int period = requestPath.lastIndexOf('.');
-            if ((slash >= 0) && (period > slash)
-                && (period != requestPath.length() - 1)
-                && ((requestPath.length() - period)
-                    == (testPath.length() - 1))) {
-                return testPath.regionMatches(2, requestPath, period + 1,
-                                               testPath.length() - 2);
+            if ((slash >= 0) && (period > slash) && (period != requestPath.length() - 1) &&
+                    ((requestPath.length() - period) == (testPath.length() - 1))) {
+                return testPath.regionMatches(2, requestPath, period + 1, testPath.length() - 2);
             }
         }
 
@@ -233,15 +222,13 @@ public final class ApplicationFilterFactory {
 
 
     /**
-     * Return <code>true</code> if the specified servlet name matches
-     * the requirements of the specified filter mapping; otherwise
-     * return <code>false</code>.
+     * Return <code>true</code> if the specified servlet name matches the requirements of the specified filter mapping;
+     * otherwise return <code>false</code>.
      *
-     * @param filterMap Filter mapping being checked
+     * @param filterMap   Filter mapping being checked
      * @param servletName Servlet name being checked
      */
-    private static boolean matchFiltersServlet(FilterMap filterMap,
-                                        String servletName) {
+    private static boolean matchFiltersServlet(FilterMap filterMap, String servletName) {
 
         if (servletName == null) {
             return false;
@@ -263,32 +250,32 @@ public final class ApplicationFilterFactory {
 
 
     /**
-     * Convenience method which returns true if  the dispatcher type
-     * matches the dispatcher types specified in the FilterMap
+     * Convenience method which returns true if the dispatcher type matches the dispatcher types specified in the
+     * FilterMap
      */
     private static boolean matchDispatcher(FilterMap filterMap, DispatcherType type) {
         switch (type) {
-            case FORWARD :
+            case FORWARD:
                 if ((filterMap.getDispatcherMapping() & FilterMap.FORWARD) != 0) {
                     return true;
                 }
                 break;
-            case INCLUDE :
+            case INCLUDE:
                 if ((filterMap.getDispatcherMapping() & FilterMap.INCLUDE) != 0) {
                     return true;
                 }
                 break;
-            case REQUEST :
+            case REQUEST:
                 if ((filterMap.getDispatcherMapping() & FilterMap.REQUEST) != 0) {
                     return true;
                 }
                 break;
-            case ERROR :
+            case ERROR:
                 if ((filterMap.getDispatcherMapping() & FilterMap.ERROR) != 0) {
                     return true;
                 }
                 break;
-            case ASYNC :
+            case ASYNC:
                 if ((filterMap.getDispatcherMapping() & FilterMap.ASYNC) != 0) {
                     return true;
                 }
diff --git a/java/org/apache/catalina/core/ApplicationFilterRegistration.java b/java/org/apache/catalina/core/ApplicationFilterRegistration.java
index ef8fe6020d..c1f5714385 100644
--- a/java/org/apache/catalina/core/ApplicationFilterRegistration.java
+++ b/java/org/apache/catalina/core/ApplicationFilterRegistration.java
@@ -42,16 +42,14 @@ public class ApplicationFilterRegistration implements FilterRegistration.Dynamic
     private final FilterDef filterDef;
     private final Context context;
 
-    public ApplicationFilterRegistration(FilterDef filterDef,
-            Context context) {
+    public ApplicationFilterRegistration(FilterDef filterDef, Context context) {
         this.filterDef = filterDef;
         this.context = context;
 
     }
 
     @Override
-    public void addMappingForServletNames(
-            EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
+    public void addMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
             String... servletNames) {
 
         FilterMap filterMap = new FilterMap();
@@ -79,8 +77,7 @@ public class ApplicationFilterRegistration implements FilterRegistration.Dynamic
     }
 
     @Override
-    public void addMappingForUrlPatterns(
-            EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
+    public void addMappingForUrlPatterns(EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
             String... urlPatterns) {
 
         FilterMap filterMap = new FilterMap();
@@ -140,7 +137,7 @@ public class ApplicationFilterRegistration implements FilterRegistration.Dynamic
     @Override
     public String getClassName() {
         return filterDef.getFilterClass();
-   }
+    }
 
     @Override
     public String getInitParameter(String name) {
@@ -149,7 +146,7 @@ public class ApplicationFilterRegistration implements FilterRegistration.Dynamic
 
     @Override
     public Map<String, String> getInitParameters() {
-        ParameterMap<String,String> result = new ParameterMap<>();
+        ParameterMap<String, String> result = new ParameterMap<>();
         result.putAll(filterDef.getParameterMap());
         result.setLocked(true);
         return result;
@@ -164,8 +161,7 @@ public class ApplicationFilterRegistration implements FilterRegistration.Dynamic
     public boolean setInitParameter(String name, String value) {
         if (name == null || value == null) {
             throw new IllegalArgumentException(
-                    sm.getString("applicationFilterRegistration.nullInitParam",
-                            name, value));
+                    sm.getString("applicationFilterRegistration.nullInitParam", name, value));
         }
         if (getInitParameter(name) != null) {
             return false;
@@ -183,9 +179,8 @@ public class ApplicationFilterRegistration implements FilterRegistration.Dynamic
 
         for (Map.Entry<String, String> entry : initParameters.entrySet()) {
             if (entry.getKey() == null || entry.getValue() == null) {
-                throw new IllegalArgumentException(sm.getString(
-                        "applicationFilterRegistration.nullInitParams",
-                                entry.getKey(), entry.getValue()));
+                throw new IllegalArgumentException(
+                        sm.getString("applicationFilterRegistration.nullInitParams", entry.getKey(), entry.getValue()));
             }
             if (getInitParameter(entry.getKey()) != null) {
                 conflicts.add(entry.getKey());
diff --git a/java/org/apache/catalina/core/ApplicationHttpRequest.java b/java/org/apache/catalina/core/ApplicationHttpRequest.java
index f307e3e334..95fe0cf35b 100644
--- a/java/org/apache/catalina/core/ApplicationHttpRequest.java
+++ b/java/org/apache/catalina/core/ApplicationHttpRequest.java
@@ -55,16 +55,14 @@ import org.apache.tomcat.util.res.StringManager;
 
 
 /**
- * Wrapper around a <code>javax.servlet.http.HttpServletRequest</code>
- * that transforms an application request object (which might be the original
- * one passed to a servlet, or might be based on the 2.3
- * <code>javax.servlet.http.HttpServletRequestWrapper</code> class)
- * back into an internal <code>org.apache.catalina.HttpRequest</code>.
+ * Wrapper around a <code>javax.servlet.http.HttpServletRequest</code> that transforms an application request object
+ * (which might be the original one passed to a servlet, or might be based on the 2.3
+ * <code>javax.servlet.http.HttpServletRequestWrapper</code> class) back into an internal
+ * <code>org.apache.catalina.HttpRequest</code>.
  * <p>
- * <strong>WARNING</strong>:  Due to Java's lack of support for multiple
- * inheritance, all of the logic in <code>ApplicationRequest</code> is
- * duplicated in <code>ApplicationHttpRequest</code>.  Make sure that you
- * keep these two classes in synchronization when making changes!
+ * <strong>WARNING</strong>: Due to Java's lack of support for multiple inheritance, all of the logic in
+ * <code>ApplicationRequest</code> is duplicated in <code>ApplicationHttpRequest</code>. Make sure that you keep these
+ * two classes in synchronization when making changes!
  *
  * @author Craig R. McClanahan
  * @author Remy Maucherat
@@ -76,19 +74,13 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
     /**
      * The set of attribute names that are special for request dispatchers.
      */
-    protected static final String specials[] =
-    { RequestDispatcher.INCLUDE_REQUEST_URI,
-      RequestDispatcher.INCLUDE_CONTEXT_PATH,
-      RequestDispatcher.INCLUDE_SERVLET_PATH,
-      RequestDispatcher.INCLUDE_PATH_INFO,
-      RequestDispatcher.INCLUDE_QUERY_STRING,
-      RequestDispatcher.INCLUDE_MAPPING,
-      RequestDispatcher.FORWARD_REQUEST_URI,
-      RequestDispatcher.FORWARD_CONTEXT_PATH,
-      RequestDispatcher.FORWARD_SERVLET_PATH,
-      RequestDispatcher.FORWARD_PATH_INFO,
-      RequestDispatcher.FORWARD_QUERY_STRING,
-      RequestDispatcher.FORWARD_MAPPING};
+    protected static final String specials[] = { RequestDispatcher.INCLUDE_REQUEST_URI,
+            RequestDispatcher.INCLUDE_CONTEXT_PATH, RequestDispatcher.INCLUDE_SERVLET_PATH,
+            RequestDispatcher.INCLUDE_PATH_INFO, RequestDispatcher.INCLUDE_QUERY_STRING,
+            RequestDispatcher.INCLUDE_MAPPING, RequestDispatcher.FORWARD_REQUEST_URI,
+            RequestDispatcher.FORWARD_CONTEXT_PATH, RequestDispatcher.FORWARD_SERVLET_PATH,
+            RequestDispatcher.FORWARD_PATH_INFO, RequestDispatcher.FORWARD_QUERY_STRING,
+            RequestDispatcher.FORWARD_MAPPING };
 
     private static final int SPECIALS_FIRST_FORWARD_INDEX = 6;
 
@@ -99,13 +91,11 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
     /**
      * Construct a new wrapped request around the specified servlet request.
      *
-     * @param request The servlet request being wrapped
-     * @param context The target context for the wrapped request
-     * @param crossContext {@code true} if the wrapped request will be a
-     *                     cross-context request, otherwise {@code false}
+     * @param request      The servlet request being wrapped
+     * @param context      The target context for the wrapped request
+     * @param crossContext {@code true} if the wrapped request will be a cross-context request, otherwise {@code false}
      */
-    public ApplicationHttpRequest(HttpServletRequest request, Context context,
-                                  boolean crossContext) {
+    public ApplicationHttpRequest(HttpServletRequest request, Context context, boolean crossContext) {
 
         super(request);
         this.context = context;
@@ -131,8 +121,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * If this request is cross context, since this changes session access
-     * behavior.
+     * If this request is cross context, since this changes session access behavior.
      */
     protected final boolean crossContext;
 
@@ -144,8 +133,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * The request parameters for this request.  This is initialized from the
-     * wrapped request.
+     * The request parameters for this request. This is initialized from the wrapped request.
      */
     protected Map<String, String[]> parameters = null;
 
@@ -232,7 +220,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
         if (name.equals(Globals.DISPATCHER_TYPE_ATTR)) {
             return dispatcherType;
         } else if (name.equals(Globals.DISPATCHER_REQUEST_PATH_ATTR)) {
-            if ( requestDispatcherPath != null ){
+            if (requestDispatcherPath != null) {
                 return requestDispatcherPath.toString();
             } else {
                 return null;
@@ -243,8 +231,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
         if (pos == -1) {
             return getRequest().getAttribute(name);
         } else {
-            if ((specialAttributes[pos] == null) &&
-                    (specialAttributes[SPECIALS_FIRST_FORWARD_INDEX] == null) &&
+            if ((specialAttributes[pos] == null) && (specialAttributes[SPECIALS_FIRST_FORWARD_INDEX] == null) &&
                     (pos >= SPECIALS_FIRST_FORWARD_INDEX)) {
                 // If it's a forward special attribute, and null, it means this
                 // is an include, so we check the wrapped request since
@@ -259,8 +246,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Override the <code>getAttributeNames()</code> method of the wrapped
-     * request.
+     * Override the <code>getAttributeNames()</code> method of the wrapped request.
      */
     @Override
     public Enumeration<String> getAttributeNames() {
@@ -269,8 +255,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Override the <code>removeAttribute()</code> method of the
-     * wrapped request.
+     * Override the <code>removeAttribute()</code> method of the wrapped request.
      *
      * @param name Name of the attribute to remove
      */
@@ -285,17 +270,16 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Override the <code>setAttribute()</code> method of the
-     * wrapped request.
+     * Override the <code>setAttribute()</code> method of the wrapped request.
      *
-     * @param name Name of the attribute to set
+     * @param name  Name of the attribute to set
      * @param value Value of the attribute to set
      */
     @Override
     public void setAttribute(String name, Object value) {
 
         if (name.equals(Globals.DISPATCHER_TYPE_ATTR)) {
-            dispatcherType = (DispatcherType)value;
+            dispatcherType = (DispatcherType) value;
             return;
         } else if (name.equals(Globals.DISPATCHER_REQUEST_PATH_ATTR)) {
             requestDispatcherPath = value;
@@ -310,8 +294,8 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * 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
      */
@@ -338,8 +322,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
         }
 
         // 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();
         }
@@ -358,8 +341,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
         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;
             }
@@ -378,7 +360,6 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
     /**
      * Override the getDispatcherType() method of the wrapped request.
-     *
      */
     @Override
     public DispatcherType getDispatcherType() {
@@ -390,8 +371,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Override the <code>getContextPath()</code> method of the wrapped
-     * request.
+     * Override the <code>getContextPath()</code> method of the wrapped request.
      */
     @Override
     public String getContextPath() {
@@ -417,8 +397,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Override the <code>getParameterMap()</code> method of the
-     * wrapped request.
+     * Override the <code>getParameterMap()</code> method of the wrapped request.
      */
     @Override
     public Map<String, String[]> getParameterMap() {
@@ -428,8 +407,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Override the <code>getParameterNames()</code> method of the
-     * wrapped request.
+     * Override the <code>getParameterNames()</code> method of the wrapped request.
      */
     @Override
     public Enumeration<String> getParameterNames() {
@@ -439,8 +417,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Override the <code>getParameterValues()</code> method of the
-     * wrapped request.
+     * Override the <code>getParameterValues()</code> method of the wrapped request.
      *
      * @param name Name of the requested parameter
      */
@@ -461,8 +438,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Override the <code>getPathTranslated()</code> method of the wrapped
-     * request.
+     * Override the <code>getPathTranslated()</code> method of the wrapped request.
      */
     @Override
     public String getPathTranslated() {
@@ -475,8 +451,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Override the <code>getQueryString()</code> method of the wrapped
-     * request.
+     * Override the <code>getQueryString()</code> method of the wrapped request.
      */
     @Override
     public String getQueryString() {
@@ -485,8 +460,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Override the <code>getRequestURI()</code> method of the wrapped
-     * request.
+     * Override the <code>getRequestURI()</code> method of the wrapped request.
      */
     @Override
     public String getRequestURI() {
@@ -495,8 +469,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Override the <code>getRequestURL()</code> method of the wrapped
-     * request.
+     * Override the <code>getRequestURL()</code> method of the wrapped request.
      */
     @Override
     public StringBuffer getRequestURL() {
@@ -505,8 +478,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Override the <code>getServletPath()</code> method of the wrapped
-     * request.
+     * Override the <code>getServletPath()</code> method of the wrapped request.
      */
     @Override
     public String getServletPath() {
@@ -521,8 +493,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * 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() {
@@ -531,8 +502,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * 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
      */
@@ -561,8 +531,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
             if (other != null) {
                 Session localSession = null;
                 try {
-                    localSession =
-                        context.getManager().findSession(other.getId());
+                    localSession = context.getManager().findSession(other.getId());
                     if (localSession != null && !localSession.isValid()) {
                         localSession = null;
                     }
@@ -570,8 +539,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
                     // Ignore
                 }
                 if (localSession == null && create) {
-                    localSession =
-                        context.getManager().createSession(other.getId());
+                    localSession = context.getManager().createSession(other.getId());
                 }
                 if (localSession != null) {
                     localSession.access();
@@ -589,11 +557,11 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Returns true if the request specifies a JSESSIONID that is valid within
-     * the context of this ApplicationHttpRequest, false otherwise.
+     * Returns true if the request specifies a JSESSIONID that is valid within the context of this
+     * ApplicationHttpRequest, false otherwise.
      *
-     * @return true if the request specifies a JSESSIONID that is valid within
-     * the context of this ApplicationHttpRequest, false otherwise.
+     * @return true if the request specifies a JSESSIONID that is valid within the context of this
+     *             ApplicationHttpRequest, false otherwise.
      */
     @Override
     public boolean isRequestedSessionIdValid() {
@@ -701,9 +669,8 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
         super.setRequest(request);
 
         // Initialize the attributes for this request
-        dispatcherType = (DispatcherType)request.getAttribute(Globals.DISPATCHER_TYPE_ATTR);
-        requestDispatcherPath =
-            request.getAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR);
+        dispatcherType = (DispatcherType) request.getAttribute(Globals.DISPATCHER_TYPE_ATTR);
+        requestDispatcherPath = request.getAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR);
 
         // Initialize the path elements for this request
         contextPath = request.getContextPath();
@@ -740,9 +707,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Parses the parameters of this request.
-     *
-     * If parameters are present in both the query string and the request
+     * Parses the parameters of this request. If parameters are present in both the query string and the request
      * content, they are merged.
      */
     void parseParameters() {
@@ -754,7 +719,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
         parameters = new ParameterMap<>();
         parameters.putAll(getRequest().getParameterMap());
         mergeParameters();
-        ((ParameterMap<String,String[]>) parameters).setLocked(true);
+        ((ParameterMap<String, String[]>) parameters).setLocked(true);
         parsedParams = true;
     }
 
@@ -762,8 +727,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
     /**
      * Save query parameters for this request.
      *
-     * @param queryString The query string containing parameters for this
-     *                    request
+     * @param queryString The query string containing parameters for this request
      */
     void setQueryParams(String queryString) {
         this.queryParamString = queryString;
@@ -778,8 +742,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
     // ------------------------------------------------------ Protected Methods
 
     /**
-     * Is this attribute name one of the special ones that is added only for
-     * included servlets?
+     * Is this attribute name one of the special ones that is added only for included servlets?
      *
      * @param name Attribute name to be tested
      */
@@ -798,8 +761,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
     /**
      * Get a special attribute.
      *
-     * @return the special attribute pos, or -1 if it is not a special
-     *         attribute
+     * @return the special attribute pos, or -1 if it is not a special attribute
      */
     protected int getSpecial(String name) {
         for (int i = 0; i < specials.length; i++) {
@@ -873,10 +835,9 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Merge the parameters from the saved query parameter string (if any), and
-     * the parameters already present on this request (if any), such that the
-     * parameter values from the query string show up first if there are
-     * duplicate parameter names.
+     * Merge the parameters from the saved query parameter string (if any), and the parameters already present on this
+     * request (if any), such that the parameter values from the query string show up first if there are duplicate
+     * parameter names.
      */
     private void mergeParameters() {
 
@@ -930,8 +891,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
 
     /**
-     * Utility class used to expose the special attributes as being available
-     * as request attributes.
+     * Utility class used to expose the special attributes as being available as request attributes.
      */
     protected class AttributeNamesEnumerator implements Enumeration<String> {
 
@@ -954,8 +914,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
 
         @Override
         public boolean hasMoreElements() {
-            return ((pos != last) || (next != null)
-                    || ((next = findNext()) != null));
+            return ((pos != last) || (next != null) || ((next = findNext()) != null));
         }
 
         @Override
diff --git a/java/org/apache/catalina/core/ApplicationHttpResponse.java b/java/org/apache/catalina/core/ApplicationHttpResponse.java
index 9760a610b8..9c96239191 100644
--- a/java/org/apache/catalina/core/ApplicationHttpResponse.java
+++ b/java/org/apache/catalina/core/ApplicationHttpResponse.java
@@ -25,16 +25,14 @@ import javax.servlet.http.HttpServletResponseWrapper;
 
 
 /**
- * Wrapper around a <code>javax.servlet.http.HttpServletResponse</code>
- * that transforms an application response object (which might be the original
- * one passed to a servlet, or might be based on the 2.3
- * <code>javax.servlet.http.HttpServletResponseWrapper</code> class)
- * back into an internal <code>org.apache.catalina.HttpResponse</code>.
+ * Wrapper around a <code>javax.servlet.http.HttpServletResponse</code> that transforms an application response object
+ * (which might be the original one passed to a servlet, or might be based on the 2.3
+ * <code>javax.servlet.http.HttpServletResponseWrapper</code> class) back into an internal
+ * <code>org.apache.catalina.HttpResponse</code>.
  * <p>
- * <strong>WARNING</strong>:  Due to Java's lack of support for multiple
- * inheritance, all of the logic in <code>ApplicationResponse</code> is
- * duplicated in <code>ApplicationHttpResponse</code>.  Make sure that you
- * keep these two classes in synchronization when making changes!
+ * <strong>WARNING</strong>: Due to Java's lack of support for multiple inheritance, all of the logic in
+ * <code>ApplicationResponse</code> is duplicated in <code>ApplicationHttpResponse</code>. Make sure that you keep these
+ * two classes in synchronization when making changes!
  *
  * @author Craig R. McClanahan
  */
@@ -46,11 +44,10 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
      * Construct a new wrapped response around the specified servlet response.
      *
      * @param response The servlet response being wrapped
-     * @param included <code>true</code> if this response is being processed
-     *  by a <code>RequestDispatcher.include()</code> call
+     * @param included <code>true</code> if this response is being processed by a
+     *                     <code>RequestDispatcher.include()</code> call
      */
-    public ApplicationHttpResponse(HttpServletResponse response,
-                                   boolean included) {
+    public ApplicationHttpResponse(HttpServletResponse response, boolean included) {
 
         super(response);
         setIncluded(included);
@@ -62,8 +59,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
 
 
     /**
-     * Is this wrapped response the subject of an <code>include()</code>
-     * call?
+     * Is this wrapped response the subject of an <code>include()</code> call?
      */
     protected boolean included = false;
 
@@ -73,8 +69,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
     /**
      * Disallow <code>reset()</code> calls on a included response.
      *
-     * @exception IllegalStateException if the response has already
-     *  been committed
+     * @exception IllegalStateException if the response has already been committed
      */
     @Override
     public void reset() {
@@ -88,8 +83,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
 
 
     /**
-     * Disallow <code>setContentLength(int)</code> calls on an included
-     * response.
+     * Disallow <code>setContentLength(int)</code> calls on an included response.
      *
      * @param len The new content length
      */
@@ -104,8 +98,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
 
 
     /**
-     * Disallow <code>setContentLengthLong(long)</code> calls on an included
-     * response.
+     * Disallow <code>setContentLengthLong(long)</code> calls on an included response.
      *
      * @param len The new content length
      */
@@ -183,7 +176,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
     /**
      * Disallow <code>addDateHeader()</code> calls on an included response.
      *
-     * @param name The new header name
+     * @param name  The new header name
      * @param value The new header value
      */
     @Override
@@ -199,7 +192,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
     /**
      * Disallow <code>addHeader()</code> calls on an included response.
      *
-     * @param name The new header name
+     * @param name  The new header name
      * @param value The new header value
      */
     @Override
@@ -215,7 +208,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
     /**
      * Disallow <code>addIntHeader()</code> calls on an included response.
      *
-     * @param name The new header name
+     * @param name  The new header name
      * @param value The new header value
      */
     @Override
@@ -248,7 +241,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
     /**
      * Disallow <code>sendError()</code> calls on an included response.
      *
-     * @param sc The new status code
+     * @param sc  The new status code
      * @param msg The new message
      *
      * @exception IOException if an input/output error occurs
@@ -283,7 +276,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
     /**
      * Disallow <code>setDateHeader()</code> calls on an included response.
      *
-     * @param name The new header name
+     * @param name  The new header name
      * @param value The new header value
      */
     @Override
@@ -299,7 +292,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
     /**
      * Disallow <code>setHeader()</code> calls on an included response.
      *
-     * @param name The new header name
+     * @param name  The new header name
      * @param value The new header value
      */
     @Override
@@ -315,7 +308,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
     /**
      * Disallow <code>setIntHeader()</code> calls on an included response.
      *
-     * @param name The new header name
+     * @param name  The new header name
      * @param value The new header value
      */
     @Override
@@ -346,12 +339,12 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
     /**
      * Disallow <code>setStatus()</code> calls on an included response.
      *
-     * @param sc The new status code
+     * @param sc  The new status code
      * @param msg The new message
-     * @deprecated As of version 2.1, due to ambiguous meaning of the message
-     *             parameter. To set a status code use
-     *             <code>setStatus(int)</code>, to send an error with a
-     *             description use <code>sendError(int, String)</code>.
+     *
+     * @deprecated As of version 2.1, due to ambiguous meaning of the message parameter. To set a status code use
+     *                 <code>setStatus(int)</code>, to send an error with a description use
+     *                 <code>sendError(int, String)</code>.
      */
     @Deprecated
     @Override
diff --git a/java/org/apache/catalina/core/ApplicationMapping.java b/java/org/apache/catalina/core/ApplicationMapping.java
index c6e4f0fedb..8f4d429fd4 100644
--- a/java/org/apache/catalina/core/ApplicationMapping.java
+++ b/java/org/apache/catalina/core/ApplicationMapping.java
@@ -56,8 +56,8 @@ public class ApplicationMapping {
                     case EXTENSION:
                         String path = mappingData.wrapperPath.toString();
                         int extIndex = path.lastIndexOf('.');
-                        mapping = new MappingImpl(path.substring(1, extIndex),
-                                "*" + path.substring(extIndex), mappingData.matchType, servletName);
+                        mapping = new MappingImpl(path.substring(1, extIndex), "*" + path.substring(extIndex),
+                                mappingData.matchType, servletName);
                         break;
                     case PATH:
                         String matchValue;
@@ -87,8 +87,7 @@ public class ApplicationMapping {
         private final MappingMatch mappingType;
         private final String servletName;
 
-        public MappingImpl(String matchValue, String pattern, MappingMatch mappingType,
-                String servletName) {
+        public MappingImpl(String matchValue, String pattern, MappingMatch mappingType, String servletName) {
             this.matchValue = matchValue;
             this.pattern = pattern;
             this.mappingType = mappingType;
diff --git a/java/org/apache/catalina/core/ApplicationPart.java b/java/org/apache/catalina/core/ApplicationPart.java
index 5c6cc0c3ae..b4a16646d8 100644
--- a/java/org/apache/catalina/core/ApplicationPart.java
+++ b/java/org/apache/catalina/core/ApplicationPart.java
@@ -35,9 +35,8 @@ import org.apache.tomcat.util.http.fileupload.disk.DiskFileItem;
 import org.apache.tomcat.util.http.parser.HttpParser;
 
 /**
- * Adaptor to allow {@link FileItem} objects generated by the package renamed
- * commons-upload to be used by the Servlet 3.0 upload API that expects
- * {@link Part}s.
+ * Adaptor to allow {@link FileItem} objects generated by the package renamed commons-upload to be used by the Servlet
+ * 3.0 upload API that expects {@link Part}s.
  */
 public class ApplicationPart implements Part {
 
@@ -71,8 +70,7 @@ public class ApplicationPart implements Part {
     public Collection<String> getHeaderNames() {
         if (fileItem instanceof DiskFileItem) {
             LinkedHashSet<String> headerNames = new LinkedHashSet<>();
-            Iterator<String> iter =
-                fileItem.getHeaders().getHeaderNames();
+            Iterator<String> iter = fileItem.getHeaders().getHeaderNames();
             while (iter.hasNext()) {
                 headerNames.add(iter.next());
             }
@@ -85,8 +83,7 @@ public class ApplicationPart implements Part {
     public Collection<String> getHeaders(String name) {
         if (fileItem instanceof DiskFileItem) {
             LinkedHashSet<String> headers = new LinkedHashSet<>();
-            Iterator<String> iter =
-                fileItem.getHeaders().getHeaders(name);
+            Iterator<String> iter = fileItem.getHeaders().getHeaders(name);
             while (iter.hasNext()) {
                 headers.add(iter.next());
             }
@@ -140,7 +137,7 @@ public class ApplicationPart implements Part {
                 ParameterParser paramParser = new ParameterParser();
                 paramParser.setLowerCaseNames(true);
                 // Parameter parser can handle null input
-                Map<String,String> params = paramParser.parse(cd, ';');
+                Map<String, String> params = paramParser.parse(cd, ';');
                 if (params.containsKey("filename")) {
                     fileName = params.get("filename");
                     // The parser will remove surrounding '"' but will not
diff --git a/java/org/apache/catalina/core/ApplicationPushBuilder.java b/java/org/apache/catalina/core/ApplicationPushBuilder.java
index f910957eef..5f1d33da7c 100644
--- a/java/org/apache/catalina/core/ApplicationPushBuilder.java
+++ b/java/org/apache/catalina/core/ApplicationPushBuilder.java
@@ -67,7 +67,7 @@ public class ApplicationPushBuilder implements PushBuilder {
     private final boolean addSessionCookie;
     private final boolean addSessionPathParameter;
 
-    private final Map<String,List<String>> headers = new CaseInsensitiveKeyMap<>();
+    private final Map<String, List<String>> headers = new CaseInsensitiveKeyMap<>();
     private final List<Cookie> cookies = new ArrayList<>();
     private String method = "GET";
     private String path;
@@ -127,10 +127,9 @@ public class ApplicationPushBuilder implements PushBuilder {
         if (sessionId == null) {
             sessionId = request.getRequestedSessionId();
         }
-        if (!request.isRequestedSessionIdFromCookie() && !request.isRequestedSessionIdFromURL() &&
-                sessionId != null) {
-            Set<SessionTrackingMode> sessionTrackingModes =
-                    request.getServletContext().getEffectiveSessionTrackingModes();
+        if (!request.isRequestedSessionIdFromCookie() && !request.isRequestedSessionIdFromURL() && sessionId != null) {
+            Set<SessionTrackingMode> sessionTrackingModes = request.getServletContext()
+                    .getEffectiveSessionTrackingModes();
             addSessionCookie = sessionTrackingModes.contains(SessionTrackingMode.COOKIE);
             addSessionPathParameter = sessionTrackingModes.contains(SessionTrackingMode.URL);
         } else {
@@ -153,16 +152,15 @@ public class ApplicationPushBuilder implements PushBuilder {
         }
         if (cookies.size() > 0) {
             List<String> cookieValues = new ArrayList<>(1);
-            cookieValues.add(generateCookieHeader(cookies,
-                    catalinaRequest.getContext().getCookieProcessor()));
+            cookieValues.add(generateCookieHeader(cookies, catalinaRequest.getContext().getCookieProcessor()));
             headers.put("cookie", cookieValues);
         }
 
         // Authentication
         if (catalinaRequest.getPrincipal() != null) {
-            if ((session == null) || catalinaRequest.getSessionInternal(false).getPrincipal() == null
-                    || !(context.getAuthenticator() instanceof AuthenticatorBase)
-                    || !((AuthenticatorBase) context.getAuthenticator()).getCache()) {
+            if ((session == null) || catalinaRequest.getSessionInternal(false).getPrincipal() == null ||
+                    !(context.getAuthenticator() instanceof AuthenticatorBase) ||
+                    !((AuthenticatorBase) context.getAuthenticator()).getCache()) {
                 // Set a username only if there is no session cache for the principal
                 userName = catalinaRequest.getPrincipal().getName();
             }
@@ -197,8 +195,7 @@ public class ApplicationPushBuilder implements PushBuilder {
     public PushBuilder method(String method) {
         String upperMethod = method.trim().toUpperCase(Locale.ENGLISH);
         if (DISALLOWED_METHODS.contains(upperMethod) || upperMethod.length() == 0) {
-            throw new IllegalArgumentException(
-                    sm.getString("applicationPushBuilder.methodInvalid", upperMethod));
+            throw new IllegalArgumentException(sm.getString("applicationPushBuilder.methodInvalid", upperMethod));
         }
         // Check a token was supplied
         if (!HttpParser.isToken(upperMethod)) {
@@ -303,7 +300,7 @@ public class ApplicationPushBuilder implements PushBuilder {
         pushTarget.scheme().setString(baseRequest.getScheme());
 
         // Copy headers
-        for (Map.Entry<String,List<String>> header : headers.entrySet()) {
+        for (Map.Entry<String, List<String>> header : headers.entrySet()) {
             for (String value : header.getValue()) {
                 pushTarget.getMimeHeaders().addValue(header.getKey()).setString(value);
             }
@@ -342,8 +339,7 @@ public class ApplicationPushBuilder implements PushBuilder {
 
         // Undecoded path - just %nn encoded
         pushTarget.requestURI().setString(pushPath);
-        pushTarget.decodedURI().setString(decode(pushPath,
-                catalinaRequest.getConnector().getURICharset()));
+        pushTarget.decodedURI().setString(decode(pushPath, catalinaRequest.getConnector().getURICharset()));
 
         // Query string
         if (pushQueryString == null && queryString != null) {
@@ -351,7 +347,7 @@ public class ApplicationPushBuilder implements PushBuilder {
         } else if (pushQueryString != null && queryString == null) {
             pushTarget.queryString().setString(pushQueryString);
         } else if (pushQueryString != null && queryString != null) {
-            pushTarget.queryString().setString(pushQueryString + "&" +queryString);
+            pushTarget.queryString().setString(pushQueryString + "&" + queryString);
         }
 
         // Authorization
@@ -386,7 +382,7 @@ public class ApplicationPushBuilder implements PushBuilder {
             result.append(input.substring(end, start));
             // Advance the end 3 characters: %nn
             end = start + 3;
-            while (end <input.length() && input.charAt(end) == '%') {
+            while (end < input.length() && input.charAt(end) == '%') {
                 end += 3;
             }
             result.append(decodePercentSequence(input.substring(start, end), charset));
@@ -400,7 +396,7 @@ public class ApplicationPushBuilder implements PushBuilder {
 
 
     private static String decodePercentSequence(String sequence, Charset charset) {
-        byte[] bytes = new byte[sequence.length()/3];
+        byte[] bytes = new byte[sequence.length() / 3];
         for (int i = 0; i < bytes.length; i += 3) {
             bytes[i] = (byte) ((HexUtils.getDec(sequence.charAt(1 + 3 * i)) << 4) +
                     HexUtils.getDec(sequence.charAt(2 + 3 * i)));
diff --git a/java/org/apache/catalina/core/ApplicationRequest.java b/java/org/apache/catalina/core/ApplicationRequest.java
index 4a91ae74fa..120e22d3f1 100644
--- a/java/org/apache/catalina/core/ApplicationRequest.java
+++ b/java/org/apache/catalina/core/ApplicationRequest.java
@@ -27,16 +27,14 @@ import javax.servlet.ServletRequestWrapper;
 
 
 /**
- * Wrapper around a <code>javax.servlet.ServletRequest</code>
- * that transforms an application request object (which might be the original
- * one passed to a servlet, or might be based on the 2.3
- * <code>javax.servlet.ServletRequestWrapper</code> class)
- * back into an internal <code>org.apache.catalina.Request</code>.
+ * Wrapper around a <code>javax.servlet.ServletRequest</code> that transforms an application request object (which might
+ * be the original one passed to a servlet, or might be based on the 2.3
+ * <code>javax.servlet.ServletRequestWrapper</code> class) back into an internal
+ * <code>org.apache.catalina.Request</code>.
  * <p>
- * <strong>WARNING</strong>:  Due to Java's lack of support for multiple
- * inheritance, all of the logic in <code>ApplicationRequest</code> is
- * duplicated in <code>ApplicationHttpRequest</code>.  Make sure that you
- * keep these two classes in synchronization when making changes!
+ * <strong>WARNING</strong>: Due to Java's lack of support for multiple inheritance, all of the logic in
+ * <code>ApplicationRequest</code> is duplicated in <code>ApplicationHttpRequest</code>. Make sure that you keep these
+ * two classes in synchronization when making changes!
  *
  * @author Craig R. McClanahan
  */
@@ -49,19 +47,13 @@ class ApplicationRequest extends ServletRequestWrapper {
     /**
      * The set of attribute names that are special for request dispatchers.
      */
-    protected static final String specials[] =
-    { RequestDispatcher.INCLUDE_REQUEST_URI,
-      RequestDispatcher.INCLUDE_CONTEXT_PATH,
-      RequestDispatcher.INCLUDE_SERVLET_PATH,
-      RequestDispatcher.INCLUDE_PATH_INFO,
-      RequestDispatcher.INCLUDE_QUERY_STRING,
-      RequestDispatcher.INCLUDE_MAPPING,
-      RequestDispatcher.FORWARD_REQUEST_URI,
-      RequestDispatcher.FORWARD_CONTEXT_PATH,
-      RequestDispatcher.FORWARD_SERVLET_PATH,
-      RequestDispatcher.FORWARD_PATH_INFO,
-      RequestDispatcher.FORWARD_QUERY_STRING,
-      RequestDispatcher.FORWARD_MAPPING};
+    protected static final String specials[] = { RequestDispatcher.INCLUDE_REQUEST_URI,
+            RequestDispatcher.INCLUDE_CONTEXT_PATH, RequestDispatcher.INCLUDE_SERVLET_PATH,
+            RequestDispatcher.INCLUDE_PATH_INFO, RequestDispatcher.INCLUDE_QUERY_STRING,
+            RequestDispatcher.INCLUDE_MAPPING, RequestDispatcher.FORWARD_REQUEST_URI,
+            RequestDispatcher.FORWARD_CONTEXT_PATH, RequestDispatcher.FORWARD_SERVLET_PATH,
+            RequestDispatcher.FORWARD_PATH_INFO, RequestDispatcher.FORWARD_QUERY_STRING,
+            RequestDispatcher.FORWARD_MAPPING };
 
 
     // ----------------------------------------------------------- Constructors
@@ -84,8 +76,7 @@ class ApplicationRequest extends ServletRequestWrapper {
 
 
     /**
-     * The request attributes for this request.  This is initialized from the
-     * wrapped request, but updates are allowed.
+     * The request attributes for this request. This is initialized from the wrapped request, but updates are allowed.
      */
     protected final HashMap<String, Object> attributes = new HashMap<>();
 
@@ -109,8 +100,7 @@ class ApplicationRequest extends ServletRequestWrapper {
 
 
     /**
-     * Override the <code>getAttributeNames()</code> method of the wrapped
-     * request.
+     * Override the <code>getAttributeNames()</code> method of the wrapped request.
      */
     @Override
     public Enumeration<String> getAttributeNames() {
@@ -123,8 +113,7 @@ class ApplicationRequest extends ServletRequestWrapper {
 
 
     /**
-     * Override the <code>removeAttribute()</code> method of the
-     * wrapped request.
+     * Override the <code>removeAttribute()</code> method of the wrapped request.
      *
      * @param name Name of the attribute to remove
      */
@@ -142,10 +131,9 @@ class ApplicationRequest extends ServletRequestWrapper {
 
 
     /**
-     * Override the <code>setAttribute()</code> method of the
-     * wrapped request.
+     * Override the <code>setAttribute()</code> method of the wrapped request.
      *
-     * @param name Name of the attribute to set
+     * @param name  Name of the attribute to set
      * @param value Value of the attribute to set
      */
     @Override
@@ -192,8 +180,7 @@ class ApplicationRequest extends ServletRequestWrapper {
 
 
     /**
-     * Is this attribute name one of the special ones that is added only for
-     * included servlets?
+     * Is this attribute name one of the special ones that is added only for included servlets?
      *
      * @param name Attribute name to be tested
      */
diff --git a/java/org/apache/catalina/core/ApplicationResponse.java b/java/org/apache/catalina/core/ApplicationResponse.java
index 66cc170720..21e2d0c1db 100644
--- a/java/org/apache/catalina/core/ApplicationResponse.java
+++ b/java/org/apache/catalina/core/ApplicationResponse.java
@@ -23,16 +23,14 @@ import javax.servlet.ServletResponseWrapper;
 
 
 /**
- * Wrapper around a <code>javax.servlet.ServletResponse</code>
- * that transforms an application response object (which might be the original
- * one passed to a servlet, or might be based on the 2.3
- * <code>javax.servlet.ServletResponseWrapper</code> class)
- * back into an internal <code>org.apache.catalina.Response</code>.
+ * Wrapper around a <code>javax.servlet.ServletResponse</code> that transforms an application response object (which
+ * might be the original one passed to a servlet, or might be based on the 2.3
+ * <code>javax.servlet.ServletResponseWrapper</code> class) back into an internal
+ * <code>org.apache.catalina.Response</code>.
  * <p>
- * <strong>WARNING</strong>:  Due to Java's lack of support for multiple
- * inheritance, all of the logic in <code>ApplicationResponse</code> is
- * duplicated in <code>ApplicationHttpResponse</code>.  Make sure that you
- * keep these two classes in synchronization when making changes!
+ * <strong>WARNING</strong>: Due to Java's lack of support for multiple inheritance, all of the logic in
+ * <code>ApplicationResponse</code> is duplicated in <code>ApplicationHttpResponse</code>. Make sure that you keep these
+ * two classes in synchronization when making changes!
  *
  * @author Craig R. McClanahan
  */
@@ -44,8 +42,8 @@ class ApplicationResponse extends ServletResponseWrapper {
      * Construct a new wrapped response around the specified servlet response.
      *
      * @param response The servlet response being wrapped
-     * @param included <code>true</code> if this response is being processed
-     *  by a <code>RequestDispatcher.include()</code> call
+     * @param included <code>true</code> if this response is being processed by a
+     *                     <code>RequestDispatcher.include()</code> call
      */
     public ApplicationResponse(ServletResponse response, boolean included) {
 
@@ -59,8 +57,7 @@ class ApplicationResponse extends ServletResponseWrapper {
 
 
     /**
-     * Is this wrapped response the subject of an <code>include()</code>
-     * call?
+     * Is this wrapped response the subject of an <code>include()</code> call?
      */
     protected boolean included = false;
 
@@ -71,8 +68,7 @@ class ApplicationResponse extends ServletResponseWrapper {
     /**
      * Disallow <code>reset()</code> calls on a included response.
      *
-     * @exception IllegalStateException if the response has already
-     *  been committed
+     * @exception IllegalStateException if the response has already been committed
      */
     @Override
     public void reset() {
@@ -86,8 +82,7 @@ class ApplicationResponse extends ServletResponseWrapper {
 
 
     /**
-     * Disallow <code>setContentLength(int)</code> calls on an included
-     * response.
+     * Disallow <code>setContentLength(int)</code> calls on an included response.
      *
      * @param len The new content length
      */
@@ -102,8 +97,7 @@ class ApplicationResponse extends ServletResponseWrapper {
 
 
     /**
-     * Disallow <code>setContentLengthLong(long)</code> calls on an included
-     * response.
+     * Disallow <code>setContentLengthLong(long)</code> calls on an included response.
      *
      * @param len The new content length
      */
diff --git a/java/org/apache/catalina/core/ApplicationServletRegistration.java b/java/org/apache/catalina/core/ApplicationServletRegistration.java
index c4d2c02c4d..9a0d3c96e7 100644
--- a/java/org/apache/catalina/core/ApplicationServletRegistration.java
+++ b/java/org/apache/catalina/core/ApplicationServletRegistration.java
@@ -45,8 +45,7 @@ public class ApplicationServletRegistration implements ServletRegistration.Dynam
     private final Context context;
     private ServletSecurityElement constraint;
 
-    public ApplicationServletRegistration(Wrapper wrapper,
-            Context context) {
+    public ApplicationServletRegistration(Wrapper wrapper, Context context) {
         this.wrapper = wrapper;
         this.context = context;
 
@@ -64,7 +63,7 @@ public class ApplicationServletRegistration implements ServletRegistration.Dynam
 
     @Override
     public Map<String, String> getInitParameters() {
-        ParameterMap<String,String> result = new ParameterMap<>();
+        ParameterMap<String, String> result = new ParameterMap<>();
 
         String[] parameterNames = wrapper.findInitParameters();
 
@@ -85,8 +84,7 @@ public class ApplicationServletRegistration implements ServletRegistration.Dynam
     public boolean setInitParameter(String name, String value) {
         if (name == null || value == null) {
             throw new IllegalArgumentException(
-                    sm.getString("applicationFilterRegistration.nullInitParam",
-                            name, value));
+                    sm.getString("applicationFilterRegistration.nullInitParam", name, value));
         }
         if (getInitParameter(name) != null) {
             return false;
@@ -104,9 +102,8 @@ public class ApplicationServletRegistration implements ServletRegistration.Dynam
 
         for (Map.Entry<String, String> entry : initParameters.entrySet()) {
             if (entry.getKey() == null || entry.getValue() == null) {
-                throw new IllegalArgumentException(sm.getString(
-                        "applicationFilterRegistration.nullInitParams",
-                                entry.getKey(), entry.getValue()));
+                throw new IllegalArgumentException(
+                        sm.getString("applicationFilterRegistration.nullInitParams", entry.getKey(), entry.getValue()));
             }
             if (getInitParameter(entry.getKey()) != null) {
                 conflicts.add(entry.getKey());
@@ -147,14 +144,12 @@ public class ApplicationServletRegistration implements ServletRegistration.Dynam
     @Override
     public Set<String> setServletSecurity(ServletSecurityElement constraint) {
         if (constraint == null) {
-            throw new IllegalArgumentException(sm.getString(
-                    "applicationServletRegistration.setServletSecurity.iae",
+            throw new IllegalArgumentException(sm.getString("applicationServletRegistration.setServletSecurity.iae",
                     getName(), context.getName()));
         }
 
         if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
-            throw new IllegalStateException(sm.getString(
-                    "applicationServletRegistration.setServletSecurity.ise",
+            throw new IllegalStateException(sm.getString("applicationServletRegistration.setServletSecurity.ise",
                     getName(), context.getName()));
         }
 
@@ -190,8 +185,7 @@ public class ApplicationServletRegistration implements ServletRegistration.Dynam
         }
 
         for (String urlPattern : urlPatterns) {
-            context.addServletMappingDecoded(
-                    UDecoder.URLDecode(urlPattern, StandardCharsets.UTF_8), wrapper.getName());
+            context.addServletMappingDecoded(UDecoder.URLDecode(urlPattern, StandardCharsets.UTF_8), wrapper.getName());
         }
 
         if (constraint != null) {
diff --git a/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java b/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java
index 35a316ad16..29b48c5f78 100644
--- a/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java
+++ b/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java
@@ -82,9 +82,8 @@ public class ApplicationSessionCookieConfig implements SessionCookieConfig {
     @Override
     public void setComment(String comment) {
         if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
-            throw new IllegalStateException(sm.getString(
-                    "applicationSessionCookieConfig.ise", "comment",
-                    context.getPath()));
+            throw new IllegalStateException(
+                    sm.getString("applicationSessionCookieConfig.ise", "comment", context.getPath()));
         }
         this.comment = comment;
     }
@@ -92,9 +91,8 @@ public class ApplicationSessionCookieConfig implements SessionCookieConfig {
     @Override
     public void setDomain(String domain) {
         if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
-            throw new IllegalStateException(sm.getString(
-                    "applicationSessionCookieConfig.ise", "domain name",
-                    context.getPath()));
+            throw new IllegalStateException(
+                    sm.getString("applicationSessionCookieConfig.ise", "domain name", context.getPath()));
         }
         this.domain = domain;
     }
@@ -102,9 +100,8 @@ public class ApplicationSessionCookieConfig implements SessionCookieConfig {
     @Override
     public void setHttpOnly(boolean httpOnly) {
         if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
-            throw new IllegalStateException(sm.getString(
-                    "applicationSessionCookieConfig.ise", "HttpOnly",
-                    context.getPath()));
+            throw new IllegalStateException(
+                    sm.getString("applicationSessionCookieConfig.ise", "HttpOnly", context.getPath()));
         }
         this.httpOnly = httpOnly;
     }
@@ -112,9 +109,8 @@ public class ApplicationSessionCookieConfig implements SessionCookieConfig {
     @Override
     public void setMaxAge(int maxAge) {
         if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
-            throw new IllegalStateException(sm.getString(
-                    "applicationSessionCookieConfig.ise", "max age",
-                    context.getPath()));
+            throw new IllegalStateException(
+                    sm.getString("applicationSessionCookieConfig.ise", "max age", context.getPath()));
         }
         this.maxAge = maxAge;
     }
@@ -122,9 +118,8 @@ public class ApplicationSessionCookieConfig implements SessionCookieConfig {
     @Override
     public void setName(String name) {
         if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
-            throw new IllegalStateException(sm.getString(
-                    "applicationSessionCookieConfig.ise", "name",
-                    context.getPath()));
+            throw new IllegalStateException(
+                    sm.getString("applicationSessionCookieConfig.ise", "name", context.getPath()));
         }
         this.name = name;
     }
@@ -132,9 +127,8 @@ public class ApplicationSessionCookieConfig implements SessionCookieConfig {
     @Override
     public void setPath(String path) {
         if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
-            throw new IllegalStateException(sm.getString(
-                    "applicationSessionCookieConfig.ise", "path",
-                    context.getPath()));
+            throw new IllegalStateException(
+                    sm.getString("applicationSessionCookieConfig.ise", "path", context.getPath()));
         }
         this.path = path;
     }
@@ -142,9 +136,8 @@ public class ApplicationSessionCookieConfig implements SessionCookieConfig {
     @Override
     public void setSecure(boolean secure) {
         if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
-            throw new IllegalStateException(sm.getString(
-                    "applicationSessionCookieConfig.ise", "secure",
-                    context.getPath()));
+            throw new IllegalStateException(
+                    sm.getString("applicationSessionCookieConfig.ise", "secure", context.getPath()));
         }
         this.secure = secure;
     }
@@ -152,25 +145,22 @@ public class ApplicationSessionCookieConfig implements SessionCookieConfig {
     /**
      * Creates a new session cookie for the given session ID
      *
-     * @param context     The Context for the web application
-     * @param sessionId   The ID of the session for which the cookie will be
-     *                    created
-     * @param secure      Should session cookie be configured as secure
+     * @param context   The Context for the web application
+     * @param sessionId The ID of the session for which the cookie will be created
+     * @param secure    Should session cookie be configured as secure
+     *
      * @return the cookie for the session
      */
-    public static Cookie createSessionCookie(Context context,
-            String sessionId, boolean secure) {
+    public static Cookie createSessionCookie(Context context, String sessionId, boolean secure) {
 
-        SessionCookieConfig scc =
-            context.getServletContext().getSessionCookieConfig();
+        SessionCookieConfig scc = context.getServletContext().getSessionCookieConfig();
 
         // NOTE: The priority order for session cookie configuration is:
-        //       1. Context level configuration
-        //       2. Values from SessionCookieConfig
-        //       3. Defaults
+        // 1. Context level configuration
+        // 2. Values from SessionCookieConfig
+        // 3. Defaults
 
-        Cookie cookie = new Cookie(
-                SessionConfig.getSessionCookieName(context), sessionId);
+        Cookie cookie = new Cookie(SessionConfig.getSessionCookieName(context), sessionId);
 
         // Just apply the defaults.
         cookie.setMaxAge(scc.getMaxAge());
diff --git a/java/org/apache/catalina/core/AprLifecycleListener.java b/java/org/apache/catalina/core/AprLifecycleListener.java
index af126ea24e..0771d89e8f 100644
--- a/java/org/apache/catalina/core/AprLifecycleListener.java
+++ b/java/org/apache/catalina/core/AprLifecycleListener.java
@@ -34,16 +34,13 @@ import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * Implementation of <code>LifecycleListener</code> that will init and
- * and destroy APR.
+ * Implementation of <code>LifecycleListener</code> that will init and and destroy APR.
  * <p>
  * This listener must only be nested within {@link Server} elements.
  * <p>
- * <strong>Note</strong>: If you are running Tomcat in an embedded fashion and
- * have more than one Server instance per JVM, this listener <em>must not</em>
- * be added to the {@code Server} instances, but handled outside by the calling
- * code which is bootstrapping the embedded Tomcat instances. Not doing so will
- * lead to JVM crashes.
+ * <strong>Note</strong>: If you are running Tomcat in an embedded fashion and have more than one Server instance per
+ * JVM, this listener <em>must not</em> be added to the {@code Server} instances, but handled outside by the calling
+ * code which is bootstrapping the embedded Tomcat instances. Not doing so will lead to JVM crashes.
  *
  * @since 4.1
  */
@@ -52,9 +49,8 @@ public class AprLifecycleListener implements LifecycleListener {
     private static final Log log = LogFactory.getLog(AprLifecycleListener.class);
 
     /**
-     * Info messages during init() are cached until Lifecycle.BEFORE_INIT_EVENT
-     * so that, in normal (non-error) cases, init() related log messages appear
-     * at the expected point in the lifecycle.
+     * Info messages during init() are cached until Lifecycle.BEFORE_INIT_EVENT so that, in normal (non-error) cases,
+     * init() related log messages appear at the expected point in the lifecycle.
      */
     private static final List<String> initInfoLogMessages = new ArrayList<>(3);
 
@@ -81,21 +77,20 @@ public class AprLifecycleListener implements LifecycleListener {
     private static int tcnPatch = 0;
     private static int tcnVersion = 0;
 
-    protected static String SSLEngine = "on"; //default on
+    protected static String SSLEngine = "on"; // default on
     protected static String FIPSMode = "off"; // default off, valid only when SSLEngine="on"
     protected static String SSLRandomSeed = "builtin";
     protected static boolean sslInitialized = false;
     protected static boolean fipsModeActive = false;
 
     /**
-     * The "FIPS mode" level that we use as the argument to OpenSSL method
-     * <code>FIPS_mode_set()</code> to enable FIPS mode and that we expect as
-     * the return value of <code>FIPS_mode()</code> when FIPS mode is enabled.
+     * The "FIPS mode" level that we use as the argument to OpenSSL method <code>FIPS_mode_set()</code> to enable FIPS
+     * mode and that we expect as the return value of <code>FIPS_mode()</code> when FIPS mode is enabled.
      * <p>
-     * In the future the OpenSSL library might grow support for different
-     * non-zero "FIPS" modes that specify different allowed subsets of ciphers
-     * or whatever, but nowadays only "1" is the supported value.
+     * In the future the OpenSSL library might grow support for different non-zero "FIPS" modes that specify different
+     * allowed subsets of ciphers or whatever, but nowadays only "1" is the supported value.
      * </p>
+     *
      * @see <a href="http://wiki.openssl.org/index.php/FIPS_mode_set%28%29">OpenSSL method FIPS_mode_set()</a>
      * @see <a href="http://wiki.openssl.org/index.php/FIPS_mode%28%29">OpenSSL method FIPS_mode()</a>
      */
@@ -106,7 +101,7 @@ public class AprLifecycleListener implements LifecycleListener {
     protected static final Object lock = new Object();
 
     public static boolean isAprAvailable() {
-        //https://bz.apache.org/bugzilla/show_bug.cgi?id=48613
+        // https://bz.apache.org/bugzilla/show_bug.cgi?id=48613
         if (AprStatus.isInstanceCreated()) {
             synchronized (lock) {
                 init();
@@ -132,8 +127,7 @@ public class AprLifecycleListener implements LifecycleListener {
         if (Lifecycle.BEFORE_INIT_EVENT.equals(event.getType())) {
             synchronized (lock) {
                 if (!(event.getLifecycle() instanceof Server)) {
-                    log.warn(sm.getString("listener.notServer",
-                            event.getLifecycle().getClass().getSimpleName()));
+                    log.warn(sm.getString("listener.notServer", event.getLifecycle().getClass().getSimpleName()));
                 }
                 init();
                 for (String msg : initInfoLogMessages) {
@@ -175,12 +169,11 @@ public class AprLifecycleListener implements LifecycleListener {
 
     }
 
-    private static void terminateAPR() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException,
-            InvocationTargetException {
+    private static void terminateAPR()
+            throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
         String methodName = "terminate";
-        Method method = Class.forName("org.apache.tomcat.jni.Library")
-            .getMethod(methodName, (Class [])null);
-        method.invoke(null, (Object []) null);
+        Method method = Class.forName("org.apache.tomcat.jni.Library").getMethod(methodName, (Class[]) null);
+        method.invoke(null, (Object[]) null);
         AprStatus.setAprAvailable(false);
         AprStatus.setAprInitialized(false);
         sslInitialized = false; // Well we cleaned the pool in terminate.
@@ -206,12 +199,10 @@ public class AprLifecycleListener implements LifecycleListener {
         } catch (LibraryNotFoundError lnfe) {
             // Library not on path
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("aprListener.aprInitDebug",
-                        lnfe.getLibraryNames(), System.getProperty("java.library.path"),
-                        lnfe.getMessage()), lnfe);
+                log.debug(sm.getString("aprListener.aprInitDebug", lnfe.getLibraryNames(),
+                        System.getProperty("java.library.path"), lnfe.getMessage()), lnfe);
             }
-            initInfoLogMessages.add(sm.getString("aprListener.aprInit",
-                    System.getProperty("java.library.path")));
+            initInfoLogMessages.add(sm.getString("aprListener.aprInit", System.getProperty("java.library.path")));
             return;
         } catch (Throwable t) {
             // Library present but failed to load
@@ -232,11 +223,8 @@ public class AprLifecycleListener implements LifecycleListener {
             return;
         }
         if (tcnVersion < rqver) {
-            log.error(sm.getString("aprListener.tcnInvalid",
-                    Library.versionString(),
-                    TCN_REQUIRED_MAJOR + "." +
-                    TCN_REQUIRED_MINOR + "." +
-                    TCN_REQUIRED_PATCH));
+            log.error(sm.getString("aprListener.tcnInvalid", Library.versionString(),
+                    TCN_REQUIRED_MAJOR + "." + TCN_REQUIRED_MINOR + "." + TCN_REQUIRED_PATCH));
             try {
                 // Terminate the APR in case the version
                 // is below required.
@@ -248,27 +236,19 @@ public class AprLifecycleListener implements LifecycleListener {
             return;
         }
         if (tcnVersion < rcver) {
-            initInfoLogMessages.add(sm.getString("aprListener.tcnVersion",
-                    Library.versionString(),
-                    TCN_RECOMMENDED_MAJOR + "." +
-                    TCN_RECOMMENDED_MINOR + "." +
-                    TCN_RECOMMENDED_PV));
+            initInfoLogMessages.add(sm.getString("aprListener.tcnVersion", Library.versionString(),
+                    TCN_RECOMMENDED_MAJOR + "." + TCN_RECOMMENDED_MINOR + "." + TCN_RECOMMENDED_PV));
         }
 
-        initInfoLogMessages.add(sm.getString("aprListener.tcnValid",
-                Library.versionString(),
-                Library.aprVersionString()));
+        initInfoLogMessages
+                .add(sm.getString("aprListener.tcnValid", Library.versionString(), Library.aprVersionString()));
 
         // Log APR flags
-        initInfoLogMessages.add(sm.getString("aprListener.flags",
-                Boolean.valueOf(Library.APR_HAVE_IPV6),
-                Boolean.valueOf(Library.APR_HAS_SENDFILE),
-                Boolean.valueOf(Library.APR_HAS_SO_ACCEPTFILTER),
-                Boolean.valueOf(Library.APR_HAS_RANDOM),
-                Boolean.valueOf(Library.APR_HAVE_UNIX)));
-
-        initInfoLogMessages.add(sm.getString("aprListener.config",
-                Boolean.valueOf(AprStatus.getUseAprConnector()),
+        initInfoLogMessages.add(sm.getString("aprListener.flags", Boolean.valueOf(Library.APR_HAVE_IPV6),
+                Boolean.valueOf(Library.APR_HAS_SENDFILE), Boolean.valueOf(Library.APR_HAS_SO_ACCEPTFILTER),
+                Boolean.valueOf(Library.APR_HAS_RANDOM), Boolean.valueOf(Library.APR_HAVE_UNIX)));
+
+        initInfoLogMessages.add(sm.getString("aprListener.config", Boolean.valueOf(AprStatus.getUseAprConnector()),
                 Boolean.valueOf(AprStatus.getUseOpenSSL())));
 
         AprStatus.setAprAvailable(true);
@@ -297,7 +277,7 @@ public class AprLifecycleListener implements LifecycleListener {
 
 
         methodName = "initialize";
-        paramValues[0] = "on".equalsIgnoreCase(SSLEngine)?null:SSLEngine;
+        paramValues[0] = "on".equalsIgnoreCase(SSLEngine) ? null : SSLEngine;
         method = clazz.getMethod(methodName, paramTypes);
         method.invoke(null, paramValues);
 
@@ -312,7 +292,7 @@ public class AprLifecycleListener implements LifecycleListener {
             final boolean enterFipsMode;
             int fipsModeState = SSL.fipsModeGet();
 
-            if(log.isDebugEnabled()) {
+            if (log.isDebugEnabled()) {
                 log.debug(sm.getString("aprListener.currentFIPSMode", Integer.valueOf(fipsModeState)));
             }
 
@@ -358,13 +338,12 @@ public class AprLifecycleListener implements LifecycleListener {
                         fipsModeActive = true;
                         enterFipsMode = false;
                     } else {
-                        throw new IllegalStateException(sm.getString(
-                                "aprListener.enterAlreadyInFIPSMode", Integer.valueOf(fipsModeState)));
+                        throw new IllegalStateException(
+                                sm.getString("aprListener.enterAlreadyInFIPSMode", Integer.valueOf(fipsModeState)));
                     }
                 }
             } else {
-                throw new IllegalArgumentException(sm.getString(
-                        "aprListener.wrongFIPSMode", FIPSMode));
+                throw new IllegalArgumentException(sm.getString("aprListener.wrongFIPSMode", FIPSMode));
             }
 
             if (enterFipsMode) {
@@ -399,8 +378,7 @@ public class AprLifecycleListener implements LifecycleListener {
         if (!SSLEngine.equals(AprLifecycleListener.SSLEngine)) {
             // Ensure that the SSLEngine is consistent with that used for SSL init
             if (sslInitialized) {
-                throw new IllegalStateException(
-                        sm.getString("aprListener.tooLateForSSLEngine"));
+                throw new IllegalStateException(sm.getString("aprListener.tooLateForSSLEngine"));
             }
 
             AprLifecycleListener.SSLEngine = SSLEngine;
@@ -415,8 +393,7 @@ public class AprLifecycleListener implements LifecycleListener {
         if (!SSLRandomSeed.equals(AprLifecycleListener.SSLRandomSeed)) {
             // Ensure that the random seed is consistent with that used for SSL init
             if (sslInitialized) {
-                throw new IllegalStateException(
-                        sm.getString("aprListener.tooLateForSSLRandomSeed"));
+                throw new IllegalStateException(sm.getString("aprListener.tooLateForSSLRandomSeed"));
             }
 
             AprLifecycleListener.SSLRandomSeed = SSLRandomSeed;
@@ -431,8 +408,7 @@ public class AprLifecycleListener implements LifecycleListener {
         if (!FIPSMode.equals(AprLifecycleListener.FIPSMode)) {
             // Ensure that the FIPS mode is consistent with that used for SSL init
             if (sslInitialized) {
-                throw new IllegalStateException(
-                        sm.getString("aprListener.tooLateForFIPSMode"));
+                throw new IllegalStateException(sm.getString("aprListener.tooLateForFIPSMode"));
             }
 
             AprLifecycleListener.FIPSMode = FIPSMode;
diff --git a/java/org/apache/catalina/core/AsyncContextImpl.java b/java/org/apache/catalina/core/AsyncContextImpl.java
index eb1dcce070..70555d962e 100644
--- a/java/org/apache/catalina/core/AsyncContextImpl.java
+++ b/java/org/apache/catalina/core/AsyncContextImpl.java
@@ -55,12 +55,11 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
 
     protected static final StringManager sm = StringManager.getManager(AsyncContextImpl.class);
 
-    /* When a request uses a sequence of multiple start(); dispatch() with
-     * non-container threads it is possible for a previous dispatch() to
-     * interfere with a following start(). This lock prevents that from
-     * happening. It is a dedicated object as user code may lock on the
-     * AsyncContext so if container code also locks on that object deadlocks may
-     * occur.
+    /*
+     * When a request uses a sequence of multiple start(); dispatch() with non-container threads it is possible for a
+     * previous dispatch() to interfere with a following start(). This lock prevents that from happening. It is a
+     * dedicated object as user code may lock on the AsyncContext so if container code also locks on that object
+     * deadlocks may occur.
      */
     private final Object asyncContextLock = new Object();
 
@@ -105,8 +104,7 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
                     listener.fireOnComplete(event);
                 } catch (Throwable t) {
                     ExceptionUtils.handleThrowable(t);
-                    log.warn(sm.getString("asyncContextImpl.onCompleteError",
-                            listener.getClass().getName()), t);
+                    log.warn(sm.getString("asyncContextImpl.onCompleteError", listener.getClass().getName()), t);
                 }
             }
         } finally {
@@ -135,12 +133,10 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
                         listener.fireOnTimeout(event);
                     } catch (Throwable t) {
                         ExceptionUtils.handleThrowable(t);
-                        log.warn(sm.getString("asyncContextImpl.onTimeoutError",
-                                listener.getClass().getName()), t);
+                        log.warn(sm.getString("asyncContextImpl.onTimeoutError", listener.getClass().getName()), t);
                     }
                 }
-                request.getCoyoteRequest().action(
-                        ActionCode.ASYNC_IS_TIMINGOUT, result);
+                request.getCoyoteRequest().action(ActionCode.ASYNC_IS_TIMINGOUT, result);
             } finally {
                 context.unbind(false, oldCL);
             }
@@ -185,10 +181,9 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
             }
             check();
             if (dispatch != null) {
-                throw new IllegalStateException(
-                        sm.getString("asyncContextImpl.dispatchingStarted"));
+                throw new IllegalStateException(sm.getString("asyncContextImpl.dispatchingStarted"));
             }
-            if (request.getAttribute(ASYNC_REQUEST_URI)==null) {
+            if (request.getAttribute(ASYNC_REQUEST_URI) == null) {
                 request.setAttribute(ASYNC_REQUEST_URI, request.getRequestURI());
                 request.setAttribute(ASYNC_CONTEXT_PATH, request.getContextPath());
                 request.setAttribute(ASYNC_SERVLET_PATH, request.getServletPath());
@@ -197,15 +192,12 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
             }
             final RequestDispatcher requestDispatcher = servletContext.getRequestDispatcher(path);
             if (!(requestDispatcher instanceof AsyncDispatcher)) {
-                throw new UnsupportedOperationException(
-                        sm.getString("asyncContextImpl.noAsyncDispatcher"));
+                throw new UnsupportedOperationException(sm.getString("asyncContextImpl.noAsyncDispatcher"));
             }
-            final AsyncDispatcher applicationDispatcher =
-                    (AsyncDispatcher) requestDispatcher;
+            final AsyncDispatcher applicationDispatcher = (AsyncDispatcher) requestDispatcher;
             final ServletRequest servletRequest = getRequest();
             final ServletResponse servletResponse = getResponse();
-            this.dispatch = new AsyncRunnable(
-                    request, applicationDispatcher, servletRequest, servletResponse);
+            this.dispatch = new AsyncRunnable(request, applicationDispatcher, servletRequest, servletResponse);
             this.request.getCoyoteRequest().action(ActionCode.ASYNC_DISPATCH, null);
             clearServletRequestResponse();
         }
@@ -215,8 +207,7 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
     public ServletRequest getRequest() {
         check();
         if (servletRequest == null) {
-            throw new IllegalStateException(
-                    sm.getString("asyncContextImpl.request.ise"));
+            throw new IllegalStateException(sm.getString("asyncContextImpl.request.ise"));
         }
         return servletRequest;
     }
@@ -225,8 +216,7 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
     public ServletResponse getResponse() {
         check();
         if (servletResponse == null) {
-            throw new IllegalStateException(
-                    sm.getString("asyncContextImpl.response.ise"));
+            throw new IllegalStateException(sm.getString("asyncContextImpl.response.ise"));
         }
         return servletResponse;
     }
@@ -250,8 +240,7 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
     }
 
     @Override
-    public void addListener(AsyncListener listener, ServletRequest servletRequest,
-            ServletResponse servletResponse) {
+    public void addListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse) {
         check();
         AsyncListenerWrapper wrapper = new AsyncListenerWrapper();
         wrapper.setListener(listener);
@@ -262,13 +251,11 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
 
     @SuppressWarnings("unchecked")
     @Override
-    public <T extends AsyncListener> T createListener(Class<T> clazz)
-            throws ServletException {
+    public <T extends AsyncListener> T createListener(Class<T> clazz) throws ServletException {
         check();
         T listener = null;
         try {
-             listener = (T) context.getInstanceManager().newInstance(
-                     clazz.getName(), clazz.getClassLoader());
+            listener = (T) context.getInstanceManager().newInstance(clazz.getName(), clazz.getClassLoader());
         } catch (ReflectiveOperationException | NamingException e) {
             ServletException se = new ServletException(e);
             throw se;
@@ -301,17 +288,15 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
 
     public boolean isStarted() {
         AtomicBoolean result = new AtomicBoolean(false);
-        request.getCoyoteRequest().action(
-                ActionCode.ASYNC_IS_STARTED, result);
+        request.getCoyoteRequest().action(ActionCode.ASYNC_IS_STARTED, result);
         return result.get();
     }
 
-    public void setStarted(Context context, ServletRequest request,
-            ServletResponse response, boolean originalRequestResponse) {
+    public void setStarted(Context context, ServletRequest request, ServletResponse response,
+            boolean originalRequestResponse) {
 
         synchronized (asyncContextLock) {
-            this.request.getCoyoteRequest().action(
-                    ActionCode.ASYNC_START, this);
+            this.request.getCoyoteRequest().action(ActionCode.ASYNC_START, this);
 
             this.context = context;
             context.incrementInProgressAsyncCount();
@@ -330,8 +315,7 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
                     listener.fireOnStartAsync(event);
                 } catch (Throwable t) {
                     ExceptionUtils.handleThrowable(t);
-                    log.warn(sm.getString("asyncContextImpl.onStartAsyncError",
-                            listener.getClass().getName()), t);
+                    log.warn(sm.getString("asyncContextImpl.onStartAsyncError", listener.getClass().getName()), t);
                 }
             }
         }
@@ -357,10 +341,10 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
         } catch (RuntimeException x) {
             // doInternalComplete(true);
             if (x.getCause() instanceof ServletException) {
-                throw (ServletException)x.getCause();
+                throw (ServletException) x.getCause();
             }
             if (x.getCause() instanceof IOException) {
-                throw (IOException)x.getCause();
+                throw (IOException) x.getCause();
             }
             throw new ServletException(x);
         }
@@ -378,12 +362,10 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
     public void setTimeout(long timeout) {
         check();
         this.timeout = timeout;
-        request.getCoyoteRequest().action(ActionCode.ASYNC_SETTIMEOUT,
-                Long.valueOf(timeout));
+        request.getCoyoteRequest().action(ActionCode.ASYNC_SETTIMEOUT, Long.valueOf(timeout));
     }
 
 
-
     @Override
     public boolean isAvailable() {
         Context context = this.context;
@@ -395,7 +377,7 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
 
 
     public void setErrorState(Throwable t, boolean fireOnError) {
-        if (t!=null) {
+        if (t != null) {
             request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t);
         }
         request.getCoyoteRequest().action(ActionCode.ASYNC_ERROR, null);
@@ -404,16 +386,15 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
             if (log.isDebugEnabled()) {
                 log.debug(sm.getString("asyncContextImpl.fireOnError"));
             }
-            AsyncEvent errorEvent = new AsyncEvent(event.getAsyncContext(),
-                    event.getSuppliedRequest(), event.getSuppliedResponse(), t);
+            AsyncEvent errorEvent = new AsyncEvent(event.getAsyncContext(), event.getSuppliedRequest(),
+                    event.getSuppliedResponse(), t);
             List<AsyncListenerWrapper> listenersCopy = new ArrayList<>(listeners);
             for (AsyncListenerWrapper listener : listenersCopy) {
                 try {
                     listener.fireOnError(errorEvent);
                 } catch (Throwable t2) {
                     ExceptionUtils.handleThrowable(t2);
-                    log.warn(sm.getString("asyncContextImpl.onErrorError",
-                            listener.getClass().getName()), t2);
+                    log.warn(sm.getString("asyncContextImpl.onErrorError", listener.getClass().getName()), t2);
                 }
             }
         }
@@ -429,19 +410,16 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
             // threads)
             ServletResponse servletResponse = this.servletResponse;
             if (servletResponse instanceof HttpServletResponse) {
-                ((HttpServletResponse) servletResponse).setStatus(
-                        HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+                ((HttpServletResponse) servletResponse).setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             }
 
             Host host = (Host) context.getParent();
             Valve stdHostValve = host.getPipeline().getBasic();
             if (stdHostValve instanceof StandardHostValve) {
-                ((StandardHostValve) stdHostValve).throwable(request,
-                        request.getResponse(), t);
+                ((StandardHostValve) stdHostValve).throwable(request, request.getResponse(), t);
             }
 
-            request.getCoyoteRequest().action(
-                    ActionCode.ASYNC_IS_ERROR, result);
+            request.getCoyoteRequest().action(ActionCode.ASYNC_IS_ERROR, result);
             if (result.get()) {
                 // Still in the error state. The error page did not call
                 // complete() or dispatch(). Complete the async processing.
@@ -506,9 +484,8 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
         }
         String msg = String.format(
                 "Req: %1$8s  CReq: %2$8s  RP: %3$8s  Stage: %4$s  " +
-                "Thread: %5$20s  State: %6$20s  Method: %7$11s  URI: %8$s",
-                rHashCode, crHashCode, rpHashCode, stage,
-                threadName, "N/A", method, uri);
+                        "Thread: %5$20s  State: %6$20s  Method: %7$11s  URI: %8$s",
+                rHashCode, crHashCode, rpHashCode, stage, threadName, "N/A", method, uri);
         if (log.isTraceEnabled()) {
             log.trace(msg, new DebugException());
         } else {
@@ -519,8 +496,7 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
     private void check() {
         if (request == null) {
             // AsyncContext has been recycled and should not be being used
-            throw new IllegalStateException(sm.getString(
-                    "asyncContextImpl.requestEnded"));
+            throw new IllegalStateException(sm.getString("asyncContextImpl.requestEnded"));
         }
     }
 
@@ -534,8 +510,7 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
         private final Context context;
         private final org.apache.coyote.Request coyoteRequest;
 
-        public RunnableWrapper(Runnable wrapped, Context ctxt,
-                org.apache.coyote.Request coyoteRequest) {
+        public RunnableWrapper(Runnable wrapped, Context ctxt, org.apache.coyote.Request coyoteRequest) {
             this.wrapped = wrapped;
             this.context = ctxt;
             this.coyoteRequest = coyoteRequest;
@@ -572,8 +547,8 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
         private final ServletRequest servletRequest;
         private final ServletResponse servletResponse;
 
-        public AsyncRunnable(Request request, AsyncDispatcher applicationDispatcher,
-                ServletRequest servletRequest, ServletResponse servletResponse) {
+        public AsyncRunnable(Request request, AsyncDispatcher applicationDispatcher, ServletRequest servletRequest,
+                ServletResponse servletResponse) {
             this.request = request;
             this.applicationDispatcher = applicationDispatcher;
             this.servletRequest = servletRequest;
diff --git a/java/org/apache/catalina/core/AsyncListenerWrapper.java b/java/org/apache/catalina/core/AsyncListenerWrapper.java
index 694276d60f..1ed0c858ee 100644
--- a/java/org/apache/catalina/core/AsyncListenerWrapper.java
+++ b/java/org/apache/catalina/core/AsyncListenerWrapper.java
@@ -72,8 +72,7 @@ public class AsyncListenerWrapper {
 
     private AsyncEvent customizeEvent(AsyncEvent event) {
         if (servletRequest != null && servletResponse != null) {
-            return new AsyncEvent(event.getAsyncContext(), servletRequest, servletResponse,
-                    event.getThrowable());
+            return new AsyncEvent(event.getAsyncContext(), servletRequest, servletResponse, event.getThrowable());
         } else {
             return event;
         }
diff --git a/java/org/apache/catalina/core/ContainerBase.java b/java/org/apache/catalina/core/ContainerBase.java
index f09038f5a3..e164927c74 100644
--- a/java/org/apache/catalina/core/ContainerBase.java
+++ b/java/org/apache/catalina/core/ContainerBase.java
@@ -68,61 +68,56 @@ import org.apache.tomcat.util.threads.InlineExecutorService;
 
 
 /**
- * Abstract implementation of the <b>Container</b> interface, providing common
- * functionality required by nearly every implementation.  Classes extending
- * this base class must may implement a replacement for <code>invoke()</code>.
+ * Abstract implementation of the <b>Container</b> interface, providing common functionality required by nearly every
+ * implementation. Classes extending this base class must may implement a replacement for <code>invoke()</code>.
  * <p>
- * All subclasses of this abstract base class will include support for a
- * Pipeline object that defines the processing to be performed for each request
- * received by the <code>invoke()</code> method of this class, utilizing the
- * "Chain of Responsibility" design pattern.  A subclass should encapsulate its
- * own processing functionality as a <code>Valve</code>, and configure this
- * Valve into the pipeline by calling <code>setBasic()</code>.
+ * All subclasses of this abstract base class will include support for a Pipeline object that defines the processing to
+ * be performed for each request received by the <code>invoke()</code> method of this class, utilizing the "Chain of
+ * Responsibility" design pattern. A subclass should encapsulate its own processing functionality as a
+ * <code>Valve</code>, and configure this Valve into the pipeline by calling <code>setBasic()</code>.
  * <p>
- * This implementation fires property change events, per the JavaBeans design
- * pattern, for changes in singleton properties.  In addition, it fires the
- * following <code>ContainerEvent</code> events to listeners who register
+ * This implementation fires property change events, per the JavaBeans design pattern, for changes in singleton
+ * properties. In addition, it fires the following <code>ContainerEvent</code> events to listeners who register
  * themselves with <code>addContainerListener()</code>:
  * <table border=1>
- *   <caption>ContainerEvents fired by this implementation</caption>
- *   <tr>
- *     <th>Type</th>
- *     <th>Data</th>
- *     <th>Description</th>
- *   </tr>
- *   <tr>
- *     <td><code>addChild</code></td>
- *     <td><code>Container</code></td>
- *     <td>Child container added to this Container.</td>
- *   </tr>
- *   <tr>
- *     <td><code>{@link #getPipeline() pipeline}.addValve</code></td>
- *     <td><code>Valve</code></td>
- *     <td>Valve added to this Container.</td>
- *   </tr>
- *   <tr>
- *     <td><code>removeChild</code></td>
- *     <td><code>Container</code></td>
- *     <td>Child container removed from this Container.</td>
- *   </tr>
- *   <tr>
- *     <td><code>{@link #getPipeline() pipeline}.removeValve</code></td>
- *     <td><code>Valve</code></td>
- *     <td>Valve removed from this Container.</td>
- *   </tr>
- *   <tr>
- *     <td><code>start</code></td>
- *     <td><code>null</code></td>
- *     <td>Container was started.</td>
- *   </tr>
- *   <tr>
- *     <td><code>stop</code></td>
- *     <td><code>null</code></td>
- *     <td>Container was stopped.</td>
- *   </tr>
+ * <caption>ContainerEvents fired by this implementation</caption>
+ * <tr>
+ * <th>Type</th>
+ * <th>Data</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td><code>addChild</code></td>
+ * <td><code>Container</code></td>
+ * <td>Child container added to this Container.</td>
+ * </tr>
+ * <tr>
+ * <td><code>{@link #getPipeline() pipeline}.addValve</code></td>
+ * <td><code>Valve</code></td>
+ * <td>Valve added to this Container.</td>
+ * </tr>
+ * <tr>
+ * <td><code>removeChild</code></td>
+ * <td><code>Container</code></td>
+ * <td>Child container removed from this Container.</td>
+ * </tr>
+ * <tr>
+ * <td><code>{@link #getPipeline() pipeline}.removeValve</code></td>
+ * <td><code>Valve</code></td>
+ * <td>Valve removed from this Container.</td>
+ * </tr>
+ * <tr>
+ * <td><code>start</code></td>
+ * <td><code>null</code></td>
+ * <td>Container was started.</td>
+ * </tr>
+ * <tr>
+ * <td><code>stop</code></td>
+ * <td><code>null</code></td>
+ * <td>Container was stopped.</td>
+ * </tr>
  * </table>
- * Subclasses that fire additional events should document them in the
- * class comments of the implementation class.
+ * Subclasses that fire additional events should document them in the class comments of the implementation class.
  *
  * @author Craig R. McClanahan
  */
@@ -131,10 +126,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
     private static final Log log = LogFactory.getLog(ContainerBase.class);
 
     /**
-     * Perform addChild with the permissions of this class.
-     * addChild can be called with the XML parser on the stack,
-     * this allows the XML parser to have fewer privileges than
-     * Tomcat.
+     * Perform addChild with the permissions of this class. addChild can be called with the XML parser on the stack,
+     * this allows the XML parser to have fewer privileges than Tomcat.
      */
     protected class PrivilegedAddChild implements PrivilegedAction<Void> {
 
@@ -175,10 +168,9 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
     protected ScheduledFuture<?> monitorFuture;
 
     /**
-     * The container event listeners for this Container. Implemented as a
-     * CopyOnWriteArrayList since listeners may invoke methods to add/remove
-     * themselves or other listeners and with a ReadWriteLock that would trigger
-     * a deadlock.
+     * The container event listeners for this Container. Implemented as a CopyOnWriteArrayList since listeners may
+     * invoke methods to add/remove themselves or other listeners and with a ReadWriteLock that would trigger a
+     * deadlock.
      */
     protected final List<ContainerListener> listeners = new CopyOnWriteArrayList<>();
 
@@ -251,21 +243,19 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
     /**
      * The property change support for this component.
      */
-    protected final PropertyChangeSupport support =
-            new PropertyChangeSupport(this);
+    protected final PropertyChangeSupport support = new PropertyChangeSupport(this);
 
 
     /**
-     * The access log to use for requests normally handled by this container
-     * that have been handled earlier in the processing chain.
+     * The access log to use for requests normally handled by this container that have been handled earlier in the
+     * processing chain.
      */
     protected volatile AccessLog accessLog = null;
     private volatile boolean accessLogScanComplete = false;
 
 
     /**
-     * The number of threads available to process start and stop events for any
-     * children associated with this container.
+     * The number of threads available to process start and stop events for any children associated with this container.
      */
     private int startStopThreads = 1;
     protected ExecutorService startStopExecutor;
@@ -291,13 +281,10 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Get the delay between the invocation of the backgroundProcess method on
-     * this container and its children. Child containers will not be invoked
-     * if their delay value is not negative (which would mean they are using
-     * their own thread). Setting this to a positive value will cause
-     * a thread to be spawn. After waiting the specified amount of time,
-     * the thread will invoke the executePeriodic method on this container
-     * and all its children.
+     * Get the delay between the invocation of the backgroundProcess method on this container and its children. Child
+     * containers will not be invoked if their delay value is not negative (which would mean they are using their own
+     * thread). Setting this to a positive value will cause a thread to be spawn. After waiting the specified amount of
+     * time, the thread will invoke the executePeriodic method on this container and all its children.
      */
     @Override
     public int getBackgroundProcessorDelay() {
@@ -306,11 +293,9 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Set the delay between the invocation of the execute method on this
-     * container and its children.
+     * Set the delay between the invocation of the execute method on this container and its children.
      *
-     * @param delay The delay in seconds between the invocation of
-     *              backgroundProcess methods
+     * @param delay The delay in seconds between the invocation of backgroundProcess methods
      */
     @Override
     public void setBackgroundProcessorDelay(int delay) {
@@ -349,8 +334,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
             } else if (name.startsWith("##")) {
                 name = "/" + name;
             }
-            loggerName = "[" + name + "]"
-                + ((loggerName != null) ? ("." + loggerName) : "");
+            loggerName = "[" + name + "]" + ((loggerName != null) ? ("." + loggerName) : "");
             current = current.getParent();
         }
         logName = ContainerBase.class.getName() + "." + loggerName;
@@ -360,9 +344,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Return the Cluster with which this Container is associated.  If there is
-     * no associated Cluster, return the Cluster associated with our parent
-     * Container (if any); otherwise return <code>null</code>.
+     * Return the Cluster with which this Container is associated. If there is no associated Cluster, return the Cluster
+     * associated with our parent Container (if any); otherwise return <code>null</code>.
      */
     @Override
     public Cluster getCluster() {
@@ -418,8 +401,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
             this.cluster = cluster;
 
             // Stop the old component if necessary
-            if (getState().isAvailable() && (oldCluster != null) &&
-                (oldCluster instanceof Lifecycle)) {
+            if (getState().isAvailable() && (oldCluster != null) && (oldCluster instanceof Lifecycle)) {
                 try {
                     ((Lifecycle) oldCluster).stop();
                 } catch (LifecycleException e) {
@@ -432,8 +414,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
                 cluster.setContainer(this);
             }
 
-            if (getState().isAvailable() && (cluster != null) &&
-                (cluster instanceof Lifecycle)) {
+            if (getState().isAvailable() && (cluster != null) && (cluster instanceof Lifecycle)) {
                 try {
                     ((Lifecycle) cluster).start();
                 } catch (LifecycleException e) {
@@ -450,9 +431,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Return a name string (suitable for use by humans) that describes this
-     * Container.  Within the set of child containers belonging to a particular
-     * parent, Container names must be unique.
+     * Return a name string (suitable for use by humans) that describes this Container. Within the set of child
+     * containers belonging to a particular parent, Container names must be unique.
      */
     @Override
     public String getName() {
@@ -461,15 +441,13 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Set a name string (suitable for use by humans) that describes this
-     * Container.  Within the set of child containers belonging to a particular
-     * parent, Container names must be unique.
+     * Set a name string (suitable for use by humans) that describes this Container. Within the set of child containers
+     * belonging to a particular parent, Container names must be unique.
      *
      * @param name New name of this container
      *
-     * @exception IllegalStateException if this Container has already been
-     *  added to the children of a parent Container (after which the name
-     *  may not be changed)
+     * @exception IllegalStateException if this Container has already been added to the children of a parent Container
+     *                                      (after which the name may not be changed)
      */
     @Override
     public void setName(String name) {
@@ -483,8 +461,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Return if children of this container will be started automatically when
-     * they are added to this container.
+     * Return if children of this container will be started automatically when they are added to this container.
      *
      * @return <code>true</code> if the children will be started
      */
@@ -494,8 +471,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Set if children of this container will be started automatically when
-     * they are added to this container.
+     * Set if children of this container will be started automatically when they are added to this container.
      *
      * @param startChildren New value of the startChildren flag
      */
@@ -508,8 +484,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Return the Container for which this Container is a child, if there is
-     * one.  If there is no defined parent, return <code>null</code>.
+     * Return the Container for which this Container is a child, if there is one. If there is no defined parent, return
+     * <code>null</code>.
      */
     @Override
     public Container getParent() {
@@ -518,15 +494,12 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Set the parent Container to which this Container is being added as a
-     * child.  This Container may refuse to become attached to the specified
-     * Container by throwing an exception.
+     * Set the parent Container to which this Container is being added as a child. This Container may refuse to become
+     * attached to the specified Container by throwing an exception.
      *
-     * @param container Container to which this Container is being added
-     *  as a child
+     * @param container Container to which this Container is being added as a child
      *
-     * @exception IllegalArgumentException if this Container refuses to become
-     *  attached to the specified Container
+     * @exception IllegalArgumentException if this Container refuses to become attached to the specified Container
      */
     @Override
     public void setParent(Container container) {
@@ -539,9 +512,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Return the parent class loader (if any) for this web application.
-     * This call is meaningful only <strong>after</strong> a Loader has
-     * been configured.
+     * Return the parent class loader (if any) for this web application. This call is meaningful only
+     * <strong>after</strong> a Loader has been configured.
      */
     @Override
     public ClassLoader getParentClassLoader() {
@@ -556,11 +528,9 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Set the parent class loader (if any) for this web application.
-     * This call is meaningful only <strong>before</strong> a Loader has
-     * been configured, and the specified value (if non-null) should be
-     * passed as an argument to the class loader constructor.
-     *
+     * Set the parent class loader (if any) for this web application. This call is meaningful only
+     * <strong>before</strong> a Loader has been configured, and the specified value (if non-null) should be passed as
+     * an argument to the class loader constructor.
      *
      * @param parent The new parent class loader
      */
@@ -568,15 +538,13 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
     public void setParentClassLoader(ClassLoader parent) {
         ClassLoader oldParentClassLoader = this.parentClassLoader;
         this.parentClassLoader = parent;
-        support.firePropertyChange("parentClassLoader", oldParentClassLoader,
-                                   this.parentClassLoader);
+        support.firePropertyChange("parentClassLoader", oldParentClassLoader, this.parentClassLoader);
 
     }
 
 
     /**
-     * Return the Pipeline object that manages the Valves associated with
-     * this Container.
+     * Return the Pipeline object that manages the Valves associated with this Container.
      */
     @Override
     public Pipeline getPipeline() {
@@ -585,9 +553,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Return the Realm with which this Container is associated.  If there is
-     * no associated Realm, return the Realm associated with our parent
-     * Container (if any); otherwise return <code>null</code>.
+     * Return the Realm with which this Container is associated. If there is no associated Realm, return the Realm
+     * associated with our parent Container (if any); otherwise return <code>null</code>.
      */
     @Override
     public Realm getRealm() {
@@ -637,8 +604,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
             this.realm = realm;
 
             // Stop the old component if necessary
-            if (getState().isAvailable() && (oldRealm != null) &&
-                (oldRealm instanceof Lifecycle)) {
+            if (getState().isAvailable() && (oldRealm != null) && (oldRealm instanceof Lifecycle)) {
                 try {
                     ((Lifecycle) oldRealm).stop();
                 } catch (LifecycleException e) {
@@ -650,8 +616,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
             if (realm != null) {
                 realm.setContainer(this);
             }
-            if (getState().isAvailable() && (realm != null) &&
-                (realm instanceof Lifecycle)) {
+            if (getState().isAvailable() && (realm != null) && (realm instanceof Lifecycle)) {
                 try {
                     ((Lifecycle) realm).start();
                 } catch (LifecycleException e) {
@@ -672,27 +637,23 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Add a new child Container to those associated with this Container,
-     * if supported.  Prior to adding this Container to the set of children,
-     * the child's <code>setParent()</code> method must be called, with this
-     * Container as an argument.  This method may thrown an
-     * <code>IllegalArgumentException</code> if this Container chooses not
-     * to be attached to the specified Container, in which case it is not added
+     * Add a new child Container to those associated with this Container, if supported. Prior to adding this Container
+     * to the set of children, the child's <code>setParent()</code> method must be called, with this Container as an
+     * argument. This method may thrown an <code>IllegalArgumentException</code> if this Container chooses not to be
+     * attached to the specified Container, in which case it is not added
      *
      * @param child New child Container to be added
      *
-     * @exception IllegalArgumentException if this exception is thrown by
-     *  the <code>setParent()</code> method of the child Container
-     * @exception IllegalArgumentException if the new child does not have
-     *  a name unique from that of existing children of this Container
-     * @exception IllegalStateException if this Container does not support
-     *  child Containers
+     * @exception IllegalArgumentException if this exception is thrown by the <code>setParent()</code> method of the
+     *                                         child Container
+     * @exception IllegalArgumentException if the new child does not have a name unique from that of existing children
+     *                                         of this Container
+     * @exception IllegalStateException    if this Container does not support child Containers
      */
     @Override
     public void addChild(Container child) {
         if (Globals.IS_SECURITY_ENABLED) {
-            PrivilegedAction<Void> dp =
-                new PrivilegedAddChild(child);
+            PrivilegedAction<Void> dp = new PrivilegedAddChild(child);
             AccessController.doPrivileged(dp);
         } else {
             addChildInternal(child);
@@ -705,12 +666,11 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
             log.debug("Add child " + child + " " + this);
         }
 
-        synchronized(children) {
+        synchronized (children) {
             if (children.get(child.getName()) != null) {
-                throw new IllegalArgumentException(
-                        sm.getString("containerBase.child.notUnique", child.getName()));
+                throw new IllegalArgumentException(sm.getString("containerBase.child.notUnique", child.getName()));
             }
-            child.setParent(this);  // May throw IAE
+            child.setParent(this); // May throw IAE
             children.put(child.getName(), child);
         }
 
@@ -720,9 +680,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
         // Don't do this inside sync block - start can be a slow process and
         // locking the children object can cause problems elsewhere
         try {
-            if ((getState().isAvailable() ||
-                    LifecycleState.STARTING_PREP.equals(getState())) &&
-                    startChildren) {
+            if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) {
                 child.start();
             }
         } catch (LifecycleException e) {
@@ -754,8 +712,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Return the child Container, associated with this Container, with
-     * the specified name (if any); otherwise, return <code>null</code>
+     * Return the child Container, associated with this Container, with the specified name (if any); otherwise, return
+     * <code>null</code>
      *
      * @param name Name of the child Container to be retrieved
      */
@@ -771,8 +729,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Return the set of children Containers associated with this Container.
-     * If this Container has no children, a zero-length array is returned.
+     * Return the set of children Containers associated with this Container. If this Container has no children, a
+     * zero-length array is returned.
      */
     @Override
     public Container[] findChildren() {
@@ -783,9 +741,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Return the set of container listeners associated with this Container.
-     * If this Container has no registered container listeners, a zero-length
-     * array is returned.
+     * Return the set of container listeners associated with this Container. If this Container has no registered
+     * container listeners, a zero-length array is returned.
      */
     @Override
     public ContainerListener[] findContainerListeners() {
@@ -794,8 +751,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Remove an existing child Container from association with this parent
-     * Container.
+     * Remove an existing child Container from association with this parent Container.
      *
      * @param child Existing child Container to be removed
      */
@@ -831,7 +787,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
             fireContainerEvent(REMOVE_CHILD_EVENT, child);
         }
 
-        synchronized(children) {
+        synchronized (children) {
             if (children.get(child.getName()) == null) {
                 return;
             }
@@ -888,11 +844,11 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Start this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
+     * Start this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void startInternal() throws LifecycleException {
@@ -944,19 +900,18 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
         // Start our thread
         if (backgroundProcessorDelay > 0) {
-            monitorFuture = Container.getService(ContainerBase.this).getServer()
-                    .getUtilityExecutor().scheduleWithFixedDelay(
-                            new ContainerBackgroundProcessorMonitor(), 0, 60, TimeUnit.SECONDS);
+            monitorFuture = Container.getService(ContainerBase.this).getServer().getUtilityExecutor()
+                    .scheduleWithFixedDelay(new ContainerBackgroundProcessorMonitor(), 0, 60, TimeUnit.SECONDS);
         }
     }
 
 
     /**
-     * Stop this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
+     * Stop this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void stopInternal() throws LifecycleException {
@@ -971,8 +926,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
         setState(LifecycleState.STOPPING);
 
         // Stop the Valves in our pipeline (including the basic), if any
-        if (pipeline instanceof Lifecycle &&
-                ((Lifecycle) pipeline).getState().isAvailable()) {
+        if (pipeline instanceof Lifecycle && ((Lifecycle) pipeline).getState().isAvailable()) {
             ((Lifecycle) pipeline).stop();
         }
 
@@ -993,8 +947,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
             }
         }
         if (fail) {
-            throw new LifecycleException(
-                    sm.getString("containerBase.threadedStopFailed"));
+            throw new LifecycleException(sm.getString("containerBase.threadedStopFailed"));
         }
 
         // Stop our subordinate components, if any
@@ -1045,13 +998,11 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Check this container for an access log and if none is found, look to the
-     * parent. If there is no parent and still none is found, use the NoOp
-     * access log.
+     * Check this container for an access log and if none is found, look to the parent. If there is no parent and still
+     * none is found, use the NoOp access log.
      */
     @Override
-    public void logAccess(Request request, Response response, long time,
-            boolean useDefault) {
+    public void logAccess(Request request, Response response, long time, boolean useDefault) {
 
         boolean logged = false;
 
@@ -1096,21 +1047,16 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Convenience method, intended for use by the digester to simplify the
-     * process of adding Valves to containers. See
-     * {@link Pipeline#addValve(Valve)} for full details. Components other than
-     * the digester should use {@link #getPipeline()}.{@link #addValve(Valve)} in case a
-     * future implementation provides an alternative method for the digester to
-     * use.
+     * Convenience method, intended for use by the digester to simplify the process of adding Valves to containers. See
+     * {@link Pipeline#addValve(Valve)} for full details. Components other than the digester should use
+     * {@link #getPipeline()}.{@link #addValve(Valve)} in case a future implementation provides an alternative method
+     * for the digester to use.
      *
      * @param valve Valve to be added
      *
-     * @exception IllegalArgumentException if this Container refused to
-     *  accept the specified Valve
-     * @exception IllegalArgumentException if the specified Valve refuses to be
-     *  associated with this Container
-     * @exception IllegalStateException if the specified Valve is already
-     *  associated with a different Container
+     * @exception IllegalArgumentException if this Container refused to accept the specified Valve
+     * @exception IllegalArgumentException if the specified Valve refuses to be associated with this Container
+     * @exception IllegalStateException    if the specified Valve is already associated with a different Container
      */
     public synchronized void addValve(Valve valve) {
 
@@ -1119,9 +1065,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
 
 
     /**
-     * Execute a periodic task, such as reloading, etc. This method will be
-     * invoked inside the classloading context of this container. Unexpected
-     * throwables will be caught and logged.
+     * Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of
+     * this container. Unexpected throwables will be caught and logged.
      */
     @Override
     public void backgroundProcess() {
@@ -1135,8 +1080,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
             try {
                 cluster.backgroundProcess();
             } catch (Exception e) {
-                log.warn(sm.getString("containerBase.backgroundProcess.cluster",
-                        cluster), e);
+                log.warn(sm.getString("containerBase.backgroundProcess.cluster", cluster), e);
             }
         }
         Realm realm = getRealmInternal();
@@ -1185,9 +1129,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
     // ------------------------------------------------------ Protected Methods
 
     /**
-     * Notify all container event listeners that a particular event has
-     * occurred for this Container.  The default implementation performs
-     * this notification synchronously using the calling thread.
+     * Notify all container event listeners that a particular event has occurred for this Container. The default
+     * implementation performs this notification synchronously using the calling thread.
      *
      * @param type Event type
      * @param data Event data
@@ -1207,7 +1150,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
     }
 
 
-    // -------------------- JMX and Registration  --------------------
+    // -------------------- JMX and Registration --------------------
 
     @Override
     protected String getDomainInternal() {
@@ -1236,7 +1179,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
             } else if (c instanceof Context) {
                 keyProperties.insert(0, ",context=");
                 ContextName cn = new ContextName(c.getName(), false);
-                keyProperties.insert(9,cn.getDisplayName());
+                keyProperties.insert(9, cn.getDisplayName());
             } else if (c instanceof Host) {
                 keyProperties.insert(0, ",host=");
                 keyProperties.insert(6, c.getName());
@@ -1272,13 +1215,12 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
     // -------------------- Background Thread --------------------
 
     /**
-     * Start the background thread that will periodically check for
-     * session timeouts.
+     * Start the background thread that will periodically check for session timeouts.
      */
     protected void threadStart() {
-        if (backgroundProcessorDelay > 0
-                && (getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState()))
-                && (backgroundProcessorFuture == null || backgroundProcessorFuture.isDone())) {
+        if (backgroundProcessorDelay > 0 &&
+                (getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) &&
+                (backgroundProcessorFuture == null || backgroundProcessorFuture.isDone())) {
             if (backgroundProcessorFuture != null && backgroundProcessorFuture.isDone()) {
                 // There was an error executing the scheduled task, get it and log it
                 try {
@@ -1288,16 +1230,14 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
                 }
             }
             backgroundProcessorFuture = Container.getService(this).getServer().getUtilityExecutor()
-                    .scheduleWithFixedDelay(new ContainerBackgroundProcessor(),
-                            backgroundProcessorDelay, backgroundProcessorDelay,
-                            TimeUnit.SECONDS);
+                    .scheduleWithFixedDelay(new ContainerBackgroundProcessor(), backgroundProcessorDelay,
+                            backgroundProcessorDelay, TimeUnit.SECONDS);
         }
     }
 
 
     /**
-     * Stop the background thread that is periodically checking for
-     * session timeouts.
+     * Stop the background thread that is periodically checking for session timeouts.
      */
     protected void threadStop() {
         if (backgroundProcessorFuture != null) {
@@ -1334,8 +1274,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
     }
 
     /**
-     * Private runnable class to invoke the backgroundProcess method
-     * of this container and its children after a fixed delay.
+     * Private runnable class to invoke the backgroundProcess method of this container and its children after a fixed
+     * delay.
      */
     protected class ContainerBackgroundProcessor implements Runnable {
 
diff --git a/java/org/apache/catalina/core/DefaultInstanceManager.java b/java/org/apache/catalina/core/DefaultInstanceManager.java
index 931f8a3018..04b3167716 100644
--- a/java/org/apache/catalina/core/DefaultInstanceManager.java
+++ b/java/org/apache/catalina/core/DefaultInstanceManager.java
@@ -58,8 +58,7 @@ import org.apache.tomcat.util.res.StringManager;
 public class DefaultInstanceManager implements InstanceManager {
 
     // Used when there are no annotations in a class
-    private static final AnnotationCacheEntry[] ANNOTATIONS_EMPTY
-        = new AnnotationCacheEntry[0];
+    private static final AnnotationCacheEntry[] ANNOTATIONS_EMPTY = new AnnotationCacheEntry[0];
 
     /**
      * The string manager for this package.
@@ -104,29 +103,23 @@ public class DefaultInstanceManager implements InstanceManager {
     protected final boolean privileged;
     protected final boolean ignoreAnnotations;
     private final Set<String> restrictedClasses;
-    private final ManagedConcurrentWeakHashMap<Class<?>, AnnotationCacheEntry[]> annotationCache =
-            new ManagedConcurrentWeakHashMap<>();
+    private final ManagedConcurrentWeakHashMap<Class<?>, AnnotationCacheEntry[]> annotationCache = new ManagedConcurrentWeakHashMap<>();
     private final Map<String, String> postConstructMethods;
     private final Map<String, String> preDestroyMethods;
 
-    public DefaultInstanceManager(Context context,
-            Map<String, Map<String, String>> injectionMap,
-            org.apache.catalina.Context catalinaContext,
-            ClassLoader containerClassLoader) {
+    public DefaultInstanceManager(Context context, Map<String, Map<String, String>> injectionMap,
+            org.apache.catalina.Context catalinaContext, ClassLoader containerClassLoader) {
         classLoader = catalinaContext.getLoader().getClassLoader();
         privileged = catalinaContext.getPrivileged();
         this.containerClassLoader = containerClassLoader;
         ignoreAnnotations = catalinaContext.getIgnoreAnnotations();
         Log log = catalinaContext.getLogger();
         Set<String> classNames = new HashSet<>();
-        loadProperties(classNames,
-                "org/apache/catalina/core/RestrictedServlets.properties",
+        loadProperties(classNames, "org/apache/catalina/core/RestrictedServlets.properties",
                 "defaultInstanceManager.restrictedServletsResource", log);
-        loadProperties(classNames,
-                "org/apache/catalina/core/RestrictedListeners.properties",
+        loadProperties(classNames, "org/apache/catalina/core/RestrictedListeners.properties",
                 "defaultInstanceManager.restrictedListenersResource", log);
-        loadProperties(classNames,
-                "org/apache/catalina/core/RestrictedFilters.properties",
+        loadProperties(classNames, "org/apache/catalina/core/RestrictedFilters.properties",
                 "defaultInstanceManager.restrictedFiltersResource", log);
         restrictedClasses = Collections.unmodifiableSet(classNames);
         this.context = context;
@@ -136,15 +129,14 @@ public class DefaultInstanceManager implements InstanceManager {
     }
 
     @Override
-    public Object newInstance(Class<?> clazz) throws IllegalAccessException,
-            InvocationTargetException, NamingException, InstantiationException,
-            IllegalArgumentException, NoSuchMethodException, SecurityException {
+    public Object newInstance(Class<?> clazz) throws IllegalAccessException, InvocationTargetException, NamingException,
+            InstantiationException, IllegalArgumentException, NoSuchMethodException, SecurityException {
         return newInstance(clazz.getConstructor().newInstance(), clazz);
     }
 
     @Override
-    public Object newInstance(String className) throws IllegalAccessException,
-            InvocationTargetException, NamingException, InstantiationException,
+    public Object newInstance(String className)
+            throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException,
             ClassNotFoundException, IllegalArgumentException, NoSuchMethodException, SecurityException {
         Class<?> clazz = loadClassMaybePrivileged(className, classLoader);
         return newInstance(clazz.getConstructor().newInstance(), clazz);
@@ -152,16 +144,14 @@ public class DefaultInstanceManager implements InstanceManager {
 
     @Override
     public Object newInstance(final String className, final ClassLoader classLoader)
-            throws IllegalAccessException, NamingException, InvocationTargetException,
-            InstantiationException, ClassNotFoundException, IllegalArgumentException,
-            NoSuchMethodException, SecurityException {
+            throws IllegalAccessException, NamingException, InvocationTargetException, InstantiationException,
+            ClassNotFoundException, IllegalArgumentException, NoSuchMethodException, SecurityException {
         Class<?> clazz = classLoader.loadClass(className);
         return newInstance(clazz.getConstructor().newInstance(), clazz);
     }
 
     @Override
-    public void newInstance(Object o)
-            throws IllegalAccessException, InvocationTargetException, NamingException {
+    public void newInstance(Object o) throws IllegalAccessException, InvocationTargetException, NamingException {
         newInstance(o, o.getClass());
     }
 
@@ -190,22 +180,20 @@ public class DefaultInstanceManager implements InstanceManager {
     }
 
     @Override
-    public void destroyInstance(Object instance) throws IllegalAccessException,
-            InvocationTargetException {
+    public void destroyInstance(Object instance) throws IllegalAccessException, InvocationTargetException {
         if (!ignoreAnnotations) {
             preDestroy(instance, instance.getClass());
         }
     }
 
     /**
-     * Call postConstruct method on the specified instance recursively from
-     * deepest superclass to actual class.
+     * Call postConstruct method on the specified instance recursively from deepest superclass to actual class.
      *
      * @param instance object to call postconstruct methods on
      * @param clazz    (super) class to examine for postConstruct annotation.
-     * @throws IllegalAccessException if postConstruct method is inaccessible.
-     * @throws java.lang.reflect.InvocationTargetException
-     *                                if call fails
+     *
+     * @throws IllegalAccessException                      if postConstruct method is inaccessible.
+     * @throws java.lang.reflect.InvocationTargetException if call fails
      */
     protected void postConstruct(Object instance, final Class<?> clazz)
             throws IllegalAccessException, InvocationTargetException {
@@ -235,14 +223,13 @@ public class DefaultInstanceManager implements InstanceManager {
 
 
     /**
-     * Call preDestroy method on the specified instance recursively from deepest
-     * superclass to actual class.
+     * Call preDestroy method on the specified instance recursively from deepest superclass to actual class.
      *
      * @param instance object to call preDestroy methods on
      * @param clazz    (super) class to examine for preDestroy annotation.
-     * @throws IllegalAccessException if preDestroy method is inaccessible.
-     * @throws java.lang.reflect.InvocationTargetException
-     *                                if call fails
+     *
+     * @throws IllegalAccessException                      if preDestroy method is inaccessible.
+     * @throws java.lang.reflect.InvocationTargetException if call fails
      */
     protected void preDestroy(Object instance, final Class<?> clazz)
             throws IllegalAccessException, InvocationTargetException {
@@ -277,20 +264,17 @@ public class DefaultInstanceManager implements InstanceManager {
 
 
     /**
-     * Make sure that the annotations cache has been populated for the provided
-     * class.
+     * Make sure that the annotations cache has been populated for the provided class.
+     *
+     * @param clazz      clazz to populate annotations for
+     * @param injections map of injections for this class from xml deployment descriptor
      *
-     * @param clazz         clazz to populate annotations for
-     * @param injections    map of injections for this class from xml deployment
-     *                      descriptor
-     * @throws IllegalAccessException       if injection target is inaccessible
-     * @throws javax.naming.NamingException if value cannot be looked up in jndi
-     * @throws java.lang.reflect.InvocationTargetException
-     *                                      if injection fails
+     * @throws IllegalAccessException                      if injection target is inaccessible
+     * @throws javax.naming.NamingException                if value cannot be looked up in jndi
+     * @throws java.lang.reflect.InvocationTargetException if injection fails
      */
-    protected void populateAnnotationsCache(Class<?> clazz,
-            Map<String, String> injections) throws IllegalAccessException,
-            InvocationTargetException, NamingException {
+    protected void populateAnnotationsCache(Class<?> clazz, Map<String, String> injections)
+            throws IllegalAccessException, InvocationTargetException, NamingException {
 
         List<AnnotationCacheEntry> annotations = null;
         Set<String> injectionsMatchedToSetter = new HashSet<>();
@@ -317,11 +301,8 @@ public class DefaultInstanceManager implements InstanceManager {
                             String fieldName = Introspection.getPropertyName(method);
                             injectionsMatchedToSetter.add(fieldName);
                             if (injections.containsKey(fieldName)) {
-                                annotations.add(new AnnotationCacheEntry(
-                                        method.getName(),
-                                        method.getParameterTypes(),
-                                        injections.get(fieldName),
-                                        AnnotationCacheEntryType.SETTER));
+                                annotations.add(new AnnotationCacheEntry(method.getName(), method.getParameterTypes(),
+                                        injections.get(fieldName), AnnotationCacheEntryType.SETTER));
                                 continue;
                             }
                         }
@@ -331,37 +312,23 @@ public class DefaultInstanceManager implements InstanceManager {
                         Annotation persistenceContextAnnotation;
                         Annotation persistenceUnitAnnotation;
                         if ((resourceAnnotation = method.getAnnotation(Resource.class)) != null) {
-                            annotations.add(new AnnotationCacheEntry(
-                                    method.getName(),
-                                    method.getParameterTypes(),
-                                    resourceAnnotation.name(),
-                                    AnnotationCacheEntryType.SETTER));
-                        } else if (EJB_PRESENT &&
-                                (ejbAnnotation = method.getAnnotation(EJB.class)) != null) {
-                            annotations.add(new AnnotationCacheEntry(
-                                    method.getName(),
-                                    method.getParameterTypes(),
-                                    ((EJB) ejbAnnotation).name(),
-                                    AnnotationCacheEntryType.SETTER));
-                        } else if (WS_PRESENT && (webServiceRefAnnotation =
-                                method.getAnnotation(WebServiceRef.class)) != null) {
-                            annotations.add(new AnnotationCacheEntry(
-                                    method.getName(),
-                                    method.getParameterTypes(),
-                                    ((WebServiceRef) webServiceRefAnnotation).name(),
-                                    AnnotationCacheEntryType.SETTER));
-                        } else if (JPA_PRESENT && (persistenceContextAnnotation =
-                                method.getAnnotation(PersistenceContext.class)) != null) {
-                            annotations.add(new AnnotationCacheEntry(
-                                    method.getName(),
-                                    method.getParameterTypes(),
+                            annotations.add(new AnnotationCacheEntry(method.getName(), method.getParameterTypes(),
+                                    resourceAnnotation.name(), AnnotationCacheEntryType.SETTER));
+                        } else if (EJB_PRESENT && (ejbAnnotation = method.getAnnotation(EJB.class)) != null) {
+                            annotations.add(new AnnotationCacheEntry(method.getName(), method.getParameterTypes(),
+                                    ((EJB) ejbAnnotation).name(), AnnotationCacheEntryType.SETTER));
+                        } else if (WS_PRESENT &&
+                                (webServiceRefAnnotation = method.getAnnotation(WebServiceRef.class)) != null) {
+                            annotations.add(new AnnotationCacheEntry(method.getName(), method.getParameterTypes(),
+                                    ((WebServiceRef) webServiceRefAnnotation).name(), AnnotationCacheEntryType.SETTER));
+                        } else if (JPA_PRESENT && (persistenceContextAnnotation = method
+                                .getAnnotation(PersistenceContext.class)) != null) {
+                            annotations.add(new AnnotationCacheEntry(method.getName(), method.getParameterTypes(),
                                     ((PersistenceContext) persistenceContextAnnotation).name(),
                                     AnnotationCacheEntryType.SETTER));
-                        } else if (JPA_PRESENT && (persistenceUnitAnnotation =
-                                method.getAnnotation(PersistenceUnit.class)) != null) {
-                            annotations.add(new AnnotationCacheEntry(
-                                    method.getName(),
-                                    method.getParameterTypes(),
+                        } else if (JPA_PRESENT &&
+                                (persistenceUnitAnnotation = method.getAnnotation(PersistenceUnit.class)) != null) {
+                            annotations.add(new AnnotationCacheEntry(method.getName(), method.getParameterTypes(),
                                     ((PersistenceUnit) persistenceUnitAnnotation).name(),
                                     AnnotationCacheEntryType.SETTER));
                         }
@@ -373,22 +340,18 @@ public class DefaultInstanceManager implements InstanceManager {
                 }
 
                 if (postConstruct != null) {
-                    annotations.add(new AnnotationCacheEntry(
-                            postConstruct.getName(),
-                            postConstruct.getParameterTypes(), null,
-                            AnnotationCacheEntryType.POST_CONSTRUCT));
+                    annotations.add(new AnnotationCacheEntry(postConstruct.getName(), postConstruct.getParameterTypes(),
+                            null, AnnotationCacheEntryType.POST_CONSTRUCT));
                 } else if (postConstructFromXml != null) {
                     throw new IllegalArgumentException(sm.getString("defaultInstanceManager.postConstructNotFound",
-                        postConstructFromXml, clazz.getName()));
+                            postConstructFromXml, clazz.getName()));
                 }
                 if (preDestroy != null) {
-                    annotations.add(new AnnotationCacheEntry(
-                            preDestroy.getName(),
-                            preDestroy.getParameterTypes(), null,
+                    annotations.add(new AnnotationCacheEntry(preDestroy.getName(), preDestroy.getParameterTypes(), null,
                             AnnotationCacheEntryType.PRE_DESTROY));
                 } else if (preDestroyFromXml != null) {
                     throw new IllegalArgumentException(sm.getString("defaultInstanceManager.preDestroyNotFound",
-                        preDestroyFromXml, clazz.getName()));
+                            preDestroyFromXml, clazz.getName()));
                 }
 
                 if (context != null) {
@@ -402,31 +365,27 @@ public class DefaultInstanceManager implements InstanceManager {
                         Annotation persistenceContextAnnotation;
                         Annotation persistenceUnitAnnotation;
                         String fieldName = field.getName();
-                        if (injections != null && injections.containsKey(fieldName) && !injectionsMatchedToSetter.contains(fieldName)) {
-                            annotations.add(new AnnotationCacheEntry(
-                                    fieldName, null,
-                                    injections.get(fieldName),
+                        if (injections != null && injections.containsKey(fieldName) &&
+                                !injectionsMatchedToSetter.contains(fieldName)) {
+                            annotations.add(new AnnotationCacheEntry(fieldName, null, injections.get(fieldName),
                                     AnnotationCacheEntryType.FIELD));
-                        } else if ((resourceAnnotation =
-                                field.getAnnotation(Resource.class)) != null) {
-                            annotations.add(new AnnotationCacheEntry(fieldName, null,
-                                    resourceAnnotation.name(), AnnotationCacheEntryType.FIELD));
-                        } else if (EJB_PRESENT &&
-                                (ejbAnnotation = field.getAnnotation(EJB.class)) != null) {
-                            annotations.add(new AnnotationCacheEntry(fieldName, null,
-                                    ((EJB) ejbAnnotation).name(), AnnotationCacheEntryType.FIELD));
-                        } else if (WS_PRESENT && (webServiceRefAnnotation =
-                                field.getAnnotation(WebServiceRef.class)) != null) {
-                            annotations.add(new AnnotationCacheEntry(fieldName, null,
-                                    ((WebServiceRef) webServiceRefAnnotation).name(),
+                        } else if ((resourceAnnotation = field.getAnnotation(Resource.class)) != null) {
+                            annotations.add(new AnnotationCacheEntry(fieldName, null, resourceAnnotation.name(),
+                                    AnnotationCacheEntryType.FIELD));
+                        } else if (EJB_PRESENT && (ejbAnnotation = field.getAnnotation(EJB.class)) != null) {
+                            annotations.add(new AnnotationCacheEntry(fieldName, null, ((EJB) ejbAnnotation).name(),
                                     AnnotationCacheEntryType.FIELD));
-                        } else if (JPA_PRESENT && (persistenceContextAnnotation =
-                                field.getAnnotation(PersistenceContext.class)) != null) {
+                        } else if (WS_PRESENT &&
+                                (webServiceRefAnnotation = field.getAnnotation(WebServiceRef.class)) != null) {
+                            annotations.add(new AnnotationCacheEntry(fieldName, null,
+                                    ((WebServiceRef) webServiceRefAnnotation).name(), AnnotationCacheEntryType.FIELD));
+                        } else if (JPA_PRESENT && (persistenceContextAnnotation = field
+                                .getAnnotation(PersistenceContext.class)) != null) {
                             annotations.add(new AnnotationCacheEntry(fieldName, null,
                                     ((PersistenceContext) persistenceContextAnnotation).name(),
                                     AnnotationCacheEntryType.FIELD));
-                        } else if (JPA_PRESENT && (persistenceUnitAnnotation =
-                                field.getAnnotation(PersistenceUnit.class)) != null) {
+                        } else if (JPA_PRESENT &&
+                                (persistenceUnitAnnotation = field.getAnnotation(PersistenceUnit.class)) != null) {
                             annotations.add(new AnnotationCacheEntry(fieldName, null,
                                     ((PersistenceUnit) persistenceUnitAnnotation).name(),
                                     AnnotationCacheEntryType.FIELD));
@@ -454,10 +413,10 @@ public class DefaultInstanceManager implements InstanceManager {
      *
      * @param instance   instance to inject into
      * @param injections map of injections for this class from xml deployment descriptor
-     * @throws IllegalAccessException       if injection target is inaccessible
-     * @throws javax.naming.NamingException if value cannot be looked up in jndi
-     * @throws java.lang.reflect.InvocationTargetException
-     *                                      if injection fails
+     *
+     * @throws IllegalAccessException                      if injection target is inaccessible
+     * @throws javax.naming.NamingException                if value cannot be looked up in jndi
+     * @throws java.lang.reflect.InvocationTargetException if injection fails
      */
     protected void processAnnotations(Object instance, Map<String, String> injections)
             throws IllegalAccessException, InvocationTargetException, NamingException {
@@ -473,13 +432,9 @@ public class DefaultInstanceManager implements InstanceManager {
             AnnotationCacheEntry[] annotations = annotationCache.get(clazz);
             for (AnnotationCacheEntry entry : annotations) {
                 if (entry.getType() == AnnotationCacheEntryType.SETTER) {
-                    lookupMethodResource(context, instance,
-                            getMethod(clazz, entry),
-                            entry.getName(), clazz);
+                    lookupMethodResource(context, instance, getMethod(clazz, entry), entry.getName(), clazz);
                 } else if (entry.getType() == AnnotationCacheEntryType.FIELD) {
-                    lookupFieldResource(context, instance,
-                            getField(clazz, entry),
-                            entry.getName(), clazz);
+                    lookupFieldResource(context, instance, getField(clazz, entry), entry.getName(), clazz);
                 }
             }
             clazz = clazz.getSuperclass();
@@ -497,13 +452,12 @@ public class DefaultInstanceManager implements InstanceManager {
     }
 
 
-    protected Class<?> loadClassMaybePrivileged(final String className,
-            final ClassLoader classLoader) throws ClassNotFoundException {
+    protected Class<?> loadClassMaybePrivileged(final String className, final ClassLoader classLoader)
+            throws ClassNotFoundException {
         Class<?> clazz;
         if (SecurityUtil.isPackageProtectionEnabled()) {
             try {
-                clazz = AccessController.doPrivileged(
-                        new PrivilegedLoadClass(className, classLoader));
+                clazz = AccessController.doPrivileged(new PrivilegedLoadClass(className, classLoader));
             } catch (PrivilegedActionException e) {
                 Throwable t = e.getCause();
                 if (t instanceof ClassNotFoundException) {
@@ -518,8 +472,7 @@ public class DefaultInstanceManager implements InstanceManager {
         return clazz;
     }
 
-    protected Class<?> loadClass(String className, ClassLoader classLoader)
-            throws ClassNotFoundException {
+    protected Class<?> loadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
         if (className.startsWith("org.apache.catalina")) {
             return containerClassLoader.loadClass(className);
         }
@@ -539,13 +492,11 @@ public class DefaultInstanceManager implements InstanceManager {
             return;
         }
         if (ContainerServlet.class.isAssignableFrom(clazz)) {
-            throw new SecurityException(sm.getString(
-                    "defaultInstanceManager.restrictedContainerServlet", clazz));
+            throw new SecurityException(sm.getString("defaultInstanceManager.restrictedContainerServlet", clazz));
         }
         while (clazz != null) {
             if (restrictedClasses.contains(clazz.getName())) {
-                throw new SecurityException(sm.getString(
-                        "defaultInstanceManager.restrictedClass", clazz));
+                throw new SecurityException(sm.getString("defaultInstanceManager.restrictedClass", clazz));
             }
             clazz = clazz.getSuperclass();
         }
@@ -559,12 +510,12 @@ public class DefaultInstanceManager implements InstanceManager {
      * @param field    field target for injection
      * @param name     jndi name value is bound under
      * @param clazz    class annotation is defined in
+     *
      * @throws IllegalAccessException       if field is inaccessible
      * @throws javax.naming.NamingException if value is not accessible in naming context
      */
-    protected static void lookupFieldResource(Context context,
-            Object instance, Field field, String name, Class<?> clazz)
-            throws NamingException, IllegalAccessException {
+    protected static void lookupFieldResource(Context context, Object instance, Field field, String name,
+            Class<?> clazz) throws NamingException, IllegalAccessException {
 
         Object lookedupResource;
 
@@ -573,8 +524,7 @@ public class DefaultInstanceManager implements InstanceManager {
         if ((normalizedName != null) && (normalizedName.length() > 0)) {
             lookedupResource = context.lookup(normalizedName);
         } else {
-            lookedupResource =
-                context.lookup(clazz.getName() + "/" + field.getName());
+            lookedupResource = context.lookup(clazz.getName() + "/" + field.getName());
         }
 
         // This will always be a new Field instance
@@ -591,18 +541,16 @@ public class DefaultInstanceManager implements InstanceManager {
      * @param method   field target for injection
      * @param name     jndi name value is bound under
      * @param clazz    class annotation is defined in
-     * @throws IllegalAccessException       if method is inaccessible
-     * @throws javax.naming.NamingException if value is not accessible in naming context
-     * @throws java.lang.reflect.InvocationTargetException
-     *                                      if setter call fails
+     *
+     * @throws IllegalAccessException                      if method is inaccessible
+     * @throws javax.naming.NamingException                if value is not accessible in naming context
+     * @throws java.lang.reflect.InvocationTargetException if setter call fails
      */
-    protected static void lookupMethodResource(Context context,
-            Object instance, Method method, String name, Class<?> clazz)
-            throws NamingException, IllegalAccessException, InvocationTargetException {
+    protected static void lookupMethodResource(Context context, Object instance, Method method, String name,
+            Class<?> clazz) throws NamingException, IllegalAccessException, InvocationTargetException {
 
         if (!Introspection.isValidSetter(method)) {
-            throw new IllegalArgumentException(
-                    sm.getString("defaultInstanceManager.invalidInjection"));
+            throw new IllegalArgumentException(sm.getString("defaultInstanceManager.invalidInjection"));
         }
 
         Object lookedupResource;
@@ -612,8 +560,7 @@ public class DefaultInstanceManager implements InstanceManager {
         if ((normalizedName != null) && (normalizedName.length() > 0)) {
             lookedupResource = context.lookup(normalizedName);
         } else {
-            lookedupResource = context.lookup(
-                    clazz.getName() + "/" + Introspection.getPropertyName(method));
+            lookedupResource = context.lookup(clazz.getName() + "/" + Introspection.getPropertyName(method));
         }
 
         // This will always be a new Method instance
@@ -622,8 +569,7 @@ public class DefaultInstanceManager implements InstanceManager {
         method.invoke(instance, lookedupResource);
     }
 
-    private static void loadProperties(Set<String> classNames, String resourceName,
-            String messageKey, Log log) {
+    private static void loadProperties(Set<String> classNames, String resourceName, String messageKey, Log log) {
         Properties properties = new Properties();
         ClassLoader cl = DefaultInstanceManager.class.getClassLoader();
         try (InputStream is = cl.getResourceAsStream(resourceName)) {
@@ -642,29 +588,26 @@ public class DefaultInstanceManager implements InstanceManager {
             if ("restricted".equals(e.getValue())) {
                 classNames.add(e.getKey().toString());
             } else {
-                log.warn(sm.getString(
-                        "defaultInstanceManager.restrictedWrongValue",
-                        resourceName, e.getKey(), e.getValue()));
+                log.warn(sm.getString("defaultInstanceManager.restrictedWrongValue", resourceName, e.getKey(),
+                        e.getValue()));
             }
         }
     }
 
-    private static String normalize(String jndiName){
-        if(jndiName != null && jndiName.startsWith("java:comp/env/")){
+    private static String normalize(String jndiName) {
+        if (jndiName != null && jndiName.startsWith("java:comp/env/")) {
             return jndiName.substring(14);
         }
         return jndiName;
     }
 
-    private static Method getMethod(final Class<?> clazz,
-            final AnnotationCacheEntry entry) {
+    private static Method getMethod(final Class<?> clazz, final AnnotationCacheEntry entry) {
         Method result = null;
         if (Globals.IS_SECURITY_ENABLED) {
             result = AccessController.doPrivileged(new PrivilegedGetMethod(clazz, entry));
         } else {
             try {
-                result = clazz.getDeclaredMethod(
-                        entry.getAccessibleObjectName(), entry.getParamTypes());
+                result = clazz.getDeclaredMethod(entry.getAccessibleObjectName(), entry.getParamTypes());
             } catch (NoSuchMethodException e) {
                 // Should never happen. On that basis don't log it.
             }
@@ -672,8 +615,7 @@ public class DefaultInstanceManager implements InstanceManager {
         return result;
     }
 
-    private static Field getField(final Class<?> clazz,
-            final AnnotationCacheEntry entry) {
+    private static Field getField(final Class<?> clazz, final AnnotationCacheEntry entry) {
         Field result = null;
         if (Globals.IS_SECURITY_ENABLED) {
             result = AccessController.doPrivileged(new PrivilegedGetField(clazz, entry));
@@ -688,20 +630,15 @@ public class DefaultInstanceManager implements InstanceManager {
     }
 
 
-    private static Method findPostConstruct(Method currentPostConstruct,
-            String postConstructFromXml, Method method) {
-        return findLifecycleCallback(currentPostConstruct,
-            postConstructFromXml, method, PostConstruct.class);
+    private static Method findPostConstruct(Method currentPostConstruct, String postConstructFromXml, Method method) {
+        return findLifecycleCallback(currentPostConstruct, postConstructFromXml, method, PostConstruct.class);
     }
 
-    private static Method findPreDestroy(Method currentPreDestroy,
-        String preDestroyFromXml, Method method) {
-        return findLifecycleCallback(currentPreDestroy,
-            preDestroyFromXml, method, PreDestroy.class);
+    private static Method findPreDestroy(Method currentPreDestroy, String preDestroyFromXml, Method method) {
+        return findLifecycleCallback(currentPreDestroy, preDestroyFromXml, method, PreDestroy.class);
     }
 
-    private static Method findLifecycleCallback(Method currentMethod,
-            String methodNameFromXml, Method method,
+    private static Method findLifecycleCallback(Method currentMethod, String methodNameFromXml, Method method,
             Class<? extends Annotation> annotation) {
         Method result = currentMethod;
         if (methodNameFromXml != null) {
@@ -730,8 +667,7 @@ public class DefaultInstanceManager implements InstanceManager {
         private final String name;
         private final AnnotationCacheEntryType type;
 
-        public AnnotationCacheEntry(String accessibleObjectName,
-                Class<?>[] paramTypes, String name,
+        public AnnotationCacheEntry(String accessibleObjectName, Class<?>[] paramTypes, String name,
                 AnnotationCacheEntryType type) {
             this.accessibleObjectName = accessibleObjectName;
             this.paramTypes = paramTypes;
@@ -750,6 +686,7 @@ public class DefaultInstanceManager implements InstanceManager {
         public String getName() {
             return name;
         }
+
         public AnnotationCacheEntryType getType() {
             return type;
         }
@@ -798,8 +735,7 @@ public class DefaultInstanceManager implements InstanceManager {
         public Method run() {
             Method result = null;
             try {
-                result = clazz.getDeclaredMethod(
-                        entry.getAccessibleObjectName(), entry.getParamTypes());
+                result = clazz.getDeclaredMethod(entry.getAccessibleObjectName(), entry.getParamTypes());
             } catch (NoSuchMethodException e) {
                 // Should never happen. On that basis don't log it.
             }
diff --git a/java/org/apache/catalina/core/FrameworkListener.java b/java/org/apache/catalina/core/FrameworkListener.java
index 4b637fa668..3796390190 100644
--- a/java/org/apache/catalina/core/FrameworkListener.java
+++ b/java/org/apache/catalina/core/FrameworkListener.java
@@ -31,18 +31,18 @@ import org.apache.catalina.Server;
 import org.apache.catalina.Service;
 
 /**
- * This listener must be declared in server.xml as a Server listener, possibly optional.
- * It will register a lifecycle listener on all contexts. This is an alternative to
- * adding a Listener in context.xml with more flexibility.
+ * This listener must be declared in server.xml as a Server listener, possibly optional. It will register a lifecycle
+ * listener on all contexts. This is an alternative to adding a Listener in context.xml with more flexibility.
  */
 public abstract class FrameworkListener implements LifecycleListener, ContainerListener {
 
-    protected final ConcurrentHashMap<Context, LifecycleListener> contextListeners =
-            new ConcurrentHashMap<>();
+    protected final ConcurrentHashMap<Context, LifecycleListener> contextListeners = new ConcurrentHashMap<>();
 
     /**
      * Create a lifecycle listener which will then be added to the specified context.
+     *
      * @param context the associated Context
+     *
      * @return the lifecycle listener
      */
     protected abstract LifecycleListener createLifecycleListener(Context context);
@@ -50,8 +50,7 @@ public abstract class FrameworkListener implements LifecycleListener, ContainerL
     @Override
     public void lifecycleEvent(LifecycleEvent event) {
         Lifecycle lifecycle = event.getLifecycle();
-        if (Lifecycle.BEFORE_START_EVENT.equals(event.getType()) &&
-                lifecycle instanceof Server) {
+        if (Lifecycle.BEFORE_START_EVENT.equals(event.getType()) && lifecycle instanceof Server) {
             Server server = (Server) lifecycle;
             registerListenersForServer(server);
         }
diff --git a/java/org/apache/catalina/core/JniLifecycleListener.java b/java/org/apache/catalina/core/JniLifecycleListener.java
index 8e129da164..d1f3e797e0 100644
--- a/java/org/apache/catalina/core/JniLifecycleListener.java
+++ b/java/org/apache/catalina/core/JniLifecycleListener.java
@@ -26,14 +26,12 @@ import org.apache.tomcat.util.res.StringManager;
 /**
  * An implementation of LifeCycleListener that loads a native library into the JVM.
  * <p>
- * Native libraries are associated with the class loader of the class that loaded them,
- * and the same library may not be loaded by more than one class loader. Due to that
- * restriction, loading a native library from a Webapp's class loader makes it impossible
- * for other Webapps to load the native library.
+ * Native libraries are associated with the class loader of the class that loaded them, and the same library may not be
+ * loaded by more than one class loader. Due to that restriction, loading a native library from a Webapp's class loader
+ * makes it impossible for other Webapps to load the native library.
  * <p>
- * Loading the native library using this listener solves the issue as it is loaded
- * by a shared class loader (typically the Common class loader, but may vary in some
- * configurations).
+ * Loading the native library using this listener solves the issue as it is loaded by a shared class loader (typically
+ * the Common class loader, but may vary in some configurations).
  */
 public class JniLifecycleListener implements LifecycleListener {
 
diff --git a/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java b/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
index b8e0f22191..86430e8c06 100644
--- a/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
+++ b/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
@@ -44,18 +44,14 @@ import org.w3c.dom.Document;
 import org.w3c.dom.ls.DOMImplementationLS;
 
 /**
- * Provide a workaround for known places where the Java Runtime environment can
- * cause a memory leak or lock files.
+ * Provide a workaround for known places where the Java Runtime environment can cause a memory leak or lock files.
  * <p>
- * Memory leaks occur when JRE code uses
- * the context class loader to load a singleton as this will cause a memory leak
- * if a web application class loader happens to be the context class loader at
- * the time. The work-around is to initialise these singletons when Tomcat's
- * common class loader is the context class loader.
+ * Memory leaks occur when JRE code uses the context class loader to load a singleton as this will cause a memory leak
+ * if a web application class loader happens to be the context class loader at the time. The work-around is to
+ * initialise these singletons when Tomcat's common class loader is the context class loader.
  * <p>
- * Locked files usually occur when a resource inside a JAR is accessed without
- * first disabling Jar URL connection caching. The workaround is to disable this
- * caching by default.
+ * Locked files usually occur when a resource inside a JAR is accessed without first disabling Jar URL connection
+ * caching. The workaround is to disable this caching by default.
  * <p>
  * This listener must only be nested within {@link Server} elements.
  */
@@ -64,141 +60,158 @@ public class JreMemoryLeakPreventionListener implements LifecycleListener {
     private static final Log log = LogFactory.getLog(JreMemoryLeakPreventionListener.class);
     private static final StringManager sm = StringManager.getManager(JreMemoryLeakPreventionListener.class);
 
-    private static final String FORK_JOIN_POOL_THREAD_FACTORY_PROPERTY =
-            "java.util.concurrent.ForkJoinPool.common.threadFactory";
+    private static final String FORK_JOIN_POOL_THREAD_FACTORY_PROPERTY = "java.util.concurrent.ForkJoinPool.common.threadFactory";
     /**
-     * Protect against the memory leak caused when the first call to
-     * <code>sun.awt.AppContext.getAppContext()</code> is triggered by a web
-     * application. Defaults to <code>false</code> since Tomcat code no longer
-     * triggers this although application code may.
+     * Protect against the memory leak caused when the first call to <code>sun.awt.AppContext.getAppContext()</code> is
+     * triggered by a web application. Defaults to <code>false</code> since Tomcat code no longer triggers this although
+     * application code may.
      */
     private boolean appContextProtection = false;
-    public boolean isAppContextProtection() { return appContextProtection; }
+
+    public boolean isAppContextProtection() {
+        return appContextProtection;
+    }
+
     public void setAppContextProtection(boolean appContextProtection) {
         this.appContextProtection = appContextProtection;
     }
 
     /**
-     * Protect against the memory leak caused when the first call to
-     * <code>java.awt.Toolkit.getDefaultToolkit()</code> is triggered
-     * by a web application. Defaults to <code>false</code> because a new
-     * Thread is launched.
+     * Protect against the memory leak caused when the first call to <code>java.awt.Toolkit.getDefaultToolkit()</code>
+     * is triggered by a web application. Defaults to <code>false</code> because a new Thread is launched.
      */
     private boolean awtThreadProtection = false;
-    public boolean isAWTThreadProtection() { return awtThreadProtection; }
+
+    public boolean isAWTThreadProtection() {
+        return awtThreadProtection;
+    }
+
     public void setAWTThreadProtection(boolean awtThreadProtection) {
-      this.awtThreadProtection = awtThreadProtection;
+        this.awtThreadProtection = awtThreadProtection;
     }
 
     /**
-     * Protect against the memory leak caused when the first call to
-     * <code>sun.misc.GC.requestLatency(long)</code> is triggered by a web
-     * application. This first call will start a GC Daemon thread with the
-     * thread's context class loader configured to be the web application class
-     * loader. Defaults to <code>true</code>.
+     * Protect against the memory leak caused when the first call to <code>sun.misc.GC.requestLatency(long)</code> is
+     * triggered by a web application. This first call will start a GC Daemon thread with the thread's context class
+     * loader configured to be the web application class loader. Defaults to <code>true</code>.
      *
      * @see "http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8157570"
      */
     private boolean gcDaemonProtection = true;
-    public boolean isGcDaemonProtection() { return gcDaemonProtection; }
+
+    public boolean isGcDaemonProtection() {
+        return gcDaemonProtection;
+    }
+
     public void setGcDaemonProtection(boolean gcDaemonProtection) {
         this.gcDaemonProtection = gcDaemonProtection;
     }
 
-     /**
-     * Protect against the memory leak, when the initialization of the
-     * Java Cryptography Architecture is triggered by initializing
-     * a MessageDigest during web application deployment.
-     * This will occasionally start a Token Poller thread with the thread's
-     * context class loader equal to the web application class loader.
-     * Instead we initialize JCA early.
-     * Defaults to <code>true</code>.
+    /**
+     * Protect against the memory leak, when the initialization of the Java Cryptography Architecture is triggered by
+     * initializing a MessageDigest during web application deployment. This will occasionally start a Token Poller
+     * thread with the thread's context class loader equal to the web application class loader. Instead we initialize
+     * JCA early. Defaults to <code>true</code>.
      */
     private boolean tokenPollerProtection = true;
-    public boolean isTokenPollerProtection() { return tokenPollerProtection; }
+
+    public boolean isTokenPollerProtection() {
+        return tokenPollerProtection;
+    }
+
     public void setTokenPollerProtection(boolean tokenPollerProtection) {
         this.tokenPollerProtection = tokenPollerProtection;
     }
 
     /**
-     * Protect against resources being read for JAR files and, as a side-effect,
-     * the JAR file becoming locked. Note this disables caching for all
-     * {@link URLConnection}s, regardless of type. Defaults to
-     * <code>true</code>.
+     * Protect against resources being read for JAR files and, as a side-effect, the JAR file becoming locked. Note this
+     * disables caching for all {@link URLConnection}s, regardless of type. Defaults to <code>true</code>.
      */
     private boolean urlCacheProtection = true;
-    public boolean isUrlCacheProtection() { return urlCacheProtection; }
+
+    public boolean isUrlCacheProtection() {
+        return urlCacheProtection;
+    }
+
     public void setUrlCacheProtection(boolean urlCacheProtection) {
         this.urlCacheProtection = urlCacheProtection;
     }
 
     /**
-     * XML parsing can pin a web application class loader in memory. There are
-     * multiple root causes for this. Some of these are particularly nasty as
-     * profilers may not identify any GC roots related to the leak. For example,
-     * with YourKit you need to ensure that HPROF format memory snapshots are
-     * used to be able to trace some of the leaks.
+     * XML parsing can pin a web application class loader in memory. There are multiple root causes for this. Some of
+     * these are particularly nasty as profilers may not identify any GC roots related to the leak. For example, with
+     * YourKit you need to ensure that HPROF format memory snapshots are used to be able to trace some of the leaks.
      */
     private boolean xmlParsingProtection = true;
-    public boolean isXmlParsingProtection() { return xmlParsingProtection; }
+
+    public boolean isXmlParsingProtection() {
+        return xmlParsingProtection;
+    }
+
     public void setXmlParsingProtection(boolean xmlParsingProtection) {
         this.xmlParsingProtection = xmlParsingProtection;
     }
 
     /**
-     * <code>com.sun.jndi.ldap.LdapPoolManager</code> class spawns a thread when
-     * it is initialized if the system property
-     * <code>com.sun.jndi.ldap.connect.pool.timeout</code> is greater than 0.
-     * That thread inherits the context class loader of the current thread, so
-     * that there may be a web application class loader leak if the web app
-     * is the first to use <code>LdapPoolManager</code>.
+     * <code>com.sun.jndi.ldap.LdapPoolManager</code> class spawns a thread when it is initialized if the system
+     * property <code>com.sun.jndi.ldap.connect.pool.timeout</code> is greater than 0. That thread inherits the context
+     * class loader of the current thread, so that there may be a web application class loader leak if the web app is
+     * the first to use <code>LdapPoolManager</code>.
      *
      * @see "http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8156824"
      */
     private boolean ldapPoolProtection = true;
-    public boolean isLdapPoolProtection() { return ldapPoolProtection; }
+
+    public boolean isLdapPoolProtection() {
+        return ldapPoolProtection;
+    }
+
     public void setLdapPoolProtection(boolean ldapPoolProtection) {
         this.ldapPoolProtection = ldapPoolProtection;
     }
 
     /**
-     * The first access to {@link DriverManager} will trigger the loading of
-     * all {@link java.sql.Driver}s in the the current class loader. The web
-     * application level memory leak protection can take care of this in most
-     * cases but triggering the loading here has fewer side-effects.
+     * The first access to {@link DriverManager} will trigger the loading of all {@link java.sql.Driver}s in the the
+     * current class loader. The web application level memory leak protection can take care of this in most cases but
+     * triggering the loading here has fewer side-effects.
      */
     private boolean driverManagerProtection = true;
+
     public boolean isDriverManagerProtection() {
         return driverManagerProtection;
     }
+
     public void setDriverManagerProtection(boolean driverManagerProtection) {
         this.driverManagerProtection = driverManagerProtection;
     }
 
     /**
-     * {@link ForkJoinPool#commonPool()} creates a thread pool that, by default,
-     * creates threads that retain references to the thread context class
-     * loader.
+     * {@link ForkJoinPool#commonPool()} creates a thread pool that, by default, creates threads that retain references
+     * to the thread context class loader.
      *
      * @see "http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8172726"
      */
     private boolean forkJoinCommonPoolProtection = true;
+
     public boolean getForkJoinCommonPoolProtection() {
         return forkJoinCommonPoolProtection;
     }
+
     public void setForkJoinCommonPoolProtection(boolean forkJoinCommonPoolProtection) {
         this.forkJoinCommonPoolProtection = forkJoinCommonPoolProtection;
     }
 
     /**
-     * List of comma-separated fully qualified class names to load and initialize during
-     * the startup of this Listener. This allows to pre-load classes that are known to
-     * provoke classloader leaks if they are loaded during a request processing.
+     * List of comma-separated fully qualified class names to load and initialize during the startup of this Listener.
+     * This allows to pre-load classes that are known to provoke classloader leaks if they are loaded during a request
+     * processing.
      */
     private String classesToInitialize = null;
+
     public String getClassesToInitialize() {
         return classesToInitialize;
     }
+
     public void setClassesToInitialize(String classesToInitialize) {
         this.classesToInitialize = classesToInitialize;
     }
@@ -209,20 +222,16 @@ public class JreMemoryLeakPreventionListener implements LifecycleListener {
         // Initialise these classes when Tomcat starts
         if (Lifecycle.BEFORE_INIT_EVENT.equals(event.getType())) {
             if (!(event.getLifecycle() instanceof Server)) {
-                log.warn(sm.getString("listener.notServer",
-                        event.getLifecycle().getClass().getSimpleName()));
+                log.warn(sm.getString("listener.notServer", event.getLifecycle().getClass().getSimpleName()));
             }
 
             /*
-             * First call to this loads all drivers visible to the current class
-             * loader and its parents.
+             * First call to this loads all drivers visible to the current class loader and its parents.
              *
-             * Note: This is called before the context class loader is changed
-             *       because we want any drivers located in CATALINA_HOME/lib
-             *       and/or CATALINA_HOME/lib to be visible to DriverManager.
-             *       Users wishing to avoid having JDBC drivers loaded by this
-             *       class loader should add the JDBC driver(s) to the class
-             *       path so they are loaded by the system class loader.
+             * Note: This is called before the context class loader is changed because we want any drivers located in
+             * CATALINA_HOME/lib and/or CATALINA_HOME/lib to be visible to DriverManager. Users wishing to avoid having
+             * JDBC drivers loaded by this class loader should add the JDBC driver(s) to the class path so they are
+             * loaded by the system class loader.
              */
             if (driverManagerProtection) {
                 DriverManager.getDrivers();
@@ -233,22 +242,16 @@ public class JreMemoryLeakPreventionListener implements LifecycleListener {
             try {
                 // Use the system classloader as the victim for all this
                 // ClassLoader pinning we're about to do.
-                Thread.currentThread().setContextClassLoader(
-                        ClassLoader.getSystemClassLoader());
+                Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());
 
                 /*
-                 * Several components end up calling:
-                 * sun.awt.AppContext.getAppContext()
+                 * Several components end up calling: sun.awt.AppContext.getAppContext()
                  *
-                 * Those libraries / components known to trigger memory leaks
-                 * due to eventual calls to getAppContext() are:
-                 * - Google Web Toolkit via its use of javax.imageio
-                 * - Batik
-                 * - others TBD
+                 * Those libraries / components known to trigger memory leaks due to eventual calls to getAppContext()
+                 * are: - Google Web Toolkit via its use of javax.imageio - Batik - others TBD
                  *
-                 * Note that a call to sun.awt.AppContext.getAppContext() results
-                 * in a thread being started named AWT-AppKit that requires a
-                 * graphical environment to be available.
+                 * Note that a call to sun.awt.AppContext.getAppContext() results in a thread being started named
+                 * AWT-AppKit that requires a graphical environment to be available.
                  */
 
                 // Trigger a call to sun.awt.AppContext.getAppContext(). This
@@ -266,50 +269,40 @@ public class JreMemoryLeakPreventionListener implements LifecycleListener {
                 }
 
                 /*
-                 * Several components end up calling
-                 * sun.misc.GC.requestLatency(long) which creates a daemon
-                 * thread without setting the TCCL.
+                 * Several components end up calling sun.misc.GC.requestLatency(long) which creates a daemon thread
+                 * without setting the TCCL.
                  *
-                 * Those libraries / components known to trigger memory leaks
-                 * due to eventual calls to requestLatency(long) are:
-                 * - javax.management.remote.rmi.RMIConnectorServer.start()
+                 * Those libraries / components known to trigger memory leaks due to eventual calls to
+                 * requestLatency(long) are: - javax.management.remote.rmi.RMIConnectorServer.start()
                  *
-                 * Note: Long.MAX_VALUE is a special case that causes the thread
-                 *       to terminate
+                 * Note: Long.MAX_VALUE is a special case that causes the thread to terminate
                  *
                  * Fixed in Java 9 onwards (from early access build 130)
                  */
                 if (gcDaemonProtection && !JreCompat.isJre9Available()) {
                     try {
                         Class<?> clazz = Class.forName("sun.misc.GC");
-                        Method method = clazz.getDeclaredMethod(
-                                "requestLatency",
-                                new Class[] {long.class});
+                        Method method = clazz.getDeclaredMethod("requestLatency", new Class[] { long.class });
                         method.invoke(null, Long.valueOf(Long.MAX_VALUE - 1));
                     } catch (ClassNotFoundException e) {
                         if (JreVendor.IS_ORACLE_JVM) {
-                            log.error(sm.getString(
-                                    "jreLeakListener.gcDaemonFail"), e);
+                            log.error(sm.getString("jreLeakListener.gcDaemonFail"), e);
                         } else {
-                            log.debug(sm.getString(
-                                    "jreLeakListener.gcDaemonFail"), e);
+                            log.debug(sm.getString("jreLeakListener.gcDaemonFail"), e);
                         }
-                    } catch (SecurityException | NoSuchMethodException | IllegalArgumentException |
-                            IllegalAccessException e) {
-                        log.error(sm.getString("jreLeakListener.gcDaemonFail"),
-                                e);
+                    } catch (SecurityException | NoSuchMethodException | IllegalArgumentException
+                            | IllegalAccessException e) {
+                        log.error(sm.getString("jreLeakListener.gcDaemonFail"), e);
                     } catch (InvocationTargetException e) {
                         ExceptionUtils.handleThrowable(e.getCause());
-                        log.error(sm.getString("jreLeakListener.gcDaemonFail"),
-                                e);
+                        log.error(sm.getString("jreLeakListener.gcDaemonFail"), e);
                     }
                 }
 
                 /*
-                 * Creating a MessageDigest during web application startup
-                 * initializes the Java Cryptography Architecture. Under certain
-                 * conditions this starts a Token poller thread with TCCL equal
-                 * to the web application class loader.
+                 * Creating a MessageDigest during web application startup initializes the Java Cryptography
+                 * Architecture. Under certain conditions this starts a Token poller thread with TCCL equal to the web
+                 * application class loader.
                  *
                  * Instead we initialize JCA right now.
                  *
@@ -320,20 +313,17 @@ public class JreMemoryLeakPreventionListener implements LifecycleListener {
                 }
 
                 /*
-                 * Several components end up opening JarURLConnections without
-                 * first disabling caching. This effectively locks the file.
-                 * Whilst more noticeable and harder to ignore on Windows, it
-                 * affects all operating systems.
+                 * Several components end up opening JarURLConnections without first disabling caching. This effectively
+                 * locks the file. Whilst more noticeable and harder to ignore on Windows, it affects all operating
+                 * systems.
                  *
-                 * Those libraries/components known to trigger this issue
-                 * include:
-                 * - log4j versions 1.2.15 and earlier
-                 * - javax.xml.bind.JAXBContext.newInstance()
+                 * Those libraries/components known to trigger this issue include: - log4j versions 1.2.15 and earlier -
+                 * javax.xml.bind.JAXBContext.newInstance()
                  *
                  * https://bugs.openjdk.java.net/browse/JDK-8163449
                  *
-                 * Java 9 onwards disables caching for JAR URLConnections
-                 * Java 8 and earlier disables caching for all URLConnections
+                 * Java 9 onwards disables caching for JAR URLConnections Java 8 and earlier disables caching for all
+                 * URLConnections
                  */
 
                 // Set the default URL caching policy to not to cache
@@ -363,15 +353,13 @@ public class JreMemoryLeakPreventionListener implements LifecycleListener {
                         // com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl
                         Document document = documentBuilder.newDocument();
                         document.createElement("dummy");
-                        DOMImplementationLS implementation =
-                                (DOMImplementationLS)document.getImplementation();
+                        DOMImplementationLS implementation = (DOMImplementationLS) document.getImplementation();
                         implementation.createLSSerializer().writeToString(document);
                         // Issue 1
                         // com.sun.org.apache.xerces.internal.dom.DOMNormalizer
                         document.normalize();
                     } catch (ParserConfigurationException e) {
-                        log.error(sm.getString("jreLeakListener.xmlParseFail"),
-                                e);
+                        log.error(sm.getString("jreLeakListener.xmlParseFail"), e);
                     }
                 }
 
@@ -383,18 +371,15 @@ public class JreMemoryLeakPreventionListener implements LifecycleListener {
                         Class.forName("com.sun.jndi.ldap.LdapPoolManager");
                     } catch (ClassNotFoundException e) {
                         if (JreVendor.IS_ORACLE_JVM) {
-                            log.error(sm.getString(
-                                    "jreLeakListener.ldapPoolManagerFail"), e);
+                            log.error(sm.getString("jreLeakListener.ldapPoolManagerFail"), e);
                         } else {
-                            log.debug(sm.getString(
-                                    "jreLeakListener.ldapPoolManagerFail"), e);
+                            log.debug(sm.getString("jreLeakListener.ldapPoolManagerFail"), e);
                         }
                     }
                 }
 
                 /*
-                 * Present in Java 7 onwards
-                 * Fixed in Java 9 (from early access build 156)
+                 * Present in Java 7 onwards Fixed in Java 9 (from early access build 156)
                  */
                 if (forkJoinCommonPoolProtection && !JreCompat.isJre9Available()) {
                     // Don't override any explicitly set property
@@ -405,16 +390,13 @@ public class JreMemoryLeakPreventionListener implements LifecycleListener {
                 }
 
                 if (classesToInitialize != null) {
-                    StringTokenizer strTok =
-                        new StringTokenizer(classesToInitialize, ", \r\n\t");
+                    StringTokenizer strTok = new StringTokenizer(classesToInitialize, ", \r\n\t");
                     while (strTok.hasMoreTokens()) {
                         String classNameToLoad = strTok.nextToken();
                         try {
                             Class.forName(classNameToLoad);
                         } catch (ClassNotFoundException e) {
-                            log.error(
-                                sm.getString("jreLeakListener.classToInitializeFail",
-                                    classNameToLoad), e);
+                            log.error(sm.getString("jreLeakListener.classToInitializeFail", classNameToLoad), e);
                             // continue with next class to load
                         }
                     }
diff --git a/java/org/apache/catalina/core/NamingContextListener.java b/java/org/apache/catalina/core/NamingContextListener.java
index 77070a10f5..d8b5c3cdbb 100644
--- a/java/org/apache/catalina/core/NamingContextListener.java
+++ b/java/org/apache/catalina/core/NamingContextListener.java
@@ -77,13 +77,11 @@ import org.apache.tomcat.util.res.StringManager;
 
 
 /**
- * Helper class used to initialize and populate the JNDI context associated
- * with each context and server.
+ * Helper class used to initialize and populate the JNDI context associated with each context and server.
  *
  * @author Remy Maucherat
  */
-public class NamingContextListener
-        implements LifecycleListener, ContainerListener, PropertyChangeListener {
+public class NamingContextListener implements LifecycleListener, ContainerListener, PropertyChangeListener {
 
     private static final Log log = LogFactory.getLog(NamingContextListener.class);
     protected static final StringManager sm = StringManager.getManager(NamingContextListener.class);
@@ -144,8 +142,7 @@ public class NamingContextListener
 
 
     /**
-     * Determines if an attempt to write to a read-only context results in an
-     * exception or if the request is ignored.
+     * Determines if an attempt to write to a read-only context results in an exception or if the request is ignored.
      */
     private boolean exceptionOnFailedWrite = true;
 
@@ -153,8 +150,8 @@ public class NamingContextListener
     // ------------------------------------------------------------- Properties
 
     /**
-     * @return whether or not an attempt to modify the JNDI context will trigger
-     * an exception or if the request will be ignored.
+     * @return whether or not an attempt to modify the JNDI context will trigger an exception or if the request will be
+     *             ignored.
      */
     public boolean getExceptionOnFailedWrite() {
         return exceptionOnFailedWrite;
@@ -162,10 +159,10 @@ public class NamingContextListener
 
 
     /**
-     * Controls whether or not an attempt to modify the JNDI context will
-     * trigger an exception or if the request will be ignored.
+     * Controls whether or not an attempt to modify the JNDI context will trigger an exception or if the request will be
+     * ignored.
      *
-     * @param exceptionOnFailedWrite    The new value
+     * @param exceptionOnFailedWrite The new value
      */
     public void setExceptionOnFailedWrite(boolean exceptionOnFailedWrite) {
         this.exceptionOnFailedWrite = exceptionOnFailedWrite;
@@ -232,13 +229,12 @@ public class NamingContextListener
                 ContextAccessController.setSecurityToken(getName(), token);
                 ContextAccessController.setSecurityToken(container, token);
                 ContextBindings.bindContext(container, namingContext, token);
-                if( log.isDebugEnabled() ) {
-                    log.debug("Bound " + container );
+                if (log.isDebugEnabled()) {
+                    log.debug("Bound " + container);
                 }
 
                 // Configure write when read-only behaviour
-                namingContext.setExceptionOnFailedWrite(
-                        getExceptionOnFailedWrite());
+                namingContext.setExceptionOnFailedWrite(getExceptionOnFailedWrite());
 
                 // Setting the context in read/write mode
                 ContextAccessController.setWritable(getName(), token);
@@ -246,8 +242,7 @@ public class NamingContextListener
                 try {
                     createNamingContext();
                 } catch (NamingException e) {
-                    log.error
-                        (sm.getString("naming.namingContextCreationFailed", e));
+                    log.error(sm.getString("naming.namingContextCreationFailed", e));
                 }
 
                 namingResources.addPropertyChangeListener(this);
@@ -265,17 +260,14 @@ public class NamingContextListener
                 }
 
                 if (container instanceof Server) {
-                    org.apache.naming.factory.ResourceLinkFactory.setGlobalContext
-                        (namingContext);
+                    org.apache.naming.factory.ResourceLinkFactory.setGlobalContext(namingContext);
                     try {
-                        ContextBindings.bindClassLoader(container, token,
-                                this.getClass().getClassLoader());
+                        ContextBindings.bindClassLoader(container, token, this.getClass().getClassLoader());
                     } catch (NamingException e) {
                         log.error(sm.getString("naming.bindFailed", e));
                     }
                     if (container instanceof StandardServer) {
-                        ((StandardServer) container).setGlobalNamingContext
-                            (namingContext);
+                        ((StandardServer) container).setGlobalNamingContext(namingContext);
                     }
                 }
 
@@ -301,8 +293,7 @@ public class NamingContextListener
                 }
 
                 if (container instanceof Server) {
-                    ContextBindings.unbindClassLoader(container, token,
-                            this.getClass().getClassLoader());
+                    ContextBindings.unbindClassLoader(container, token, this.getClass().getClassLoader());
                 }
 
                 namingResources.removePropertyChangeListener(this);
@@ -344,9 +335,8 @@ public class NamingContextListener
      *
      * @param event ContainerEvent that has occurred
      *
-     * @deprecated The {@link ContainerListener} interface and implementing
-     *             methods will be removed from this class for Tomcat 10
-     *             onwards.
+     * @deprecated The {@link ContainerListener} interface and implementing methods will be removed from this class for
+     *                 Tomcat 10 onwards.
      */
     @Deprecated
     @Override
@@ -376,9 +366,7 @@ public class NamingContextListener
             // Setting the context in read/write mode
             ContextAccessController.setWritable(getName(), token);
 
-            processGlobalResourcesChange(event.getPropertyName(),
-                                         event.getOldValue(),
-                                         event.getNewValue());
+            processGlobalResourcesChange(event.getPropertyName(), event.getOldValue(), event.getNewValue());
 
             // Setting the context in read only mode
             ContextAccessController.setReadOnly(getName());
@@ -392,16 +380,14 @@ public class NamingContextListener
 
 
     /**
-     * Process a property change on the naming resources, by making the
-     * corresponding addition or removal to the associated JNDI context.
+     * Process a property change on the naming resources, by making the corresponding addition or removal to the
+     * associated JNDI context.
      *
-     * @param name Property name of the change to be processed
+     * @param name     Property name of the change to be processed
      * @param oldValue The old value (or <code>null</code> if adding)
      * @param newValue The new value (or <code>null</code> if removing)
      */
-    private void processGlobalResourcesChange(String name,
-                                              Object oldValue,
-                                              Object newValue) {
+    private void processGlobalResourcesChange(String name, Object oldValue, Object newValue) {
 
         if (name.equals("ejb")) {
             if (oldValue != null) {
@@ -470,15 +456,13 @@ public class NamingContextListener
             }
         } else if (name.equals("resourceEnvRef")) {
             if (oldValue != null) {
-                ContextResourceEnvRef resourceEnvRef =
-                    (ContextResourceEnvRef) oldValue;
+                ContextResourceEnvRef resourceEnvRef = (ContextResourceEnvRef) oldValue;
                 if (resourceEnvRef.getName() != null) {
                     removeResourceEnvRef(resourceEnvRef.getName());
                 }
             }
             if (newValue != null) {
-                ContextResourceEnvRef resourceEnvRef =
-                    (ContextResourceEnvRef) newValue;
+                ContextResourceEnvRef resourceEnvRef = (ContextResourceEnvRef) newValue;
                 if (resourceEnvRef.getName() != null) {
                     addResourceEnvRef(resourceEnvRef);
                 }
@@ -518,8 +502,7 @@ public class NamingContextListener
     /**
      * Create and initialize the JNDI naming context.
      */
-    private void createNamingContext()
-        throws NamingException {
+    private void createNamingContext() throws NamingException {
 
         // Creating the comp subcontext
         if (container instanceof Server) {
@@ -542,8 +525,7 @@ public class NamingContextListener
         }
 
         // Resource links
-        ContextResourceLink[] resourceLinks =
-            namingResources.findResourceLinks();
+        ContextResourceLink[] resourceLinks = namingResources.findResourceLinks();
         for (i = 0; i < resourceLinks.length; i++) {
             addResourceLink(resourceLinks[i]);
         }
@@ -561,8 +543,7 @@ public class NamingContextListener
         }
 
         // Environment entries
-        ContextEnvironment[] contextEnvironments =
-            namingResources.findEnvironments();
+        ContextEnvironment[] contextEnvironments = namingResources.findEnvironments();
         for (i = 0; i < contextEnvironments.length; i++) {
             addEnvironment(contextEnvironments[i]);
         }
@@ -611,8 +592,7 @@ public class NamingContextListener
         // Binding the resources directory context
         if (container instanceof Context) {
             try {
-                compCtx.bind("Resources",
-                             ((Context) container).getResources());
+                compCtx.bind("Resources", ((Context) container).getResources());
             } catch (NamingException e) {
                 log.error(sm.getString("naming.bindFailed", e));
             }
@@ -622,15 +602,15 @@ public class NamingContextListener
 
 
     /**
-     * Create an <code>ObjectName</code> for this
-     * <code>ContextResource</code> object.
+     * Create an <code>ObjectName</code> for this <code>ContextResource</code> object.
      *
      * @param resource The resource
+     *
      * @return ObjectName The object name
+     *
      * @exception MalformedObjectNameException if a name cannot be created
      */
-    protected ObjectName createObjectName(ContextResource resource)
-        throws MalformedObjectNameException {
+    protected ObjectName createObjectName(ContextResource resource) throws MalformedObjectNameException {
 
         String domain = null;
         if (container instanceof StandardServer) {
@@ -645,20 +625,16 @@ public class NamingContextListener
         ObjectName name = null;
         String quotedResourceName = ObjectName.quote(resource.getName());
         if (container instanceof Server) {
-            name = new ObjectName(domain + ":type=DataSource" +
-                        ",class=" + resource.getType() +
-                        ",name=" + quotedResourceName);
+            name = new ObjectName(
+                    domain + ":type=DataSource" + ",class=" + resource.getType() + ",name=" + quotedResourceName);
         } else if (container instanceof Context) {
-            String contextName = ((Context)container).getName();
+            String contextName = ((Context) container).getName();
             if (!contextName.startsWith("/")) {
                 contextName = "/" + contextName;
             }
-            Host host = (Host) ((Context)container).getParent();
-            name = new ObjectName(domain + ":type=DataSource" +
-                    ",host=" + host.getName() +
-                    ",context=" + contextName +
-                    ",class=" + resource.getType() +
-                    ",name=" + quotedResourceName);
+            Host host = (Host) ((Context) container).getParent();
+            name = new ObjectName(domain + ":type=DataSource" + ",host=" + host.getName() + ",context=" + contextName +
+                    ",class=" + resource.getType() + ",name=" + quotedResourceName);
         }
 
         return name;
@@ -764,8 +740,7 @@ public class NamingContextListener
                 } else {
                     value = constructEnvEntry(env.getType(), env.getValue());
                     if (value == null) {
-                        log.error(sm.getString(
-                                "naming.invalidEnvEntryType", env.getName()));
+                        log.error(sm.getString("naming.invalidEnvEntryType", env.getName()));
                     }
                 }
             } catch (IllegalArgumentException e) {
@@ -793,8 +768,8 @@ public class NamingContextListener
             Class<?> clazz = Class.forName(type);
             Constructor<?> c = null;
             try {
-                 c = clazz.getConstructor(String.class);
-                 return c.newInstance(value);
+                c = clazz.getConstructor(String.class);
+                return c.newInstance(value);
             } catch (NoSuchMethodException e) {
                 // Ignore
             }
@@ -861,18 +836,15 @@ public class NamingContextListener
                 }
                 if (wsdlURL == null) {
                     try {
-                        wsdlURL = ((Context) container).getServletContext().getResource(
-                                service.getWsdlfile());
+                        wsdlURL = ((Context) container).getServletContext().getResource(service.getWsdlfile());
                     } catch (MalformedURLException e) {
                         // Ignore and carry on
                     }
                 }
                 if (wsdlURL == null) {
                     try {
-                        wsdlURL = ((Context) container).getServletContext().getResource(
-                                "/" + service.getWsdlfile());
-                        log.debug("  Changing service ref wsdl file for /"
-                                    + service.getWsdlfile());
+                        wsdlURL = ((Context) container).getServletContext().getResource("/" + service.getWsdlfile());
+                        log.debug("  Changing service ref wsdl file for /" + service.getWsdlfile());
                     } catch (MalformedURLException e) {
                         log.error(sm.getString("naming.wsdlFailed", e));
                     }
@@ -895,18 +867,17 @@ public class NamingContextListener
                 }
                 if (jaxrpcURL == null) {
                     try {
-                        jaxrpcURL = ((Context) container).getServletContext().getResource(
-                                service.getJaxrpcmappingfile());
+                        jaxrpcURL = ((Context) container).getServletContext()
+                                .getResource(service.getJaxrpcmappingfile());
                     } catch (MalformedURLException e) {
                         // Ignore and carry on
                     }
                 }
                 if (jaxrpcURL == null) {
                     try {
-                        jaxrpcURL = ((Context) container).getServletContext().getResource(
-                                "/" + service.getJaxrpcmappingfile());
-                        log.debug("  Changing service ref jaxrpc file for /"
-                                    + service.getJaxrpcmappingfile());
+                        jaxrpcURL = ((Context) container).getServletContext()
+                                .getResource("/" + service.getJaxrpcmappingfile());
+                        log.debug("  Changing service ref jaxrpc file for /" + service.getJaxrpcmappingfile());
                     } catch (MalformedURLException e) {
                         log.error(sm.getString("naming.wsdlFailed", e));
                     }
@@ -919,9 +890,8 @@ public class NamingContextListener
             }
 
             // Create a reference to the resource.
-            ref = new ServiceRef(service.getName(), service.getInterface(),
-                    service.getServiceqname(), service.getWsdlfile(),
-                    service.getJaxrpcmappingfile());
+            ref = new ServiceRef(service.getName(), service.getInterface(), service.getServiceqname(),
+                    service.getWsdlfile(), service.getJaxrpcmappingfile());
 
             // Adding the additional port-component-ref, if any
             Iterator<String> portcomponent = service.getServiceendpoints();
@@ -986,8 +956,8 @@ public class NamingContextListener
 
         if (ref == null) {
             // Create a reference to the resource.
-            ref = new ResourceRef(resource.getType(), resource.getDescription(),
-                    resource.getScope(), resource.getAuth(), resource.getSingleton());
+            ref = new ResourceRef(resource.getType(), resource.getDescription(), resource.getScope(),
+                    resource.getAuth(), resource.getSingleton());
             // Adding the additional parameters, if any
             Iterator<String> params = resource.listProperties();
             while (params.hasNext()) {
@@ -1008,9 +978,8 @@ public class NamingContextListener
             log.error(sm.getString("naming.bindFailed", e));
         }
 
-        if (("javax.sql.DataSource".equals(ref.getClassName())  ||
-            "javax.sql.XADataSource".equals(ref.getClassName())) &&
-                resource.getSingleton()) {
+        if (("javax.sql.DataSource".equals(ref.getClassName()) ||
+                "javax.sql.XADataSource".equals(ref.getClassName())) && resource.getSingleton()) {
             Object actualResource = null;
             try {
                 ObjectName on = createObjectName(resource);
@@ -1071,20 +1040,18 @@ public class NamingContextListener
     public void addResourceLink(ContextResourceLink resourceLink) {
 
         // Create a reference to the resource.
-        Reference ref = new ResourceLinkRef
-            (resourceLink.getType(), resourceLink.getGlobal(), resourceLink.getFactory(), null);
+        Reference ref = new ResourceLinkRef(resourceLink.getType(), resourceLink.getGlobal(), resourceLink.getFactory(),
+                null);
         Iterator<String> i = resourceLink.listProperties();
         while (i.hasNext()) {
             String key = i.next();
             Object val = resourceLink.getProperty(key);
-            if (val!=null) {
+            if (val != null) {
                 StringRefAddr refAddr = new StringRefAddr(key, val.toString());
                 ref.add(refAddr);
             }
         }
-        javax.naming.Context ctx =
-            "UserTransaction".equals(resourceLink.getName())
-            ? compCtx : envCtx;
+        javax.naming.Context ctx = "UserTransaction".equals(resourceLink.getName()) ? compCtx : envCtx;
         try {
             if (log.isDebugEnabled()) {
                 log.debug("  Adding resource link " + resourceLink.getName());
@@ -1095,8 +1062,8 @@ public class NamingContextListener
             log.error(sm.getString("naming.bindFailed", e));
         }
 
-        ResourceLinkFactory.registerGlobalResourceAccess(
-                getGlobalNamingContext(), resourceLink.getName(), resourceLink.getGlobal());
+        ResourceLinkFactory.registerGlobalResourceAccess(getGlobalNamingContext(), resourceLink.getName(),
+                resourceLink.getGlobal());
     }
 
 
@@ -1164,8 +1131,7 @@ public class NamingContextListener
     /**
      * Remove the specified message destination ref from the naming context.
      *
-     * @param name the name of the message destination ref which should be
-     *             removed
+     * @param name the name of the message destination ref which should be removed
      */
     public void removeMessageDestinationRef(String name) {
 
@@ -1216,11 +1182,9 @@ public class NamingContextListener
 
 
     /**
-     * Remove the specified resource environment reference from the naming
-     * context.
+     * Remove the specified resource environment reference from the naming context.
      *
-     * @param name the name of the resource environment reference which should
-     *             be removed
+     * @param name the name of the resource environment reference which should be removed
      */
     public void removeResourceEnvRef(String name) {
 
@@ -1253,8 +1217,7 @@ public class NamingContextListener
     /**
      * Create all intermediate subcontexts.
      */
-    private void createSubcontexts(javax.naming.Context ctx, String name)
-        throws NamingException {
+    private void createSubcontexts(javax.naming.Context ctx, String name) throws NamingException {
         javax.naming.Context currentContext = ctx;
         StringTokenizer tokenizer = new StringTokenizer(name, "/");
         while (tokenizer.hasMoreTokens()) {
@@ -1265,8 +1228,7 @@ public class NamingContextListener
                 } catch (NamingException e) {
                     // Silent catch. Probably an object is already bound in
                     // the context.
-                    currentContext =
-                        (javax.naming.Context) currentContext.lookup(token);
+                    currentContext = (javax.naming.Context) currentContext.lookup(token);
                 }
             }
         }
@@ -1277,6 +1239,7 @@ public class NamingContextListener
      * Gets look up reference from resource if exist.
      *
      * @param resourceBase resource base object
+     *
      * @return lookup ref
      */
     private LookupRef lookForLookupRef(ResourceBase resourceBase) {
diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java
index f89f36de55..c0a628aa8a 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -137,15 +137,13 @@ import org.apache.tomcat.util.security.PrivilegedGetTccl;
 import org.apache.tomcat.util.security.PrivilegedSetTccl;
 
 /**
- * Standard implementation of the <b>Context</b> interface.  Each
- * child container must be a Wrapper implementation to process the
- * requests directed to a particular servlet.
+ * Standard implementation of the <b>Context</b> interface. Each child container must be a Wrapper implementation to
+ * process the requests directed to a particular servlet.
  *
  * @author Craig R. McClanahan
  * @author Remy Maucherat
  */
-public class StandardContext extends ContainerBase
-        implements Context, NotificationEmitter {
+public class StandardContext extends ContainerBase implements Context, NotificationEmitter {
 
     private static final Log log = LogFactory.getLog(StandardContext.class);
 
@@ -173,15 +171,14 @@ public class StandardContext extends ContainerBase
     // ----------------------------------------------------- Instance Variables
 
     /**
-     * Allow multipart/form-data requests to be parsed even when the
-     * target servlet doesn't specify @MultipartConfig or have a
-     * &lt;multipart-config&gt; element.
+     * Allow multipart/form-data requests to be parsed even when the target servlet doesn't specify @MultipartConfig or
+     * have a &lt;multipart-config&gt; element.
      */
     protected boolean allowCasualMultipartParsing = false;
 
     /**
-     * Control whether remaining request data will be read
-     * (swallowed) even if the request violates a data size constraint.
+     * Control whether remaining request data will be read (swallowed) even if the request violates a data size
+     * constraint.
      */
     private boolean swallowAbortedUploads = true;
 
@@ -204,49 +201,43 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * The set of application listener class names configured for this
-     * application, in the order they were encountered in the resulting merged
-     * web.xml file.
+     * The set of application listener class names configured for this application, in the order they were encountered
+     * in the resulting merged web.xml file.
      */
     private String applicationListeners[] = new String[0];
 
     private final Object applicationListenersLock = new Object();
 
     /**
-     * The set of application listeners that are required to have limited access
-     * to ServletContext methods. See Servlet 3.1 section 4.4.
+     * The set of application listeners that are required to have limited access to ServletContext methods. See Servlet
+     * 3.1 section 4.4.
      */
     private final Set<Object> noPluggabilityListeners = new HashSet<>();
 
     /**
-     * The list of instantiated application event listener objects. Note that
-     * SCIs and other code may use the pluggability APIs to add listener
-     * instances directly to this list before the application starts.
+     * The list of instantiated application event listener objects. Note that SCIs and other code may use the
+     * pluggability APIs to add listener instances directly to this list before the application starts.
      */
     private List<Object> applicationEventListenersList = new CopyOnWriteArrayList<>();
 
 
     /**
-     * The set of instantiated application lifecycle listener objects. Note that
-     * SCIs and other code may use the pluggability APIs to add listener
-     * instances directly to this list before the application starts.
+     * The set of instantiated application lifecycle listener objects. Note that SCIs and other code may use the
+     * pluggability APIs to add listener instances directly to this list before the application starts.
      */
-    private Object applicationLifecycleListenersObjects[] =
-        new Object[0];
+    private Object applicationLifecycleListenersObjects[] = new Object[0];
 
 
     /**
      * The ordered set of ServletContainerInitializers for this web application.
      */
-    private Map<ServletContainerInitializer,Set<Class<?>>> initializers =
-        new LinkedHashMap<>();
+    private Map<ServletContainerInitializer, Set<Class<?>>> initializers = new LinkedHashMap<>();
 
 
     /**
      * The set of application parameters defined for this application.
      */
-    private ApplicationParameter applicationParameters[] =
-        new ApplicationParameter[0];
+    private ApplicationParameter applicationParameters[] = new ApplicationParameter[0];
 
     private final Object applicationParametersLock = new Object();
 
@@ -265,8 +256,7 @@ public class StandardContext extends ContainerBase
     /**
      * The Java class name of the CharsetMapper class to be created.
      */
-    private String charsetMapperClass =
-      "org.apache.catalina.util.CharsetMapper";
+    private String charsetMapperClass = "org.apache.catalina.util.CharsetMapper";
 
 
     /**
@@ -284,8 +274,7 @@ public class StandardContext extends ContainerBase
     /**
      * The security constraints for this web application.
      */
-    private volatile SecurityConstraint constraints[] =
-            new SecurityConstraint[0];
+    private volatile SecurityConstraint constraints[] = new SecurityConstraint[0];
 
     private final Object constraintsLock = new Object();
 
@@ -296,9 +285,8 @@ public class StandardContext extends ContainerBase
     protected ApplicationContext context = null;
 
     /**
-     * The wrapped version of the associated ServletContext that is presented
-     * to listeners that are required to have limited access to ServletContext
-     * methods. See Servlet 3.1 section 4.4.
+     * The wrapped version of the associated ServletContext that is presented to listeners that are required to have
+     * limited access to ServletContext methods. See Servlet 3.1 section 4.4.
      */
     private NoPluggabilityServletContext noPluggabilityServletContext = null;
 
@@ -310,8 +298,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Should we allow the <code>ServletContext.getContext()</code> method
-     * to access the context of other web applications in this server?
+     * Should we allow the <code>ServletContext.getContext()</code> method to access the context of other web
+     * applications in this server?
      */
     private boolean crossContext = false;
 
@@ -329,10 +317,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * The "follow standard delegation model" flag that will be used to
-     * configure our ClassLoader.
-     * Graal cannot actually load a class from the webapp classloader,
-     * so delegate by default.
+     * The "follow standard delegation model" flag that will be used to configure our ClassLoader. Graal cannot actually
+     * load a class from the webapp classloader, so delegate by default.
      */
     private boolean delegate = JreCompat.isGraalAvailable();
 
@@ -373,24 +359,21 @@ public class StandardContext extends ContainerBase
     private final ErrorPageSupport errorPageSupport = new ErrorPageSupport();
 
     /**
-     * The set of filter configurations (and associated filter instances) we
-     * have initialized, keyed by filter name.
+     * The set of filter configurations (and associated filter instances) we have initialized, keyed by filter name.
      */
     private Map<String, ApplicationFilterConfig> filterConfigs = new HashMap<>();
 
 
     /**
-     * The set of filter definitions for this application, keyed by
-     * filter name.
+     * The set of filter definitions for this application, keyed by filter name.
      */
     private Map<String, FilterDef> filterDefs = new HashMap<>();
 
 
     /**
-     * The set of filter mappings for this application, in the order
-     * they were defined in the deployment descriptor with additional mappings
-     * added via the {@link ServletContext} possibly both before and after those
-     * defined in the deployment descriptor.
+     * The set of filter mappings for this application, in the order they were defined in the deployment descriptor with
+     * additional mappings added via the {@link ServletContext} possibly both before and after those defined in the
+     * deployment descriptor.
      */
     private final ContextFilterMaps filterMaps = new ContextFilterMaps();
 
@@ -434,8 +417,7 @@ public class StandardContext extends ContainerBase
     /**
      * The message destinations for this web application.
      */
-    private HashMap<String, MessageDestination> messageDestinations =
-        new HashMap<>();
+    private HashMap<String, MessageDestination> messageDestinations = new HashMap<>();
 
 
     /**
@@ -445,8 +427,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * The context initialization parameters for this web application,
-     * keyed by name.
+     * The context initialization parameters for this web application, keyed by name.
      */
     private final Map<String, String> parameters = new ConcurrentHashMap<>();
 
@@ -458,9 +439,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * The public identifier of the DTD for the web application deployment
-     * descriptor version we are currently parsing.  This is used to support
-     * relaxed validation rules when processing version 2.2 web.xml files.
+     * The public identifier of the DTD for the web application deployment descriptor version we are currently parsing.
+     * This is used to support relaxed validation rules when processing version 2.2 web.xml files.
      */
     private String publicId = null;
 
@@ -502,18 +482,15 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Should the next call to <code>addWelcomeFile()</code> cause replacement
-     * of any existing welcome files?  This will be set before processing the
-     * web application's deployment descriptor, so that application specified
-     * choices <strong>replace</strong>, rather than append to, those defined
-     * in the global descriptor.
+     * Should the next call to <code>addWelcomeFile()</code> cause replacement of any existing welcome files? This will
+     * be set before processing the web application's deployment descriptor, so that application specified choices
+     * <strong>replace</strong>, rather than append to, those defined in the global descriptor.
      */
     private boolean replaceWelcomeFiles = false;
 
 
     /**
-     * The security role mappings for this application, keyed by role
-     * name (as used within the application).
+     * The security role mappings for this application, keyed by role name (as used within the application).
      */
     private Map<String, String> roleMappings = new HashMap<>();
 
@@ -527,8 +504,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * The servlet mappings for this web application, keyed by
-     * matching pattern.
+     * The servlet mappings for this web application, keyed by matching pattern.
      */
     private Map<String, String> servletMappings = new HashMap<>();
 
@@ -547,8 +523,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Set flag to true to cause the system.out and system.err to be redirected
-     * to the logger when executing a servlet.
+     * Set flag to true to cause the system.out and system.err to be redirected to the logger when executing a servlet.
      */
     private boolean swallowOutput = false;
 
@@ -576,24 +551,23 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * The set of classnames of LifecycleListeners that will be added
-     * to each newly created Wrapper by <code>createWrapper()</code>.
+     * The set of classnames of LifecycleListeners that will be added to each newly created Wrapper by
+     * <code>createWrapper()</code>.
      */
     private String wrapperLifecycles[] = new String[0];
 
     private final Object wrapperLifecyclesLock = new Object();
 
     /**
-     * The set of classnames of ContainerListeners that will be added
-     * to each newly created Wrapper by <code>createWrapper()</code>.
+     * The set of classnames of ContainerListeners that will be added to each newly created Wrapper by
+     * <code>createWrapper()</code>.
      */
     private String wrapperListeners[] = new String[0];
 
     private final Object wrapperListenersLock = new Object();
 
     /**
-     * The pathname to the work directory for this context (relative to
-     * the server's home if not absolute).
+     * The pathname to the work directory for this context (relative to the server's home if not absolute).
      */
     private String workDir = null;
 
@@ -627,13 +601,12 @@ public class StandardContext extends ContainerBase
     /**
      * Name of the engine. If null, the domain is used.
      */
-    private String j2EEApplication="none";
-    private String j2EEServer="none";
+    private String j2EEApplication = "none";
+    private String j2EEServer = "none";
 
 
     /**
-     * Attribute value used to turn on/off XML validation for web.xml and
-     * web-fragment.xml files.
+     * Attribute value used to turn on/off XML validation for web.xml and web-fragment.xml files.
      */
     private boolean webXmlValidation = Globals.STRICT_SERVLET_COMPLIANCE;
 
@@ -657,8 +630,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * The name to use for session cookies. <code>null</code> indicates that
-     * the name is controlled by the application.
+     * The name to use for session cookies. <code>null</code> indicates that the name is controlled by the application.
      */
     private String sessionCookieName;
 
@@ -670,91 +642,81 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * The domain to use for session cookies. <code>null</code> indicates that
-     * the domain is controlled by the application.
+     * The domain to use for session cookies. <code>null</code> indicates that the domain is controlled by the
+     * application.
      */
     private String sessionCookieDomain;
 
 
     /**
-     * The path to use for session cookies. <code>null</code> indicates that
-     * the path is controlled by the application.
+     * The path to use for session cookies. <code>null</code> indicates that the path is controlled by the application.
      */
     private String sessionCookiePath;
 
 
     /**
-     * Is a / added to the end of the session cookie path to ensure browsers,
-     * particularly IE, don't send a session cookie for context /foo with
-     * requests intended for context /foobar.
+     * Is a / added to the end of the session cookie path to ensure browsers, particularly IE, don't send a session
+     * cookie for context /foo with requests intended for context /foobar.
      */
     private boolean sessionCookiePathUsesTrailingSlash = false;
 
 
     /**
-     * The Jar scanner to use to search for Jars that might contain
-     * configuration information such as TLDs or web-fragment.xml files.
+     * The Jar scanner to use to search for Jars that might contain configuration information such as TLDs or
+     * web-fragment.xml files.
      */
     private JarScanner jarScanner = null;
 
     /**
-     * Enables the RMI Target memory leak detection to be controlled. This is
-     * necessary since the detection can only work on Java 9 if some of the
-     * modularity checks are disabled.
+     * Enables the RMI Target memory leak detection to be controlled. This is necessary since the detection can only
+     * work on Java 9 if some of the modularity checks are disabled.
      */
     private boolean clearReferencesRmiTargets = true;
 
     /**
-     * Should Tomcat attempt to terminate threads that have been started by the
-     * web application? Stopping threads is performed via the deprecated (for
-     * good reason) <code>Thread.stop()</code> method and is likely to result in
-     * instability. As such, enabling this should be viewed as an option of last
-     * resort in a development environment and is not recommended in a
-     * production environment. If not specified, the default value of
-     * <code>false</code> will be used.
+     * Should Tomcat attempt to terminate threads that have been started by the web application? Stopping threads is
+     * performed via the deprecated (for good reason) <code>Thread.stop()</code> method and is likely to result in
+     * instability. As such, enabling this should be viewed as an option of last resort in a development environment and
+     * is not recommended in a production environment. If not specified, the default value of <code>false</code> will be
+     * used.
      */
     private boolean clearReferencesStopThreads = false;
 
     /**
-     * Should Tomcat attempt to terminate any {@link java.util.TimerThread}s
-     * that have been started by the web application? If not specified, the
-     * default value of <code>false</code> will be used.
+     * Should Tomcat attempt to terminate any {@link java.util.TimerThread}s that have been started by the web
+     * application? If not specified, the default value of <code>false</code> will be used.
      */
     private boolean clearReferencesStopTimerThreads = false;
 
     /**
-     * If an HttpClient keep-alive timer thread has been started by this web
-     * application and is still running, should Tomcat change the context class
-     * loader from the current {@link ClassLoader} to
-     * {@link ClassLoader#getParent()} to prevent a memory leak? Note that the
-     * keep-alive timer thread will stop on its own once the keep-alives all
-     * expire however, on a busy system that might not happen for some time.
+     * If an HttpClient keep-alive timer thread has been started by this web application and is still running, should
+     * Tomcat change the context class loader from the current {@link ClassLoader} to {@link ClassLoader#getParent()} to
+     * prevent a memory leak? Note that the keep-alive timer thread will stop on its own once the keep-alives all expire
+     * however, on a busy system that might not happen for some time.
      */
     private boolean clearReferencesHttpClientKeepAliveThread = true;
 
     /**
-     * Should Tomcat renew the threads of the thread pool when the application
-     * is stopped to avoid memory leaks because of uncleaned ThreadLocal
-     * variables. This also requires that the threadRenewalDelay property of the
+     * Should Tomcat renew the threads of the thread pool when the application is stopped to avoid memory leaks because
+     * of uncleaned ThreadLocal variables. This also requires that the threadRenewalDelay property of the
      * StandardThreadExecutor or ThreadPoolExecutor be set to a positive value.
      */
     private boolean renewThreadsWhenStoppingContext = true;
 
     /**
-     * Should Tomcat attempt to clear references to classes loaded by the web
-     * application class loader from the ObjectStreamClass caches?
+     * Should Tomcat attempt to clear references to classes loaded by the web application class loader from the
+     * ObjectStreamClass caches?
      */
     private boolean clearReferencesObjectStreamClassCaches = true;
 
     /**
-     * Should Tomcat attempt to clear references to classes loaded by this class
-     * loader from ThreadLocals?
+     * Should Tomcat attempt to clear references to classes loaded by this class loader from ThreadLocals?
      */
     private boolean clearReferencesThreadLocals = true;
 
     /**
-     * Should Tomcat skip the memory leak checks when the web application is
-     * stopped as part of the process of shutting down the JVM?
+     * Should Tomcat skip the memory leak checks when the web application is stopped as part of the process of shutting
+     * down the JVM?
      */
     private boolean skipMemoryLeakChecksOnJvmShutdown = false;
 
@@ -778,8 +740,7 @@ public class StandardContext extends ContainerBase
     private boolean fireRequestListenersOnForwards = false;
 
     /**
-     * Servlets created via {@link ApplicationContext#createServlet(Class)} for
-     * tracking purposes.
+     * Servlets created via {@link ApplicationContext#createServlet(Class)} for tracking purposes.
      */
     private Set<Servlet> createdServlets = new HashSet<>();
 
@@ -798,9 +759,12 @@ public class StandardContext extends ContainerBase
 
     protected static final ThreadBindingListener DEFAULT_NAMING_LISTENER = (new ThreadBindingListener() {
         @Override
-        public void bind() {}
+        public void bind() {
+        }
+
         @Override
-        public void unbind() {}
+        public void unbind() {
+        }
     });
     protected ThreadBindingListener threadBindingListener = DEFAULT_NAMING_LISTENER;
 
@@ -865,8 +829,7 @@ public class StandardContext extends ContainerBase
 
 
     @Override
-    public void setAllowMultipleLeadingForwardSlashInPath(
-            boolean allowMultipleLeadingForwardSlashInPath) {
+    public void setAllowMultipleLeadingForwardSlashInPath(boolean allowMultipleLeadingForwardSlashInPath) {
         this.allowMultipleLeadingForwardSlashInPath = allowMultipleLeadingForwardSlashInPath;
     }
 
@@ -898,10 +861,9 @@ public class StandardContext extends ContainerBase
     @Override
     public void setResponseCharacterEncoding(String responseEncoding) {
         /*
-         * This ensures that the context response encoding is represented by a
-         * unique String object. This enables the Default Servlet to
-         * differentiate between a Response using this default encoding and one
-         * that has been explicitly configured.
+         * This ensures that the context response encoding is represented by a unique String object. This enables the
+         * Default Servlet to differentiate between a Response using this default encoding and one that has been
+         * explicitly configured.
          */
         if (responseEncoding == null) {
             this.responseEncoding = null;
@@ -999,8 +961,7 @@ public class StandardContext extends ContainerBase
     @Override
     public void setCookieProcessor(CookieProcessor cookieProcessor) {
         if (cookieProcessor == null) {
-            throw new IllegalArgumentException(
-                    sm.getString("standardContext.cookieProcessor.null"));
+            throw new IllegalArgumentException(sm.getString("standardContext.cookieProcessor.null"));
         }
         this.cookieProcessor = cookieProcessor;
     }
@@ -1067,8 +1028,7 @@ public class StandardContext extends ContainerBase
 
 
     @Override
-    public void setAddWebinfClassesResources(
-            boolean addWebinfClassesResources) {
+    public void setAddWebinfClassesResources(boolean addWebinfClassesResources) {
         this.addWebinfClassesResources = addWebinfClassesResources;
     }
 
@@ -1115,7 +1075,7 @@ public class StandardContext extends ContainerBase
         }
         for (String servletName : resourceOnlyServlets.split(",")) {
             servletName = servletName.trim();
-            if (servletName.length()>0) {
+            if (servletName.length() > 0) {
                 this.resourceOnlyServlets.add(servletName);
             }
         }
@@ -1192,13 +1152,13 @@ public class StandardContext extends ContainerBase
 
     @Override
     public InstanceManager getInstanceManager() {
-       return instanceManager;
+        return instanceManager;
     }
 
 
     @Override
     public void setInstanceManager(InstanceManager instanceManager) {
-       this.instanceManager = instanceManager;
+        this.instanceManager = instanceManager;
     }
 
 
@@ -1209,27 +1169,22 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Set to <code>true</code> to allow requests mapped to servlets that
-     * do not explicitly declare @MultipartConfig or have
-     * &lt;multipart-config&gt; specified in web.xml to parse
-     * multipart/form-data requests.
+     * Set to <code>true</code> to allow requests mapped to servlets that do not explicitly declare @MultipartConfig or
+     * have &lt;multipart-config&gt; specified in web.xml to parse multipart/form-data requests.
      *
-     * @param allowCasualMultipartParsing <code>true</code> to allow such
-     *        casual parsing, <code>false</code> otherwise.
+     * @param allowCasualMultipartParsing <code>true</code> to allow such casual parsing, <code>false</code> otherwise.
      */
     @Override
-    public void setAllowCasualMultipartParsing(
-            boolean allowCasualMultipartParsing) {
+    public void setAllowCasualMultipartParsing(boolean allowCasualMultipartParsing) {
         this.allowCasualMultipartParsing = allowCasualMultipartParsing;
     }
 
     /**
-     * Returns <code>true</code> if requests mapped to servlets without
-     * "multipart config" to parse multipart/form-data requests anyway.
+     * Returns <code>true</code> if requests mapped to servlets without "multipart config" to parse multipart/form-data
+     * requests anyway.
      *
-     * @return <code>true</code> if requests mapped to servlets without
-     *    "multipart config" to parse multipart/form-data requests,
-     *    <code>false</code> otherwise.
+     * @return <code>true</code> if requests mapped to servlets without "multipart config" to parse multipart/form-data
+     *             requests, <code>false</code> otherwise.
      */
     @Override
     public boolean getAllowCasualMultipartParsing() {
@@ -1237,11 +1192,9 @@ public class StandardContext extends ContainerBase
     }
 
     /**
-     * Set to <code>false</code> to disable request data swallowing
-     * after an upload was aborted due to size constraints.
+     * Set to <code>false</code> to disable request data swallowing after an upload was aborted due to size constraints.
      *
-     * @param swallowAbortedUploads <code>false</code> to disable
-     *        swallowing, <code>true</code> otherwise (default).
+     * @param swallowAbortedUploads <code>false</code> to disable swallowing, <code>true</code> otherwise (default).
      */
     @Override
     public void setSwallowAbortedUploads(boolean swallowAbortedUploads) {
@@ -1249,11 +1202,10 @@ public class StandardContext extends ContainerBase
     }
 
     /**
-     * Returns <code>true</code> if remaining request data will be read
-     * (swallowed) even the request violates a data size constraint.
+     * Returns <code>true</code> if remaining request data will be read (swallowed) even the request violates a data
+     * size constraint.
      *
-     * @return <code>true</code> if data will be swallowed (default),
-     *    <code>false</code> otherwise.
+     * @return <code>true</code> if data will be swallowed (default), <code>false</code> otherwise.
      */
     @Override
     public boolean getSwallowAbortedUploads() {
@@ -1263,20 +1215,17 @@ public class StandardContext extends ContainerBase
     /**
      * Add a ServletContainerInitializer instance to this web application.
      *
-     * @param sci       The instance to add
-     * @param classes   The classes in which the initializer expressed an
-     *                  interest
+     * @param sci     The instance to add
+     * @param classes The classes in which the initializer expressed an interest
      */
     @Override
-    public void addServletContainerInitializer(
-            ServletContainerInitializer sci, Set<Class<?>> classes) {
+    public void addServletContainerInitializer(ServletContainerInitializer sci, Set<Class<?>> classes) {
         initializers.put(sci, classes);
     }
 
 
     /**
-     * Return the "follow standard delegation model" flag used to configure
-     * our ClassLoader.
+     * Return the "follow standard delegation model" flag used to configure our ClassLoader.
      *
      * @return <code>true</code> if classloading delegates to the parent classloader first
      */
@@ -1286,8 +1235,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Set the "follow standard delegation model" flag used to configure
-     * our ClassLoader.
+     * Set the "follow standard delegation model" flag used to configure our ClassLoader.
      *
      * @param delegate The new flag
      */
@@ -1295,8 +1243,7 @@ public class StandardContext extends ContainerBase
 
         boolean oldDelegate = this.delegate;
         this.delegate = delegate;
-        support.firePropertyChange("delegate", oldDelegate,
-                                   this.delegate);
+        support.firePropertyChange("delegate", oldDelegate, this.delegate);
 
     }
 
@@ -1326,11 +1273,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * {@inheritDoc}
-     *
-     * Note that this implementation is not thread safe. If two threads call
-     * this method concurrently, the result may be either set of listeners or a
-     * the union of both.
+     * {@inheritDoc} Note that this implementation is not thread safe. If two threads call this method concurrently, the
+     * result may be either set of listeners or a the union of both.
      */
     @Override
     public void setApplicationEventListeners(Object listeners[]) {
@@ -1342,8 +1286,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Add a listener to the end of the list of initialized application event
-     * listeners.
+     * Add a listener to the end of the list of initialized application event listeners.
      *
      * @param listener The listener to add
      */
@@ -1359,9 +1302,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Store the set of initialized application lifecycle listener objects,
-     * in the order they were specified in the web application deployment
-     * descriptor, for this application.
+     * Store the set of initialized application lifecycle listener objects, in the order they were specified in the web
+     * application deployment descriptor, for this application.
      *
      * @param listeners The set of instantiated listener objects.
      */
@@ -1372,15 +1314,13 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Add a listener to the end of the list of initialized application
-     * lifecycle listeners.
+     * Add a listener to the end of the list of initialized application lifecycle listeners.
      *
      * @param listener The listener to add
      */
     public void addApplicationLifecycleListener(Object listener) {
         int len = applicationLifecycleListenersObjects.length;
-        Object[] newListeners = Arrays.copyOf(
-                applicationLifecycleListenersObjects, len + 1);
+        Object[] newListeners = Arrays.copyOf(applicationLifecycleListenersObjects, len + 1);
         newListeners[len] = listener;
         applicationLifecycleListenersObjects = newListeners;
     }
@@ -1403,9 +1343,7 @@ public class StandardContext extends ContainerBase
 
         boolean oldAntiResourceLocking = this.antiResourceLocking;
         this.antiResourceLocking = antiResourceLocking;
-        support.firePropertyChange("antiResourceLocking",
-                                   oldAntiResourceLocking,
-                                   this.antiResourceLocking);
+        support.firePropertyChange("antiResourceLocking", oldAntiResourceLocking, this.antiResourceLocking);
 
     }
 
@@ -1474,11 +1412,10 @@ public class StandardContext extends ContainerBase
 
         CharsetMapper oldCharsetMapper = this.charsetMapper;
         this.charsetMapper = mapper;
-        if( mapper != null ) {
-            this.charsetMapperClass= mapper.getClass().getName();
+        if (mapper != null) {
+            this.charsetMapperClass = mapper.getClass().getName();
         }
-        support.firePropertyChange("charsetMapper", oldCharsetMapper,
-                                   this.charsetMapper);
+        support.firePropertyChange("charsetMapper", oldCharsetMapper, this.charsetMapper);
 
     }
 
@@ -1508,9 +1445,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Set the "correctly configured" flag for this Context.  This can be
-     * set to false by startup listeners that detect a fatal configuration
-     * error to avoid the application from being made available.
+     * Set the "correctly configured" flag for this Context. This can be set to false by startup listeners that detect a
+     * fatal configuration error to avoid the application from being made available.
      *
      * @param configured The new correctly configured flag
      */
@@ -1519,9 +1455,7 @@ public class StandardContext extends ContainerBase
 
         boolean oldConfigured = this.configured;
         this.configured = configured;
-        support.firePropertyChange("configured",
-                                   oldConfigured,
-                                   this.configured);
+        support.firePropertyChange("configured", oldConfigured, this.configured);
 
     }
 
@@ -1542,19 +1476,15 @@ public class StandardContext extends ContainerBase
 
         boolean oldCookies = this.cookies;
         this.cookies = cookies;
-        support.firePropertyChange("cookies",
-                                   oldCookies,
-                                   this.cookies);
+        support.firePropertyChange("cookies", oldCookies, this.cookies);
 
     }
 
 
     /**
-     * Gets the name to use for session cookies. Overrides any setting that
-     * may be specified by the application.
+     * Gets the name to use for session cookies. Overrides any setting that may be specified by the application.
      *
-     * @return  The value of the default session cookie name or null if not
-     *          specified
+     * @return The value of the default session cookie name or null if not specified
      */
     @Override
     public String getSessionCookieName() {
@@ -1563,25 +1493,22 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Sets the name to use for session cookies. Overrides any setting that
-     * may be specified by the application.
+     * Sets the name to use for session cookies. Overrides any setting that may be specified by the application.
      *
-     * @param sessionCookieName   The name to use
+     * @param sessionCookieName The name to use
      */
     @Override
     public void setSessionCookieName(String sessionCookieName) {
         String oldSessionCookieName = this.sessionCookieName;
         this.sessionCookieName = sessionCookieName;
-        support.firePropertyChange("sessionCookieName",
-                oldSessionCookieName, sessionCookieName);
+        support.firePropertyChange("sessionCookieName", oldSessionCookieName, sessionCookieName);
     }
 
 
     /**
      * Gets the value of the use HttpOnly cookies for session cookies flag.
      *
-     * @return <code>true</code> if the HttpOnly flag should be set on session
-     *         cookies
+     * @return <code>true</code> if the HttpOnly flag should be set on session cookies
      */
     @Override
     public boolean getUseHttpOnly() {
@@ -1592,25 +1519,20 @@ public class StandardContext extends ContainerBase
     /**
      * Sets the use HttpOnly cookies for session cookies flag.
      *
-     * @param useHttpOnly   Set to <code>true</code> to use HttpOnly cookies
-     *                          for session cookies
+     * @param useHttpOnly Set to <code>true</code> to use HttpOnly cookies for session cookies
      */
     @Override
     public void setUseHttpOnly(boolean useHttpOnly) {
         boolean oldUseHttpOnly = this.useHttpOnly;
         this.useHttpOnly = useHttpOnly;
-        support.firePropertyChange("useHttpOnly",
-                oldUseHttpOnly,
-                this.useHttpOnly);
+        support.firePropertyChange("useHttpOnly", oldUseHttpOnly, this.useHttpOnly);
     }
 
 
     /**
-     * Gets the domain to use for session cookies. Overrides any setting that
-     * may be specified by the application.
+     * Gets the domain to use for session cookies. Overrides any setting that may be specified by the application.
      *
-     * @return  The value of the default session cookie domain or null if not
-     *          specified
+     * @return The value of the default session cookie domain or null if not specified
      */
     @Override
     public String getSessionCookieDomain() {
@@ -1619,26 +1541,22 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Sets the domain to use for session cookies. Overrides any setting that
-     * may be specified by the application.
+     * Sets the domain to use for session cookies. Overrides any setting that may be specified by the application.
      *
-     * @param sessionCookieDomain   The domain to use
+     * @param sessionCookieDomain The domain to use
      */
     @Override
     public void setSessionCookieDomain(String sessionCookieDomain) {
         String oldSessionCookieDomain = this.sessionCookieDomain;
         this.sessionCookieDomain = sessionCookieDomain;
-        support.firePropertyChange("sessionCookieDomain",
-                oldSessionCookieDomain, sessionCookieDomain);
+        support.firePropertyChange("sessionCookieDomain", oldSessionCookieDomain, sessionCookieDomain);
     }
 
 
     /**
-     * Gets the path to use for session cookies. Overrides any setting that
-     * may be specified by the application.
+     * Gets the path to use for session cookies. Overrides any setting that may be specified by the application.
      *
-     * @return  The value of the default session cookie path or null if not
-     *          specified
+     * @return The value of the default session cookie path or null if not specified
      */
     @Override
     public String getSessionCookiePath() {
@@ -1647,17 +1565,15 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Sets the path to use for session cookies. Overrides any setting that
-     * may be specified by the application.
+     * Sets the path to use for session cookies. Overrides any setting that may be specified by the application.
      *
-     * @param sessionCookiePath   The path to use
+     * @param sessionCookiePath The path to use
      */
     @Override
     public void setSessionCookiePath(String sessionCookiePath) {
         String oldSessionCookiePath = this.sessionCookiePath;
         this.sessionCookiePath = sessionCookiePath;
-        support.firePropertyChange("sessionCookiePath",
-                oldSessionCookiePath, sessionCookiePath);
+        support.firePropertyChange("sessionCookiePath", oldSessionCookiePath, sessionCookiePath);
     }
 
 
@@ -1668,10 +1584,8 @@ public class StandardContext extends ContainerBase
 
 
     @Override
-    public void setSessionCookiePathUsesTrailingSlash(
-            boolean sessionCookiePathUsesTrailingSlash) {
-        this.sessionCookiePathUsesTrailingSlash =
-            sessionCookiePathUsesTrailingSlash;
+    public void setSessionCookiePathUsesTrailingSlash(boolean sessionCookiePathUsesTrailingSlash) {
+        this.sessionCookiePathUsesTrailingSlash = sessionCookiePathUsesTrailingSlash;
     }
 
 
@@ -1691,9 +1605,7 @@ public class StandardContext extends ContainerBase
 
         boolean oldCrossContext = this.crossContext;
         this.crossContext = crossContext;
-        support.firePropertyChange("crossContext",
-                                   oldCrossContext,
-                                   this.crossContext);
+        support.firePropertyChange("crossContext", oldCrossContext, this.crossContext);
 
     }
 
@@ -1702,9 +1614,8 @@ public class StandardContext extends ContainerBase
     }
 
     /**
-     * Set the location of the default context xml that will be used.
-     * If not absolute, it'll be made relative to the engine's base dir
-     * ( which defaults to catalina.base system property ).
+     * Set the location of the default context xml that will be used. If not absolute, it'll be made relative to the
+     * engine's base dir ( which defaults to catalina.base system property ).
      *
      * @param defaultContextXml The default web xml
      */
@@ -1717,9 +1628,8 @@ public class StandardContext extends ContainerBase
     }
 
     /**
-     * Set the location of the default web xml that will be used.
-     * If not absolute, it'll be made relative to the engine's base dir
-     * ( which defaults to catalina.base system property ).
+     * Set the location of the default web xml that will be used. If not absolute, it'll be made relative to the
+     * engine's base dir ( which defaults to catalina.base system property ).
      *
      * @param defaultWebXml The default web xml
      */
@@ -1774,7 +1684,7 @@ public class StandardContext extends ContainerBase
      * @return the alternate Deployment Descriptor name.
      */
     @Override
-    public String getAltDDName(){
+    public String getAltDDName() {
         return altDDName;
     }
 
@@ -1788,7 +1698,7 @@ public class StandardContext extends ContainerBase
     public void setAltDDName(String altDDName) {
         this.altDDName = altDDName;
         if (context != null) {
-            context.setAttribute(Globals.ALT_DD_ATTR,altDDName);
+            context.setAttribute(Globals.ALT_DD_ATTR, altDDName);
         }
     }
 
@@ -1803,8 +1713,7 @@ public class StandardContext extends ContainerBase
 
         String oldDisplayName = this.displayName;
         this.displayName = displayName;
-        support.firePropertyChange("displayName", oldDisplayName,
-                                   this.displayName);
+        support.firePropertyChange("displayName", oldDisplayName, this.displayName);
     }
 
 
@@ -1825,9 +1734,7 @@ public class StandardContext extends ContainerBase
     public void setDistributable(boolean distributable) {
         boolean oldDistributable = this.distributable;
         this.distributable = distributable;
-        support.firePropertyChange("distributable",
-                                   oldDistributable,
-                                   this.distributable);
+        support.firePropertyChange("distributable", oldDistributable, this.distributable);
     }
 
 
@@ -1886,8 +1793,7 @@ public class StandardContext extends ContainerBase
             this.loader = loader;
 
             // Stop the old component if necessary
-            if (getState().isAvailable() && (oldLoader != null) &&
-                (oldLoader instanceof Lifecycle)) {
+            if (getState().isAvailable() && (oldLoader != null) && (oldLoader instanceof Lifecycle)) {
                 try {
                     ((Lifecycle) oldLoader).stop();
                 } catch (LifecycleException e) {
@@ -1899,8 +1805,7 @@ public class StandardContext extends ContainerBase
             if (loader != null) {
                 loader.setContext(this);
             }
-            if (getState().isAvailable() && (loader != null) &&
-                (loader instanceof Lifecycle)) {
+            if (getState().isAvailable() && (loader != null) && (loader instanceof Lifecycle)) {
                 try {
                     ((Lifecycle) loader).start();
                 } catch (LifecycleException e) {
@@ -1982,8 +1887,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Set the boolean on the annotations parsing for this web
-     * application.
+     * Set the boolean on the annotations parsing for this web application.
      *
      * @param ignoreAnnotations The boolean on the annotations parsing
      */
@@ -1991,8 +1895,7 @@ public class StandardContext extends ContainerBase
     public void setIgnoreAnnotations(boolean ignoreAnnotations) {
         boolean oldIgnoreAnnotations = this.ignoreAnnotations;
         this.ignoreAnnotations = ignoreAnnotations;
-        support.firePropertyChange("ignoreAnnotations", oldIgnoreAnnotations,
-                this.ignoreAnnotations);
+        support.firePropertyChange("ignoreAnnotations", oldIgnoreAnnotations, this.ignoreAnnotations);
     }
 
 
@@ -2015,43 +1918,35 @@ public class StandardContext extends ContainerBase
 
         // Validate the incoming property value
         if (config == null) {
-            throw new IllegalArgumentException
-                (sm.getString("standardContext.loginConfig.required"));
+            throw new IllegalArgumentException(sm.getString("standardContext.loginConfig.required"));
         }
         String loginPage = config.getLoginPage();
         if ((loginPage != null) && !loginPage.startsWith("/")) {
             if (isServlet22()) {
-                if(log.isDebugEnabled()) {
-                    log.debug(sm.getString("standardContext.loginConfig.loginWarning",
-                                 loginPage));
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("standardContext.loginConfig.loginWarning", loginPage));
                 }
                 config.setLoginPage("/" + loginPage);
             } else {
-                throw new IllegalArgumentException
-                    (sm.getString("standardContext.loginConfig.loginPage",
-                                  loginPage));
+                throw new IllegalArgumentException(sm.getString("standardContext.loginConfig.loginPage", loginPage));
             }
         }
         String errorPage = config.getErrorPage();
         if ((errorPage != null) && !errorPage.startsWith("/")) {
             if (isServlet22()) {
-                if(log.isDebugEnabled()) {
-                    log.debug(sm.getString("standardContext.loginConfig.errorWarning",
-                                 errorPage));
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("standardContext.loginConfig.errorWarning", errorPage));
                 }
                 config.setErrorPage("/" + errorPage);
             } else {
-                throw new IllegalArgumentException
-                    (sm.getString("standardContext.loginConfig.errorPage",
-                                  errorPage));
+                throw new IllegalArgumentException(sm.getString("standardContext.loginConfig.errorPage", errorPage));
             }
         }
 
         // Process the property setting change
         LoginConfig oldLoginConfig = this.loginConfig;
         this.loginConfig = config;
-        support.firePropertyChange("loginConfig",
-                                   oldLoginConfig, this.loginConfig);
+        support.firePropertyChange("loginConfig", oldLoginConfig, this.loginConfig);
 
     }
 
@@ -2082,11 +1977,9 @@ public class StandardContext extends ContainerBase
         if (namingResources != null) {
             namingResources.setContainer(this);
         }
-        support.firePropertyChange("namingResources",
-                                   oldNamingResources, this.namingResources);
+        support.firePropertyChange("namingResources", oldNamingResources, this.namingResources);
 
-        if (getState() == LifecycleState.NEW ||
-                getState() == LifecycleState.INITIALIZING ||
+        if (getState() == LifecycleState.NEW || getState() == LifecycleState.INITIALIZING ||
                 getState() == LifecycleState.INITIALIZED) {
             // NEW will occur if Context is defined in server.xml
             // At this point getObjectKeyPropertiesNameOnly() will trigger an
@@ -2151,8 +2044,7 @@ public class StandardContext extends ContainerBase
             this.path = this.path.substring(0, this.path.length() - 1);
         }
         if (invalid) {
-            log.warn(sm.getString(
-                    "standardContext.pathInvalid", path, this.path));
+            log.warn(sm.getString("standardContext.pathInvalid", path, this.path));
         }
         encodedPath = URLEncoder.DEFAULT.encode(this.path, StandardCharsets.UTF_8);
         if (getName() == null) {
@@ -2162,8 +2054,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the public identifier of the deployment descriptor DTD that is
-     * currently being parsed.
+     * @return the public identifier of the deployment descriptor DTD that is currently being parsed.
      */
     @Override
     public String getPublicId() {
@@ -2172,8 +2063,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Set the public identifier of the deployment descriptor DTD that is
-     * currently being parsed.
+     * Set the public identifier of the deployment descriptor DTD that is currently being parsed.
      *
      * @param publicId The public identifier
      */
@@ -2181,8 +2071,7 @@ public class StandardContext extends ContainerBase
     public void setPublicId(String publicId) {
 
         if (log.isDebugEnabled()) {
-            log.debug("Setting deployment descriptor public ID to '" +
-                publicId + "'");
+            log.debug("Setting deployment descriptor public ID to '" + publicId + "'");
         }
 
         String oldPublicId = this.publicId;
@@ -2211,17 +2100,15 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the original document root for this Context.  This can be an absolute
-     * pathname, a relative pathname, or a URL.
-     * Is only set as deployment has change docRoot!
+     * @return the original document root for this Context. This can be an absolute pathname, a relative pathname, or a
+     *             URL. Is only set as deployment has change docRoot!
      */
     public String getOriginalDocBase() {
         return this.originalDocBase;
     }
 
     /**
-     * Set the original document root for this Context.  This can be an absolute
-     * pathname, a relative pathname, or a URL.
+     * Set the original document root for this Context. This can be an absolute pathname, a relative pathname, or a URL.
      *
      * @param docBase The original document root
      */
@@ -2232,9 +2119,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the parent class loader (if any) for this web application.
-     * This call is meaningful only <strong>after</strong> a Loader has
-     * been configured.
+     * @return the parent class loader (if any) for this web application. This call is meaningful only
+     *             <strong>after</strong> a Loader has been configured.
      */
     @Override
     public ClassLoader getParentClassLoader() {
@@ -2269,9 +2155,7 @@ public class StandardContext extends ContainerBase
 
         boolean oldPrivileged = this.privileged;
         this.privileged = privileged;
-        support.firePropertyChange("privileged",
-                                   oldPrivileged,
-                                   this.privileged);
+        support.firePropertyChange("privileged", oldPrivileged, this.privileged);
 
     }
 
@@ -2286,9 +2170,7 @@ public class StandardContext extends ContainerBase
 
         boolean oldReloadable = this.reloadable;
         this.reloadable = reloadable;
-        support.firePropertyChange("reloadable",
-                                   oldReloadable,
-                                   this.reloadable);
+        support.firePropertyChange("reloadable", oldReloadable, this.reloadable);
 
     }
 
@@ -2303,9 +2185,7 @@ public class StandardContext extends ContainerBase
 
         boolean oldOverride = this.override;
         this.override = override;
-        support.firePropertyChange("override",
-                                   oldOverride,
-                                   this.override);
+        support.firePropertyChange("override", oldOverride, this.override);
 
     }
 
@@ -2319,9 +2199,7 @@ public class StandardContext extends ContainerBase
 
         boolean oldReplaceWelcomeFiles = this.replaceWelcomeFiles;
         this.replaceWelcomeFiles = replaceWelcomeFiles;
-        support.firePropertyChange("replaceWelcomeFiles",
-                                   oldReplaceWelcomeFiles,
-                                   this.replaceWelcomeFiles);
+        support.firePropertyChange("replaceWelcomeFiles", oldReplaceWelcomeFiles, this.replaceWelcomeFiles);
 
     }
 
@@ -2334,7 +2212,7 @@ public class StandardContext extends ContainerBase
         if (context == null) {
             context = new ApplicationContext(this);
             if (altDDName != null) {
-                context.setAttribute(Globals.ALT_DD_ATTR,altDDName);
+                context.setAttribute(Globals.ALT_DD_ATTR, altDDName);
             }
         }
         return context.getFacade();
@@ -2342,8 +2220,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the default session timeout (in minutes) for this
-     * web application.
+     * @return the default session timeout (in minutes) for this web application.
      */
     @Override
     public int getSessionTimeout() {
@@ -2352,8 +2229,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Set the default session timeout (in minutes) for this
-     * web application.
+     * Set the default session timeout (in minutes) for this web application.
      *
      * @param timeout The new default session timeout
      */
@@ -2362,14 +2238,11 @@ public class StandardContext extends ContainerBase
 
         int oldSessionTimeout = this.sessionTimeout;
         /*
-         * SRV.13.4 ("Deployment Descriptor"):
-         * If the timeout is 0 or less, the container ensures the default
-         * behaviour of sessions is never to time out.
+         * SRV.13.4 ("Deployment Descriptor"): If the timeout is 0 or less, the container ensures the default behaviour
+         * of sessions is never to time out.
          */
         this.sessionTimeout = (timeout == 0) ? -1 : timeout;
-        support.firePropertyChange("sessionTimeout",
-                                   oldSessionTimeout,
-                                   this.sessionTimeout);
+        support.firePropertyChange("sessionTimeout", oldSessionTimeout, this.sessionTimeout);
 
     }
 
@@ -2384,9 +2257,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Set the value of the swallowOutput flag. If set to true, the system.out
-     * and system.err will be redirected to the logger during a servlet
-     * execution.
+     * Set the value of the swallowOutput flag. If set to true, the system.out and system.err will be redirected to the
+     * logger during a servlet execution.
      *
      * @param swallowOutput The new value
      */
@@ -2395,9 +2267,7 @@ public class StandardContext extends ContainerBase
 
         boolean oldSwallowOutput = this.swallowOutput;
         this.swallowOutput = swallowOutput;
-        support.firePropertyChange("swallowOutput",
-                                   oldSwallowOutput,
-                                   this.swallowOutput);
+        support.firePropertyChange("swallowOutput", oldSwallowOutput, this.swallowOutput);
 
     }
 
@@ -2411,10 +2281,9 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Set the value of the unloadDelay flag, which represents the amount
-     * of ms that the container will wait when unloading servlets.
-     * Setting this to a small value may cause more requests to fail
-     * to complete when stopping a web application.
+     * Set the value of the unloadDelay flag, which represents the amount of ms that the container will wait when
+     * unloading servlets. Setting this to a small value may cause more requests to fail to complete when stopping a web
+     * application.
      *
      * @param unloadDelay The new value
      */
@@ -2422,9 +2291,7 @@ public class StandardContext extends ContainerBase
 
         long oldUnloadDelay = this.unloadDelay;
         this.unloadDelay = unloadDelay;
-        support.firePropertyChange("unloadDelay",
-                                   Long.valueOf(oldUnloadDelay),
-                                   Long.valueOf(this.unloadDelay));
+        support.firePropertyChange("unloadDelay", Long.valueOf(oldUnloadDelay), Long.valueOf(this.unloadDelay));
 
     }
 
@@ -2448,11 +2315,11 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Flag which indicates if bundled context.xml files should be copied to the
-     * config folder. The doesn't occur by default.
+     * Flag which indicates if bundled context.xml files should be copied to the config folder. The doesn't occur by
+     * default.
      *
-     * @return <code>true</code> if the <code>META-INF/context.xml</code> file included
-     *     in a WAR will be copied to the host configuration base folder on deployment
+     * @return <code>true</code> if the <code>META-INF/context.xml</code> file included in a WAR will be copied to the
+     *             host configuration base folder on deployment
      */
     public boolean getCopyXML() {
         return copyXML;
@@ -2460,8 +2327,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Allows copying a bundled context.xml file to the host configuration base
-     * folder on deployment.
+     * Allows copying a bundled context.xml file to the host configuration base folder on deployment.
      *
      * @param copyXML the new flag value
      */
@@ -2471,8 +2337,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the Java class name of the Wrapper implementation used
-     * for servlets registered in this Context.
+     * @return the Java class name of the Wrapper implementation used for servlets registered in this Context.
      */
     @Override
     public String getWrapperClass() {
@@ -2481,13 +2346,12 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Set the Java class name of the Wrapper implementation used
-     * for servlets registered in this Context.
+     * Set the Java class name of the Wrapper implementation used for servlets registered in this Context.
      *
      * @param wrapperClassName The new wrapper class name
      *
-     * @throws IllegalArgumentException if the specified wrapper class
-     * cannot be found or is not a subclass of StandardWrapper
+     * @throws IllegalArgumentException if the specified wrapper class cannot be found or is not a subclass of
+     *                                      StandardWrapper
      */
     @Override
     public void setWrapperClass(String wrapperClassName) {
@@ -2498,8 +2362,7 @@ public class StandardContext extends ContainerBase
             wrapperClass = Class.forName(wrapperClassName);
             if (!StandardWrapper.class.isAssignableFrom(wrapperClass)) {
                 throw new IllegalArgumentException(
-                    sm.getString("standardContext.invalidWrapperClass",
-                                 wrapperClassName));
+                        sm.getString("standardContext.invalidWrapperClass", wrapperClassName));
             }
         } catch (ClassNotFoundException cnfe) {
             throw new IllegalArgumentException(cnfe.getMessage());
@@ -2527,8 +2390,7 @@ public class StandardContext extends ContainerBase
         WebResourceRoot oldResources = null;
         try {
             if (getState().isAvailable()) {
-                throw new IllegalStateException
-                    (sm.getString("standardContext.resourcesStart"));
+                throw new IllegalStateException(sm.getString("standardContext.resourcesStart"));
             }
 
             oldResources = this.resources;
@@ -2544,8 +2406,7 @@ public class StandardContext extends ContainerBase
                 resources.setContext(this);
             }
 
-            support.firePropertyChange("resources", oldResources,
-                    resources);
+            support.firePropertyChange("resources", oldResources, resources);
         } finally {
             writeLock.unlock();
         }
@@ -2576,8 +2437,8 @@ public class StandardContext extends ContainerBase
     // ------------------------------------------------------ Public Properties
 
     /**
-     * @return whether or not an attempt to modify the JNDI context will trigger
-     * an exception or if the request will be ignored.
+     * @return whether or not an attempt to modify the JNDI context will trigger an exception or if the request will be
+     *             ignored.
      */
     public boolean getJndiExceptionOnFailedWrite() {
         return jndiExceptionOnFailedWrite;
@@ -2585,13 +2446,12 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Controls whether or not an attempt to modify the JNDI context will
-     * trigger an exception or if the request will be ignored.
+     * Controls whether or not an attempt to modify the JNDI context will trigger an exception or if the request will be
+     * ignored.
      *
      * @param jndiExceptionOnFailedWrite <code>false</code> to avoid an exception
      */
-    public void setJndiExceptionOnFailedWrite(
-            boolean jndiExceptionOnFailedWrite) {
+    public void setJndiExceptionOnFailedWrite(boolean jndiExceptionOnFailedWrite) {
         this.jndiExceptionOnFailedWrite = jndiExceptionOnFailedWrite;
     }
 
@@ -2613,9 +2473,7 @@ public class StandardContext extends ContainerBase
 
         String oldCharsetMapperClass = this.charsetMapperClass;
         this.charsetMapperClass = mapper;
-        support.firePropertyChange("charsetMapperClass",
-                                   oldCharsetMapperClass,
-                                   this.charsetMapperClass);
+        support.firePropertyChange("charsetMapperClass", oldCharsetMapperClass, this.charsetMapperClass);
 
     }
 
@@ -2632,11 +2490,9 @@ public class StandardContext extends ContainerBase
         File workDir = new File(getWorkDir());
         if (!workDir.isAbsolute()) {
             try {
-                workDir = new File(getCatalinaBase().getCanonicalFile(),
-                        getWorkDir());
+                workDir = new File(getCatalinaBase().getCanonicalFile(), getWorkDir());
             } catch (IOException e) {
-                log.warn(sm.getString("standardContext.workPath", getName()),
-                        e);
+                log.warn(sm.getString("standardContext.workPath", getName()), e);
             }
         }
         return workDir.getAbsolutePath();
@@ -2673,8 +2529,8 @@ public class StandardContext extends ContainerBase
     public void setClearReferencesRmiTargets(boolean clearReferencesRmiTargets) {
         boolean oldClearReferencesRmiTargets = this.clearReferencesRmiTargets;
         this.clearReferencesRmiTargets = clearReferencesRmiTargets;
-        support.firePropertyChange("clearReferencesRmiTargets",
-                oldClearReferencesRmiTargets, this.clearReferencesRmiTargets);
+        support.firePropertyChange("clearReferencesRmiTargets", oldClearReferencesRmiTargets,
+                this.clearReferencesRmiTargets);
     }
 
 
@@ -2691,14 +2547,12 @@ public class StandardContext extends ContainerBase
      *
      * @param clearReferencesStopThreads The new flag value
      */
-    public void setClearReferencesStopThreads(
-            boolean clearReferencesStopThreads) {
+    public void setClearReferencesStopThreads(boolean clearReferencesStopThreads) {
 
         boolean oldClearReferencesStopThreads = this.clearReferencesStopThreads;
         this.clearReferencesStopThreads = clearReferencesStopThreads;
-        support.firePropertyChange("clearReferencesStopThreads",
-                                   oldClearReferencesStopThreads,
-                                   this.clearReferencesStopThreads);
+        support.firePropertyChange("clearReferencesStopThreads", oldClearReferencesStopThreads,
+                this.clearReferencesStopThreads);
 
     }
 
@@ -2716,21 +2570,17 @@ public class StandardContext extends ContainerBase
      *
      * @param clearReferencesStopTimerThreads The new flag value
      */
-    public void setClearReferencesStopTimerThreads(
-            boolean clearReferencesStopTimerThreads) {
+    public void setClearReferencesStopTimerThreads(boolean clearReferencesStopTimerThreads) {
 
-        boolean oldClearReferencesStopTimerThreads =
-            this.clearReferencesStopTimerThreads;
+        boolean oldClearReferencesStopTimerThreads = this.clearReferencesStopTimerThreads;
         this.clearReferencesStopTimerThreads = clearReferencesStopTimerThreads;
-        support.firePropertyChange("clearReferencesStopTimerThreads",
-                                   oldClearReferencesStopTimerThreads,
-                                   this.clearReferencesStopTimerThreads);
+        support.firePropertyChange("clearReferencesStopTimerThreads", oldClearReferencesStopTimerThreads,
+                this.clearReferencesStopTimerThreads);
     }
 
 
     /**
-     * @return the clearReferencesHttpClientKeepAliveThread flag for this
-     * Context.
+     * @return the clearReferencesHttpClientKeepAliveThread flag for this Context.
      */
     public boolean getClearReferencesHttpClientKeepAliveThread() {
         return this.clearReferencesHttpClientKeepAliveThread;
@@ -2738,15 +2588,12 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Set the clearReferencesHttpClientKeepAliveThread feature for this
-     * Context.
+     * Set the clearReferencesHttpClientKeepAliveThread feature for this Context.
      *
      * @param clearReferencesHttpClientKeepAliveThread The new flag value
      */
-    public void setClearReferencesHttpClientKeepAliveThread(
-            boolean clearReferencesHttpClientKeepAliveThread) {
-        this.clearReferencesHttpClientKeepAliveThread =
-            clearReferencesHttpClientKeepAliveThread;
+    public void setClearReferencesHttpClientKeepAliveThread(boolean clearReferencesHttpClientKeepAliveThread) {
+        this.clearReferencesHttpClientKeepAliveThread = clearReferencesHttpClientKeepAliveThread;
     }
 
 
@@ -2754,13 +2601,10 @@ public class StandardContext extends ContainerBase
         return this.renewThreadsWhenStoppingContext;
     }
 
-    public void setRenewThreadsWhenStoppingContext(
-            boolean renewThreadsWhenStoppingContext) {
-        boolean oldRenewThreadsWhenStoppingContext =
-                this.renewThreadsWhenStoppingContext;
+    public void setRenewThreadsWhenStoppingContext(boolean renewThreadsWhenStoppingContext) {
+        boolean oldRenewThreadsWhenStoppingContext = this.renewThreadsWhenStoppingContext;
         this.renewThreadsWhenStoppingContext = renewThreadsWhenStoppingContext;
-        support.firePropertyChange("renewThreadsWhenStoppingContext",
-                oldRenewThreadsWhenStoppingContext,
+        support.firePropertyChange("renewThreadsWhenStoppingContext", oldRenewThreadsWhenStoppingContext,
                 this.renewThreadsWhenStoppingContext);
     }
 
@@ -2770,13 +2614,10 @@ public class StandardContext extends ContainerBase
     }
 
 
-    public void setClearReferencesObjectStreamClassCaches(
-            boolean clearReferencesObjectStreamClassCaches) {
-        boolean oldClearReferencesObjectStreamClassCaches =
-                this.clearReferencesObjectStreamClassCaches;
+    public void setClearReferencesObjectStreamClassCaches(boolean clearReferencesObjectStreamClassCaches) {
+        boolean oldClearReferencesObjectStreamClassCaches = this.clearReferencesObjectStreamClassCaches;
         this.clearReferencesObjectStreamClassCaches = clearReferencesObjectStreamClassCaches;
-        support.firePropertyChange("clearReferencesObjectStreamClassCaches",
-                oldClearReferencesObjectStreamClassCaches,
+        support.firePropertyChange("clearReferencesObjectStreamClassCaches", oldClearReferencesObjectStreamClassCaches,
                 this.clearReferencesObjectStreamClassCaches);
     }
 
@@ -2789,8 +2630,7 @@ public class StandardContext extends ContainerBase
     public void setClearReferencesThreadLocals(boolean clearReferencesThreadLocals) {
         boolean oldClearReferencesThreadLocals = this.clearReferencesThreadLocals;
         this.clearReferencesThreadLocals = clearReferencesThreadLocals;
-        support.firePropertyChange("clearReferencesThreadLocals",
-                oldClearReferencesThreadLocals,
+        support.firePropertyChange("clearReferencesThreadLocals", oldClearReferencesThreadLocals,
                 this.clearReferencesThreadLocals);
     }
 
@@ -2809,32 +2649,29 @@ public class StandardContext extends ContainerBase
         return failCtxIfServletStartFails;
     }
 
-    public void setFailCtxIfServletStartFails(
-            Boolean failCtxIfServletStartFails) {
+    public void setFailCtxIfServletStartFails(Boolean failCtxIfServletStartFails) {
         Boolean oldFailCtxIfServletStartFails = this.failCtxIfServletStartFails;
         this.failCtxIfServletStartFails = failCtxIfServletStartFails;
-        support.firePropertyChange("failCtxIfServletStartFails",
-                oldFailCtxIfServletStartFails,
+        support.firePropertyChange("failCtxIfServletStartFails", oldFailCtxIfServletStartFails,
                 failCtxIfServletStartFails);
     }
 
     protected boolean getComputedFailCtxIfServletStartFails() {
-        if(failCtxIfServletStartFails != null) {
+        if (failCtxIfServletStartFails != null) {
             return failCtxIfServletStartFails.booleanValue();
         }
-        //else look at Host config
-        if(getParent() instanceof StandardHost) {
-            return ((StandardHost)getParent()).isFailCtxIfServletStartFails();
+        // else look at Host config
+        if (getParent() instanceof StandardHost) {
+            return ((StandardHost) getParent()).isFailCtxIfServletStartFails();
         }
-        //else
+        // else
         return false;
     }
 
     // -------------------------------------------------------- Context Methods
 
     /**
-     * Add a new Listener class name to the set of Listeners
-     * configured for this application.
+     * Add a new Listener class name to the set of Listeners configured for this application.
      *
      * @param listener Java class name of a listener class
      */
@@ -2845,7 +2682,7 @@ public class StandardContext extends ContainerBase
             String results[] = new String[applicationListeners.length + 1];
             for (int i = 0; i < applicationListeners.length; i++) {
                 if (listener.equals(applicationListeners[i])) {
-                    log.info(sm.getString("standardContext.duplicateListener",listener));
+                    log.info(sm.getString("standardContext.duplicateListener", listener));
                     return;
                 }
                 results[i] = applicationListeners[i];
@@ -2873,8 +2710,7 @@ public class StandardContext extends ContainerBase
                     return;
                 }
             }
-            ApplicationParameter results[] = Arrays.copyOf(
-                    applicationParameters, applicationParameters.length + 1);
+            ApplicationParameter results[] = Arrays.copyOf(applicationParameters, applicationParameters.length + 1);
             results[applicationParameters.length] = parameter;
             applicationParameters = results;
         }
@@ -2884,13 +2720,11 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Add a child Container, only if the proposed child is an implementation
-     * of Wrapper.
+     * Add a child Container, only if the proposed child is an implementation of Wrapper.
      *
      * @param child Child container to be added
      *
-     * @exception IllegalArgumentException if the proposed container is
-     *  not an implementation of Wrapper
+     * @exception IllegalArgumentException if the proposed container is not an implementation of Wrapper
      */
     @Override
     public void addChild(Container child) {
@@ -2899,8 +2733,7 @@ public class StandardContext extends ContainerBase
         Wrapper oldJspServlet = null;
 
         if (!(child instanceof Wrapper)) {
-            throw new IllegalArgumentException
-                (sm.getString("standardContext.notWrapper"));
+            throw new IllegalArgumentException(sm.getString("standardContext.notWrapper"));
         }
 
         boolean isJspServlet = "jsp".equals(child.getName());
@@ -2917,11 +2750,11 @@ public class StandardContext extends ContainerBase
 
         if (isJspServlet && oldJspServlet != null) {
             /*
-             * The webapp-specific JspServlet inherits all the mappings
-             * specified in the global web.xml, and may add additional ones.
+             * The webapp-specific JspServlet inherits all the mappings specified in the global web.xml, and may add
+             * additional ones.
              */
             String[] jspMappings = oldJspServlet.findMappings();
-            for (int i=0; jspMappings!=null && i<jspMappings.length; i++) {
+            for (int i = 0; jspMappings != null && i < jspMappings.length; i++) {
                 addServletMappingDecoded(jspMappings[i], child.getName());
             }
         }
@@ -2943,16 +2776,12 @@ public class StandardContext extends ContainerBase
             for (int j = 0; j < patterns.length; j++) {
                 patterns[j] = adjustURLPattern(patterns[j]);
                 if (!validateURLPattern(patterns[j])) {
-                    throw new IllegalArgumentException
-                            (sm.getString
-                                    ("standardContext.securityConstraint.pattern",
-                                            patterns[j]));
+                    throw new IllegalArgumentException(
+                            sm.getString("standardContext.securityConstraint.pattern", patterns[j]));
                 }
             }
-            if (collection.findMethods().length > 0 &&
-                    collection.findOmittedMethods().length > 0) {
-                throw new IllegalArgumentException(sm.getString(
-                        "standardContext.securityConstraint.mixHttpMethod"));
+            if (collection.findMethods().length > 0 && collection.findOmittedMethods().length > 0) {
+                throw new IllegalArgumentException(sm.getString("standardContext.securityConstraint.mixHttpMethod"));
             }
         }
 
@@ -2966,7 +2795,6 @@ public class StandardContext extends ContainerBase
     }
 
 
-
     /**
      * Add an error page for the specified error or Java exception.
      *
@@ -2976,21 +2804,17 @@ public class StandardContext extends ContainerBase
     public void addErrorPage(ErrorPage errorPage) {
         // Validate the input parameters
         if (errorPage == null) {
-            throw new IllegalArgumentException
-                (sm.getString("standardContext.errorPage.required"));
+            throw new IllegalArgumentException(sm.getString("standardContext.errorPage.required"));
         }
         String location = errorPage.getLocation();
         if ((location != null) && !location.startsWith("/")) {
             if (isServlet22()) {
-                if(log.isDebugEnabled()) {
-                    log.debug(sm.getString("standardContext.errorPage.warning",
-                                 location));
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("standardContext.errorPage.warning", location));
                 }
                 errorPage.setLocation("/" + location);
             } else {
-                throw new IllegalArgumentException
-                    (sm.getString("standardContext.errorPage.error",
-                                  location));
+                throw new IllegalArgumentException(sm.getString("standardContext.errorPage.error", location));
             }
         }
 
@@ -3016,14 +2840,12 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Add a filter mapping to this Context at the end of the current set
-     * of filter mappings.
+     * Add a filter mapping to this Context at the end of the current set of filter mappings.
      *
      * @param filterMap The filter mapping to be added
      *
-     * @exception IllegalArgumentException if the specified filter name
-     *  does not match an existing filter definition, or the filter mapping
-     *  is malformed
+     * @exception IllegalArgumentException if the specified filter name does not match an existing filter definition, or
+     *                                         the filter mapping is malformed
      */
     @Override
     public void addFilterMap(FilterMap filterMap) {
@@ -3035,14 +2857,13 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Add a filter mapping to this Context before the mappings defined in the
-     * deployment descriptor but after any other mappings added via this method.
+     * Add a filter mapping to this Context before the mappings defined in the deployment descriptor but after any other
+     * mappings added via this method.
      *
      * @param filterMap The filter mapping to be added
      *
-     * @exception IllegalArgumentException if the specified filter name
-     *  does not match an existing filter definition, or the filter mapping
-     *  is malformed
+     * @exception IllegalArgumentException if the specified filter name does not match an existing filter definition, or
+     *                                         the filter mapping is malformed
      */
     @Override
     public void addFilterMapBefore(FilterMap filterMap) {
@@ -3064,21 +2885,16 @@ public class StandardContext extends ContainerBase
         String[] servletNames = filterMap.getServletNames();
         String[] urlPatterns = filterMap.getURLPatterns();
         if (findFilterDef(filterName) == null) {
-            throw new IllegalArgumentException
-                (sm.getString("standardContext.filterMap.name", filterName));
+            throw new IllegalArgumentException(sm.getString("standardContext.filterMap.name", filterName));
         }
 
-        if (!filterMap.getMatchAllServletNames() &&
-            !filterMap.getMatchAllUrlPatterns() &&
-            (servletNames.length == 0) && (urlPatterns.length == 0)) {
-            throw new IllegalArgumentException
-                (sm.getString("standardContext.filterMap.either"));
+        if (!filterMap.getMatchAllServletNames() && !filterMap.getMatchAllUrlPatterns() && (servletNames.length == 0) &&
+                (urlPatterns.length == 0)) {
+            throw new IllegalArgumentException(sm.getString("standardContext.filterMap.either"));
         }
         for (String urlPattern : urlPatterns) {
             if (!validateURLPattern(urlPattern)) {
-                throw new IllegalArgumentException
-                        (sm.getString("standardContext.filterMap.pattern",
-                                urlPattern));
+                throw new IllegalArgumentException(sm.getString("standardContext.filterMap.pattern", urlPattern));
             }
         }
     }
@@ -3087,11 +2903,11 @@ public class StandardContext extends ContainerBase
     /**
      * Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)
      *
-     * @param locale locale to map an encoding for
+     * @param locale   locale to map an encoding for
      * @param encoding encoding to be used for a give locale
      */
     @Override
-    public void addLocaleEncodingMappingParameter(String locale, String encoding){
+    public void addLocaleEncodingMappingParameter(String locale, String encoding) {
         getCharsetMapper().addCharsetMappingFromDeploymentDescriptor(locale, encoding);
     }
 
@@ -3116,8 +2932,7 @@ public class StandardContext extends ContainerBase
      *
      * @param mdr New message destination reference
      *
-     * @deprecated This will be removed in Tomcat 10.
-     *             Use {@link #getNamingResources()} instead
+     * @deprecated This will be removed in Tomcat 10. Use {@link #getNamingResources()} instead
      */
     @Deprecated
     public void addMessageDestinationRef(MessageDestinationRef mdr) {
@@ -3126,11 +2941,10 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Add a new MIME mapping, replacing any existing mapping for
-     * the specified extension.
+     * Add a new MIME mapping, replacing any existing mapping for the specified extension.
      *
      * @param extension Filename extension being mapped
-     * @param mimeType Corresponding MIME type
+     * @param mimeType  Corresponding MIME type
      */
     @Override
     public void addMimeMapping(String extension, String mimeType) {
@@ -3146,27 +2960,24 @@ public class StandardContext extends ContainerBase
     /**
      * Add a new context initialization parameter.
      *
-     * @param name Name of the new parameter
-     * @param value Value of the new  parameter
+     * @param name  Name of the new parameter
+     * @param value Value of the new parameter
      *
-     * @exception IllegalArgumentException if the name or value is missing,
-     *  or if this context initialization parameter has already been
-     *  registered
+     * @exception IllegalArgumentException if the name or value is missing, or if this context initialization parameter
+     *                                         has already been registered
      */
     @Override
     public void addParameter(String name, String value) {
         // Validate the proposed context initialization parameter
         if ((name == null) || (value == null)) {
-            throw new IllegalArgumentException
-                (sm.getString("standardContext.parameter.required"));
+            throw new IllegalArgumentException(sm.getString("standardContext.parameter.required"));
         }
 
         // Add this parameter to our defined set if not already present
         String oldValue = parameters.putIfAbsent(name, value);
 
         if (oldValue != null) {
-            throw new IllegalArgumentException(
-                    sm.getString("standardContext.parameter.duplicate", name));
+            throw new IllegalArgumentException(sm.getString("standardContext.parameter.duplicate", name));
         }
 
         fireContainerEvent("addParameter", name);
@@ -3209,29 +3020,23 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Add a new servlet mapping, replacing any existing mapping for
-     * the specified pattern.
+     * Add a new servlet mapping, replacing any existing mapping for the specified pattern.
      *
-     * @param pattern URL pattern to be mapped
-     * @param name Name of the corresponding servlet to execute
-     * @param jspWildCard true if name identifies the JspServlet
-     * and pattern contains a wildcard; false otherwise
+     * @param pattern     URL pattern to be mapped
+     * @param name        Name of the corresponding servlet to execute
+     * @param jspWildCard true if name identifies the JspServlet and pattern contains a wildcard; false otherwise
      *
-     * @exception IllegalArgumentException if the specified servlet name
-     *  is not known to this Context
+     * @exception IllegalArgumentException if the specified servlet name is not known to this Context
      */
     @Override
-    public void addServletMappingDecoded(String pattern, String name,
-                                  boolean jspWildCard) {
+    public void addServletMappingDecoded(String pattern, String name, boolean jspWildCard) {
         // Validate the proposed mapping
         if (findChild(name) == null) {
-            throw new IllegalArgumentException
-                (sm.getString("standardContext.servletMap.name", name));
+            throw new IllegalArgumentException(sm.getString("standardContext.servletMap.name", name));
         }
         String adjustedPattern = adjustURLPattern(pattern);
         if (!validateURLPattern(adjustedPattern)) {
-            throw new IllegalArgumentException
-                (sm.getString("standardContext.servletMap.pattern", adjustedPattern));
+            throw new IllegalArgumentException(sm.getString("standardContext.servletMap.pattern", adjustedPattern));
         }
 
         // Add this mapping to our registered set
@@ -3288,15 +3093,14 @@ public class StandardContext extends ContainerBase
             results[welcomeFiles.length] = name;
             welcomeFiles = results;
         }
-        if(this.getState().equals(LifecycleState.STARTED)) {
+        if (this.getState().equals(LifecycleState.STARTED)) {
             fireContainerEvent(ADD_WELCOME_FILE_EVENT, name);
         }
     }
 
 
     /**
-     * Add the classname of a LifecycleListener to be added to each
-     * Wrapper appended to this Context.
+     * Add the classname of a LifecycleListener to be added to each Wrapper appended to this Context.
      *
      * @param listener Java class name of a LifecycleListener class
      */
@@ -3314,8 +3118,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Add the classname of a ContainerListener to be added to each
-     * Wrapper appended to this Context.
+     * Add the classname of a ContainerListener to be added to each Wrapper appended to this Context.
      *
      * @param listener Java class name of a ContainerListener class
      */
@@ -3333,10 +3136,9 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Factory method to create and return a new Wrapper instance, of
-     * the Java implementation class appropriate for this Context
-     * implementation.  The constructor of the instantiated Wrapper
-     * will have been called, but no properties will have been set.
+     * Factory method to create and return a new Wrapper instance, of the Java implementation class appropriate for this
+     * Context implementation. The constructor of the instantiated Wrapper will have been called, but no properties will
+     * have been set.
      */
     @Override
     public Wrapper createWrapper() {
@@ -3358,8 +3160,7 @@ public class StandardContext extends ContainerBase
             for (String wrapperLifecycle : wrapperLifecycles) {
                 try {
                     Class<?> clazz = Class.forName(wrapperLifecycle);
-                    LifecycleListener listener =
-                            (LifecycleListener) clazz.getConstructor().newInstance();
+                    LifecycleListener listener = (LifecycleListener) clazz.getConstructor().newInstance();
                     wrapper.addLifecycleListener(listener);
                 } catch (Throwable t) {
                     ExceptionUtils.handleThrowable(t);
@@ -3373,8 +3174,7 @@ public class StandardContext extends ContainerBase
             for (String wrapperListener : wrapperListeners) {
                 try {
                     Class<?> clazz = Class.forName(wrapperListener);
-                    ContainerListener listener =
-                            (ContainerListener) clazz.getConstructor().newInstance();
+                    ContainerListener listener = (ContainerListener) clazz.getConstructor().newInstance();
                     wrapper.addContainerListener(listener);
                 } catch (Throwable t) {
                     ExceptionUtils.handleThrowable(t);
@@ -3389,8 +3189,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Return the set of application listener class names configured
-     * for this application.
+     * Return the set of application listener class names configured for this application.
      */
     @Override
     public String[] findApplicationListeners() {
@@ -3412,8 +3211,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Return the security constraints for this web application.
-     * If there are none, a zero-length array is returned.
+     * Return the security constraints for this web application. If there are none, a zero-length array is returned.
      */
     @Override
     public SecurityConstraint[] findConstraints() {
@@ -3422,8 +3220,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Return the error page entry for the specified HTTP error code,
-     * if any; otherwise return <code>null</code>.
+     * Return the error page entry for the specified HTTP error code, if any; otherwise return <code>null</code>.
      *
      * @param errorCode Error code to look up
      */
@@ -3447,8 +3244,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Return the set of defined error pages for all specified error codes
-     * and exception types.
+     * Return the set of defined error pages for all specified error codes and exception types.
      */
     @Override
     public ErrorPage[] findErrorPages() {
@@ -3457,8 +3253,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Return the filter definition for the specified filter name, if any;
-     * otherwise return <code>null</code>.
+     * Return the filter definition for the specified filter name, if any; otherwise return <code>null</code>.
      *
      * @param filterName Filter name to look up
      */
@@ -3491,8 +3286,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the message destination with the specified name, if any;
-     * otherwise, return <code>null</code>.
+     * @return the message destination with the specified name, if any; otherwise, return <code>null</code>.
      *
      * @param name Name of the desired message destination
      */
@@ -3504,9 +3298,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the set of defined message destinations for this web
-     * application.  If none have been defined, a zero-length array
-     * is returned.
+     * @return the set of defined message destinations for this web application. If none have been defined, a
+     *             zero-length array is returned.
      */
     public MessageDestination[] findMessageDestinations() {
         synchronized (messageDestinations) {
@@ -3518,11 +3311,9 @@ public class StandardContext extends ContainerBase
     /**
      * @param name Name of the desired message destination ref
      *
-     * @return the message destination ref with the specified name, if any;
-     * otherwise, return <code>null</code>.
+     * @return the message destination ref with the specified name, if any; otherwise, return <code>null</code>.
      *
-     * @deprecated This will be removed in Tomcat 10.
-     *             Use {@link #getNamingResources()} instead
+     * @deprecated This will be removed in Tomcat 10. Use {@link #getNamingResources()} instead
      */
     @Deprecated
     public MessageDestinationRef findMessageDestinationRef(String name) {
@@ -3531,12 +3322,10 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the set of defined message destination refs for this web
-     * application.  If none have been defined, a zero-length array
-     * is returned.
+     * @return the set of defined message destination refs for this web application. If none have been defined, a
+     *             zero-length array is returned.
      *
-     * @deprecated This will be removed in Tomcat 10.
-     *             Use {@link #getNamingResources()} instead
+     * @deprecated This will be removed in Tomcat 10. Use {@link #getNamingResources()} instead
      */
     @Deprecated
     public MessageDestinationRef[] findMessageDestinationRefs() {
@@ -3545,8 +3334,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the MIME type to which the specified extension is mapped,
-     * if any; otherwise return <code>null</code>.
+     * @return the MIME type to which the specified extension is mapped, if any; otherwise return <code>null</code>.
      *
      * @param extension Extension to map to a MIME type
      */
@@ -3557,8 +3345,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the extensions for which MIME mappings are defined.  If there
-     * are none, a zero-length array is returned.
+     * @return the extensions for which MIME mappings are defined. If there are none, a zero-length array is returned.
      */
     @Override
     public String[] findMimeMappings() {
@@ -3569,8 +3356,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the value for the specified context initialization
-     * parameter name, if any; otherwise return <code>null</code>.
+     * @return the value for the specified context initialization parameter name, if any; otherwise return
+     *             <code>null</code>.
      *
      * @param name Name of the parameter to return
      */
@@ -3581,9 +3368,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the names of all defined context initialization parameters
-     * for this Context.  If no parameters are defined, a zero-length
-     * array is returned.
+     * @return the names of all defined context initialization parameters for this Context. If no parameters are
+     *             defined, a zero-length array is returned.
      */
     @Override
     public String[] findParameters() {
@@ -3592,11 +3378,11 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * For the given security role (as used by an application), return the
-     * corresponding role name (as defined by the underlying Realm) if there
-     * is one.  Otherwise, return the specified role unchanged.
+     * For the given security role (as used by an application), return the corresponding role name (as defined by the
+     * underlying Realm) if there is one. Otherwise, return the specified role unchanged.
      *
      * @param role Security role to map
+     *
      * @return the role name
      */
     @Override
@@ -3614,8 +3400,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return <code>true</code> if the specified security role is defined
-     * for this application; otherwise return <code>false</code>.
+     * @return <code>true</code> if the specified security role is defined for this application; otherwise return
+     *             <code>false</code>.
      *
      * @param role Security role to verify
      */
@@ -3635,8 +3421,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the security roles defined for this application.  If none
-     * have been defined, a zero-length array is returned.
+     * @return the security roles defined for this application. If none have been defined, a zero-length array is
+     *             returned.
      */
     @Override
     public String[] findSecurityRoles() {
@@ -3647,8 +3433,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the servlet name mapped by the specified pattern (if any);
-     * otherwise return <code>null</code>.
+     * @return the servlet name mapped by the specified pattern (if any); otherwise return <code>null</code>.
      *
      * @param pattern Pattern for which a mapping is requested
      */
@@ -3661,8 +3446,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the patterns of all defined servlet mappings for this
-     * Context.  If no mappings are defined, a zero-length array is returned.
+     * @return the patterns of all defined servlet mappings for this Context. If no mappings are defined, a zero-length
+     *             array is returned.
      */
     @Override
     public String[] findServletMappings() {
@@ -3703,8 +3488,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return <code>true</code> if the specified welcome file is defined
-     * for this Context; otherwise return <code>false</code>.
+     * @return <code>true</code> if the specified welcome file is defined for this Context; otherwise return
+     *             <code>false</code>.
      *
      * @param name Welcome file to verify
      */
@@ -3724,8 +3509,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the set of watched resources for this Context. If none are
-     * defined, a zero length array will be returned.
+     * @return the set of watched resources for this Context. If none are defined, a zero length array will be returned.
      */
     @Override
     public String[] findWatchedResources() {
@@ -3736,8 +3520,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the set of welcome files defined for this Context.  If none are
-     * defined, a zero-length array is returned.
+     * @return the set of welcome files defined for this Context. If none are defined, a zero-length array is returned.
      */
     @Override
     public String[] findWelcomeFiles() {
@@ -3748,8 +3531,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the set of LifecycleListener classes that will be added to
-     * newly created Wrappers automatically.
+     * @return the set of LifecycleListener classes that will be added to newly created Wrappers automatically.
      */
     @Override
     public String[] findWrapperLifecycles() {
@@ -3760,8 +3542,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * @return the set of ContainerListener classes that will be added to
-     * newly created Wrappers automatically.
+     * @return the set of ContainerListener classes that will be added to newly created Wrappers automatically.
      */
     @Override
     public String[] findWrapperListeners() {
@@ -3774,30 +3555,24 @@ public class StandardContext extends ContainerBase
     /**
      * Reload this web application, if reloading is supported.
      * <p>
-     * <b>IMPLEMENTATION NOTE</b>:  This method is designed to deal with
-     * reloads required by changes to classes in the underlying repositories
-     * of our class loader and changes to the web.xml file. It does not handle
-     * changes to any context.xml file. If the context.xml has changed, you
-     * should stop this Context and create (and start) a new Context instance
-     * instead. Note that there is additional code in
-     * <code>CoyoteAdapter#postParseRequest()</code> to handle mapping requests
-     * to paused Contexts.
+     * <b>IMPLEMENTATION NOTE</b>: This method is designed to deal with reloads required by changes to classes in the
+     * underlying repositories of our class loader and changes to the web.xml file. It does not handle changes to any
+     * context.xml file. If the context.xml has changed, you should stop this Context and create (and start) a new
+     * Context instance instead. Note that there is additional code in <code>CoyoteAdapter#postParseRequest()</code> to
+     * handle mapping requests to paused Contexts.
      *
-     * @exception IllegalStateException if the <code>reloadable</code>
-     *  property is set to <code>false</code>.
+     * @exception IllegalStateException if the <code>reloadable</code> property is set to <code>false</code>.
      */
     @Override
     public synchronized void reload() {
 
         // Validate our current component state
         if (!getState().isAvailable()) {
-            throw new IllegalStateException
-                (sm.getString("standardContext.notStarted", getName()));
+            throw new IllegalStateException(sm.getString("standardContext.notStarted", getName()));
         }
 
-        if(log.isInfoEnabled()) {
-            log.info(sm.getString("standardContext.reloadingStarted",
-                    getName()));
+        if (log.isInfoEnabled()) {
+            log.info(sm.getString("standardContext.reloadingStarted", getName()));
         }
 
         // Stop accepting requests temporarily.
@@ -3806,30 +3581,26 @@ public class StandardContext extends ContainerBase
         try {
             stop();
         } catch (LifecycleException e) {
-            log.error(
-                sm.getString("standardContext.stoppingContext", getName()), e);
+            log.error(sm.getString("standardContext.stoppingContext", getName()), e);
         }
 
         try {
             start();
         } catch (LifecycleException e) {
-            log.error(
-                sm.getString("standardContext.startingContext", getName()), e);
+            log.error(sm.getString("standardContext.startingContext", getName()), e);
         }
 
         setPaused(false);
 
-        if(log.isInfoEnabled()) {
-            log.info(sm.getString("standardContext.reloadingCompleted",
-                    getName()));
+        if (log.isInfoEnabled()) {
+            log.info(sm.getString("standardContext.reloadingCompleted", getName()));
         }
 
     }
 
 
     /**
-     * Remove the specified application listener class from the set of
-     * listeners for this application.
+     * Remove the specified application listener class from the set of listeners for this application.
      *
      * @param listener Java class name of the listener to be removed
      */
@@ -3869,8 +3640,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Remove the application parameter with the specified name from
-     * the set for this application.
+     * Remove the application parameter with the specified name from the set for this application.
      *
      * @param name Name of the application parameter to remove
      */
@@ -3893,8 +3663,7 @@ public class StandardContext extends ContainerBase
 
             // Remove the specified parameter
             int j = 0;
-            ApplicationParameter results[] =
-                new ApplicationParameter[applicationParameters.length - 1];
+            ApplicationParameter results[] = new ApplicationParameter[applicationParameters.length - 1];
             for (int i = 0; i < applicationParameters.length; i++) {
                 if (i != n) {
                     results[j++] = applicationParameters[i];
@@ -3911,20 +3680,17 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Add a child Container, only if the proposed child is an implementation
-     * of Wrapper.
+     * Add a child Container, only if the proposed child is an implementation of Wrapper.
      *
      * @param child Child container to be added
      *
-     * @exception IllegalArgumentException if the proposed container is
-     *  not an implementation of Wrapper
+     * @exception IllegalArgumentException if the proposed container is not an implementation of Wrapper
      */
     @Override
     public void removeChild(Container child) {
 
         if (!(child instanceof Wrapper)) {
-            throw new IllegalArgumentException
-                (sm.getString("standardContext.notWrapper"));
+            throw new IllegalArgumentException(sm.getString("standardContext.notWrapper"));
         }
 
         super.removeChild(child);
@@ -3956,8 +3722,7 @@ public class StandardContext extends ContainerBase
 
             // Remove the specified constraint
             int j = 0;
-            SecurityConstraint results[] =
-                new SecurityConstraint[constraints.length - 1];
+            SecurityConstraint results[] = new SecurityConstraint[constraints.length - 1];
             for (int i = 0; i < constraints.length; i++) {
                 if (i != n) {
                     results[j++] = constraints[i];
@@ -3974,8 +3739,8 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Remove the error page for the specified error code or
-     * Java language exception, if it exists; otherwise, no action is taken.
+     * Remove the error page for the specified error code or Java language exception, if it exists; otherwise, no action
+     * is taken.
      *
      * @param errorPage The error page definition to be removed
      */
@@ -3987,8 +3752,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Remove the specified filter definition from this Context, if it exists;
-     * otherwise, no action is taken.
+     * Remove the specified filter definition from this Context, if it exists; otherwise, no action is taken.
      *
      * @param filterDef Filter definition to be removed
      */
@@ -4036,8 +3800,7 @@ public class StandardContext extends ContainerBase
      *
      * @param name Name of the message destination ref to remove
      *
-     * @deprecated This will be removed in Tomcat 10.
-     *             Use {@link #getNamingResources()} instead
+     * @deprecated This will be removed in Tomcat 10. Use {@link #getNamingResources()} instead
      */
     @Deprecated
     public void removeMessageDestinationRef(String name) {
@@ -4046,8 +3809,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Remove the MIME mapping for the specified extension, if it exists;
-     * otherwise, no action is taken.
+     * Remove the MIME mapping for the specified extension, if it exists; otherwise, no action is taken.
      *
      * @param extension Extension to remove the mapping for
      */
@@ -4063,8 +3825,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Remove the context initialization parameter with the specified
-     * name, if it exists; otherwise, no action is taken.
+     * Remove the context initialization parameter with the specified name, if it exists; otherwise, no action is taken.
      *
      * @param name Name of the parameter to remove
      */
@@ -4132,8 +3893,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Remove any servlet mapping for the specified pattern, if it exists;
-     * otherwise, no action is taken.
+     * Remove any servlet mapping for the specified pattern, if it exists; otherwise, no action is taken.
      *
      * @param pattern URL pattern of the mapping to remove
      */
@@ -4145,7 +3905,7 @@ public class StandardContext extends ContainerBase
             name = servletMappings.remove(pattern);
         }
         Wrapper wrapper = (Wrapper) findChild(name);
-        if( wrapper != null ) {
+        if (wrapper != null) {
             wrapper.removeMapping(pattern);
         }
         fireContainerEvent("removeServletMapping", pattern);
@@ -4153,8 +3913,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Remove the specified watched resource name from the list associated
-     * with this Context.
+     * Remove the specified watched resource name from the list associated with this Context.
      *
      * @param name Name of the watched resource to be removed
      */
@@ -4193,8 +3952,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Remove the specified welcome file name from the list recognized
-     * by this Context.
+     * Remove the specified welcome file name from the list recognized by this Context.
      *
      * @param name Name of the welcome file to be removed
      */
@@ -4228,7 +3986,7 @@ public class StandardContext extends ContainerBase
         }
 
         // Inform interested listeners
-        if(this.getState().equals(LifecycleState.STARTED)) {
+        if (this.getState().equals(LifecycleState.STARTED)) {
             fireContainerEvent(REMOVE_WELCOME_FILE_EVENT, name);
         }
 
@@ -4236,8 +3994,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Remove a class name from the set of LifecycleListener classes that
-     * will be added to newly created Wrappers.
+     * Remove a class name from the set of LifecycleListener classes that will be added to newly created Wrappers.
      *
      * @param listener Class name of a LifecycleListener class to be removed
      */
@@ -4278,8 +4035,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Remove a class name from the set of ContainerListener classes that
-     * will be added to newly created Wrappers.
+     * Remove a class name from the set of ContainerListener classes that will be added to newly created Wrappers.
      *
      * @param listener Class name of a ContainerListener class to be removed
      */
@@ -4320,11 +4076,9 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Gets the cumulative processing times of all servlets in this
-     * StandardContext.
+     * Gets the cumulative processing times of all servlets in this StandardContext.
      *
-     * @return Cumulative processing times of all servlets in this
-     * StandardContext
+     * @return Cumulative processing times of all servlets in this StandardContext
      */
     public long getProcessingTime() {
 
@@ -4341,11 +4095,9 @@ public class StandardContext extends ContainerBase
     }
 
     /**
-     * Gets the maximum processing time of all servlets in this
-     * StandardContext.
+     * Gets the maximum processing time of all servlets in this StandardContext.
      *
-     * @return Maximum processing time of all servlets in this
-     * StandardContext
+     * @return Maximum processing time of all servlets in this StandardContext
      */
     public long getMaxTime() {
 
@@ -4366,11 +4118,9 @@ public class StandardContext extends ContainerBase
     }
 
     /**
-     * Gets the minimum processing time of all servlets in this
-     * StandardContext.
+     * Gets the minimum processing time of all servlets in this StandardContext.
      *
-     * @return Minimum processing time of all servlets in this
-     * StandardContext
+     * @return Minimum processing time of all servlets in this StandardContext
      */
     public long getMinTime() {
 
@@ -4391,11 +4141,9 @@ public class StandardContext extends ContainerBase
     }
 
     /**
-     * Gets the cumulative request count of all servlets in this
-     * StandardContext.
+     * Gets the cumulative request count of all servlets in this StandardContext.
      *
-     * @return Cumulative request count of all servlets in this
-     * StandardContext
+     * @return Cumulative request count of all servlets in this StandardContext
      */
     public int getRequestCount() {
 
@@ -4412,11 +4160,9 @@ public class StandardContext extends ContainerBase
     }
 
     /**
-     * Gets the cumulative error count of all servlets in this
-     * StandardContext.
+     * Gets the cumulative error count of all servlets in this StandardContext.
      *
-     * @return Cumulative error count of all servlets in this
-     * StandardContext
+     * @return Cumulative error count of all servlets in this StandardContext
      */
     public int getErrorCount() {
 
@@ -4434,8 +4180,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Return the real path for a given virtual path, if possible; otherwise
-     * return <code>null</code>.
+     * Return the real path for a given virtual path, if possible; otherwise return <code>null</code>.
      *
      * @param path The path to the desired resource
      */
@@ -4452,8 +4197,8 @@ public class StandardContext extends ContainerBase
                 String canonicalPath = resource.getCanonicalPath();
                 if (canonicalPath == null) {
                     return null;
-                } else if ((resource.isDirectory() && !canonicalPath.endsWith(File.separator) ||
-                        !resource.exists()) && path.endsWith("/")) {
+                } else if ((resource.isDirectory() && !canonicalPath.endsWith(File.separator) || !resource.exists()) &&
+                        path.endsWith("/")) {
                     return canonicalPath + File.separatorChar;
                 } else {
                     return canonicalPath;
@@ -4467,8 +4212,7 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Hook to track which Servlets were created via
-     * {@link ServletContext#createServlet(Class)}.
+     * Hook to track which Servlets were created via {@link ServletContext#createServlet(Class)}.
      *
      * @param servlet the created Servlet
      */
@@ -4489,21 +4233,18 @@ public class StandardContext extends ContainerBase
         private final Object lock = new Object();
 
         /**
-         * The set of filter mappings for this application, in the order they
-         * were defined in the deployment descriptor with additional mappings
-         * added via the {@link ServletContext} possibly both before and after
-         * those defined in the deployment descriptor.
+         * The set of filter mappings for this application, in the order they were defined in the deployment descriptor
+         * with additional mappings added via the {@link ServletContext} possibly both before and after those defined in
+         * the deployment descriptor.
          */
         private FilterMap[] array = new FilterMap[0];
 
         /**
-         * Filter mappings added via {@link ServletContext} may have to be
-         * inserted before the mappings in the deployment descriptor but must be
-         * inserted in the order the {@link ServletContext} methods are called.
-         * This isn't an issue for the mappings added after the deployment
-         * descriptor - they are just added to the end - but correctly the
-         * adding mappings before the deployment descriptor mappings requires
-         * knowing where the last 'before' mapping was added.
+         * Filter mappings added via {@link ServletContext} may have to be inserted before the mappings in the
+         * deployment descriptor but must be inserted in the order the {@link ServletContext} methods are called. This
+         * isn't an issue for the mappings added after the deployment descriptor - they are just added to the end - but
+         * correctly the adding mappings before the deployment descriptor mappings requires knowing where the last
+         * 'before' mapping was added.
          */
         private int insertPoint = 0;
 
@@ -4517,11 +4258,9 @@ public class StandardContext extends ContainerBase
         }
 
         /**
-         * Add a filter mapping at the end of the current set of filter
-         * mappings.
+         * Add a filter mapping at the end of the current set of filter mappings.
          *
-         * @param filterMap
-         *            The filter mapping to be added
+         * @param filterMap The filter mapping to be added
          */
         public void add(FilterMap filterMap) {
             synchronized (lock) {
@@ -4532,18 +4271,16 @@ public class StandardContext extends ContainerBase
         }
 
         /**
-         * Add a filter mapping before the mappings defined in the deployment
-         * descriptor but after any other mappings added via this method.
+         * Add a filter mapping before the mappings defined in the deployment descriptor but after any other mappings
+         * added via this method.
          *
-         * @param filterMap
-         *            The filter mapping to be added
+         * @param filterMap The filter mapping to be added
          */
         public void addBefore(FilterMap filterMap) {
             synchronized (lock) {
                 FilterMap results[] = new FilterMap[array.length + 1];
                 System.arraycopy(array, 0, results, 0, insertPoint);
-                System.arraycopy(array, insertPoint, results, insertPoint + 1,
-                        array.length - insertPoint);
+                System.arraycopy(array, insertPoint, results, insertPoint + 1, array.length - insertPoint);
                 results[insertPoint] = filterMap;
                 array = results;
                 insertPoint++;
@@ -4572,8 +4309,7 @@ public class StandardContext extends ContainerBase
                 // Remove the specified filter mapping
                 FilterMap results[] = new FilterMap[array.length - 1];
                 System.arraycopy(array, 0, results, 0, n);
-                System.arraycopy(array, n + 1, results, n, (array.length - 1)
-                        - n);
+                System.arraycopy(array, n + 1, results, n, (array.length - 1) - n);
                 array = results;
                 if (n < insertPoint) {
                     insertPoint--;
@@ -4587,8 +4323,8 @@ public class StandardContext extends ContainerBase
 
     /**
      * Configure and initialize the set of filters for this Context.
-     * @return <code>true</code> if all filter initialization completed
-     * successfully, or <code>false</code> otherwise.
+     *
+     * @return <code>true</code> if all filter initialization completed successfully, or <code>false</code> otherwise.
      */
     public boolean filterStart() {
 
@@ -4599,20 +4335,18 @@ public class StandardContext extends ContainerBase
         boolean ok = true;
         synchronized (filterConfigs) {
             filterConfigs.clear();
-            for (Entry<String,FilterDef> entry : filterDefs.entrySet()) {
+            for (Entry<String, FilterDef> entry : filterDefs.entrySet()) {
                 String name = entry.getKey();
                 if (getLogger().isDebugEnabled()) {
                     getLogger().debug(" Starting filter '" + name + "'");
                 }
                 try {
-                    ApplicationFilterConfig filterConfig =
-                            new ApplicationFilterConfig(this, entry.getValue());
+                    ApplicationFilterConfig filterConfig = new ApplicationFilterConfig(this, entry.getValue());
                     filterConfigs.put(name, filterConfig);
                 } catch (Throwable t) {
                     t = ExceptionUtils.unwrapInvocationTargetException(t);
                     ExceptionUtils.handleThrowable(t);
-                    getLogger().error(sm.getString(
-                            "standardContext.filterStart", name), t);
+                    getLogger().error(sm.getString("standardContext.filterStart", name), t);
                     ok = false;
                 }
             }
@@ -4624,8 +4358,8 @@ public class StandardContext extends ContainerBase
 
     /**
      * Finalize and release the set of filters for this Context.
-     * @return <code>true</code> if all filter finalization completed
-     * successfully, or <code>false</code> otherwise.
+     *
+     * @return <code>true</code> if all filter finalization completed successfully, or <code>false</code> otherwise.
      */
     public boolean filterStop() {
 
@@ -4650,10 +4384,11 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Find and return the initialized <code>FilterConfig</code> for the
-     * specified filter name, if any; otherwise return <code>null</code>.
+     * Find and return the initialized <code>FilterConfig</code> for the specified filter name, if any; otherwise return
+     * <code>null</code>.
      *
      * @param name Name of the desired filter
+     *
      * @return the filter config object
      */
     public FilterConfig findFilterConfig(String name) {
@@ -4662,10 +4397,9 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Configure the set of instantiated application event listeners
-     * for this Context.
-     * @return <code>true</code> if all listeners wre
-     * initialized successfully, or <code>false</code> otherwise.
+     * Configure the set of instantiated application event listeners for this Context.
+     *
+     * @return <code>true</code> if all listeners wre initialized successfully, or <code>false</code> otherwise.
      */
     public boolean listenerStart() {
 
@@ -4679,8 +4413,7 @@ public class StandardContext extends ContainerBase
         boolean ok = true;
         for (int i = 0; i < results.length; i++) {
             if (getLogger().isDebugEnabled()) {
-                getLogger().debug(" Configuring event listener class '" +
-                    listeners[i] + "'");
+                getLogger().debug(" Configuring event listener class '" + listeners[i] + "'");
             }
             try {
                 String listener = listeners[i];
@@ -4688,8 +4421,7 @@ public class StandardContext extends ContainerBase
             } catch (Throwable t) {
                 t = ExceptionUtils.unwrapInvocationTargetException(t);
                 ExceptionUtils.handleThrowable(t);
-                getLogger().error(sm.getString(
-                        "standardContext.applicationListener", listeners[i]), t);
+                getLogger().error(sm.getString("standardContext.applicationListener", listeners[i]), t);
                 ok = false;
             }
         }
@@ -4702,15 +4434,12 @@ public class StandardContext extends ContainerBase
         List<Object> eventListeners = new ArrayList<>();
         List<Object> lifecycleListeners = new ArrayList<>();
         for (Object result : results) {
-            if ((result instanceof ServletContextAttributeListener)
-                    || (result instanceof ServletRequestAttributeListener)
-                    || (result instanceof ServletRequestListener)
-                    || (result instanceof HttpSessionIdListener)
-                    || (result instanceof HttpSessionAttributeListener)) {
+            if ((result instanceof ServletContextAttributeListener) ||
+                    (result instanceof ServletRequestAttributeListener) || (result instanceof ServletRequestListener) ||
+                    (result instanceof HttpSessionIdListener) || (result instanceof HttpSessionAttributeListener)) {
                 eventListeners.add(result);
             }
-            if ((result instanceof ServletContextListener)
-                    || (result instanceof HttpSessionListener)) {
+            if ((result instanceof ServletContextListener) || (result instanceof HttpSessionListener)) {
                 lifecycleListeners.add(result);
             }
         }
@@ -4722,7 +4451,7 @@ public class StandardContext extends ContainerBase
         // list.
         eventListeners.addAll(Arrays.asList(getApplicationEventListeners()));
         setApplicationEventListeners(eventListeners.toArray());
-        for (Object lifecycleListener: getApplicationLifecycleListeners()) {
+        for (Object lifecycleListener : getApplicationLifecycleListeners()) {
             lifecycleListeners.add(lifecycleListener);
             if (lifecycleListener instanceof ServletContextListener) {
                 noPluggabilityListeners.add(lifecycleListener);
@@ -4767,8 +4496,7 @@ public class StandardContext extends ContainerBase
             } catch (Throwable t) {
                 ExceptionUtils.handleThrowable(t);
                 fireContainerEvent("afterContextInitialized", listener);
-                getLogger().error(sm.getString("standardContext.listenerStart",
-                        instance.getClass().getName()), t);
+                getLogger().error(sm.getString("standardContext.listenerStart", instance.getClass().getName()), t);
                 ok = false;
             }
         }
@@ -4779,8 +4507,8 @@ public class StandardContext extends ContainerBase
 
     /**
      * Send an application stop event to all interested listeners.
-     * @return <code>true</code> if all events were sent successfully,
-     * or <code>false</code> otherwise.
+     *
+     * @return <code>true</code> if all events were sent successfully, or <code>false</code> otherwise.
      */
     public boolean listenerStop() {
 
@@ -4802,8 +4530,7 @@ public class StandardContext extends ContainerBase
                     continue;
                 }
                 if (listeners[j] instanceof ServletContextListener) {
-                    ServletContextListener listener =
-                        (ServletContextListener) listeners[j];
+                    ServletContextListener listener = (ServletContextListener) listeners[j];
                     try {
                         fireContainerEvent("beforeContextDestroyed", listener);
                         if (noPluggabilityListeners.contains(listener)) {
@@ -4815,9 +4542,8 @@ public class StandardContext extends ContainerBase
                     } catch (Throwable t) {
                         ExceptionUtils.handleThrowable(t);
                         fireContainerEvent("afterContextDestroyed", listener);
-                        getLogger().error
-                            (sm.getString("standardContext.listenerStop",
-                                listeners[j].getClass().getName()), t);
+                        getLogger().error(
+                                sm.getString("standardContext.listenerStop", listeners[j].getClass().getName()), t);
                         ok = false;
                     }
                 }
@@ -4828,9 +4554,8 @@ public class StandardContext extends ContainerBase
                 } catch (Throwable t) {
                     t = ExceptionUtils.unwrapInvocationTargetException(t);
                     ExceptionUtils.handleThrowable(t);
-                    getLogger().error
-                       (sm.getString("standardContext.listenerStop",
-                            listeners[j].getClass().getName()), t);
+                    getLogger().error(sm.getString("standardContext.listenerStop", listeners[j].getClass().getName()),
+                            t);
                     ok = false;
                 }
             }
@@ -4851,9 +4576,8 @@ public class StandardContext extends ContainerBase
                 } catch (Throwable t) {
                     t = ExceptionUtils.unwrapInvocationTargetException(t);
                     ExceptionUtils.handleThrowable(t);
-                    getLogger().error
-                        (sm.getString("standardContext.listenerStop",
-                            listeners[j].getClass().getName()), t);
+                    getLogger().error(sm.getString("standardContext.listenerStop", listeners[j].getClass().getName()),
+                            t);
                     ok = false;
                 }
             }
@@ -4871,6 +4595,7 @@ public class StandardContext extends ContainerBase
 
     /**
      * Allocate resources, including proxy.
+     *
      * @throws LifecycleException if a start error occurs
      */
     public void resourcesStart() throws LifecycleException {
@@ -4881,12 +4606,10 @@ public class StandardContext extends ContainerBase
             resources.start();
         }
 
-        if (effectiveMajorVersion >=3 && addWebinfClassesResources) {
-            WebResource webinfClassesResource = resources.getResource(
-                    "/WEB-INF/classes/META-INF/resources");
+        if (effectiveMajorVersion >= 3 && addWebinfClassesResources) {
+            WebResource webinfClassesResource = resources.getResource("/WEB-INF/classes/META-INF/resources");
             if (webinfClassesResource.isDirectory()) {
-                getResources().createWebResourceSet(
-                        WebResourceRoot.ResourceSetType.RESOURCE_JAR, "/",
+                getResources().createWebResourceSet(WebResourceRoot.ResourceSetType.RESOURCE_JAR, "/",
                         webinfClassesResource.getURL(), "/");
             }
         }
@@ -4895,6 +4618,7 @@ public class StandardContext extends ContainerBase
 
     /**
      * Deallocate resources and destroy proxy.
+     *
      * @return <code>true</code> if no error occurred
      */
     public boolean resourcesStop() {
@@ -4920,11 +4644,11 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Load and initialize all servlets marked "load on startup" in the
-     * web application deployment descriptor.
+     * Load and initialize all servlets marked "load on startup" in the web application deployment descriptor.
+     *
+     * @param children Array of wrappers for all currently defined servlets (including those not declared load on
+     *                     startup)
      *
-     * @param children Array of wrappers for all currently defined
-     *  servlets (including those not declared load on startup)
      * @return <code>true</code> if load on startup was considered successful
      */
     public boolean loadOnStartup(Container children[]) {
@@ -4947,13 +4671,14 @@ public class StandardContext extends ContainerBase
                 try {
                     wrapper.load();
                 } catch (ServletException e) {
-                    getLogger().error(sm.getString("standardContext.loadOnStartup.loadException",
-                          getName(), wrapper.getName()), StandardWrapper.getRootCause(e));
+                    getLogger().error(
+                            sm.getString("standardContext.loadOnStartup.loadException", getName(), wrapper.getName()),
+                            StandardWrapper.getRootCause(e));
                     // NOTE: load errors (including a servlet that throws
                     // UnavailableException from the init() method) are NOT
                     // fatal to application startup
                     // unless failCtxIfServletStartFails="true" is specified
-                    if(getComputedFailCtxIfServletStartFails()) {
+                    if (getComputedFailCtxIfServletStartFails()) {
                         return false;
                     }
                 }
@@ -4965,23 +4690,23 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Start this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
+     * Start this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void startInternal() throws LifecycleException {
 
-        if(log.isDebugEnabled()) {
+        if (log.isDebugEnabled()) {
             log.debug("Starting " + getBaseName());
         }
 
         // Send j2ee.state.starting notification
         if (this.getObjectName() != null) {
-            Notification notification = new Notification("j2ee.state.starting",
-                    this.getObjectName(), sequenceNumber.getAndIncrement());
+            Notification notification = new Notification("j2ee.state.starting", this.getObjectName(),
+                    sequenceNumber.getAndIncrement());
             broadcaster.sendNotification(notification);
         }
 
@@ -4998,7 +4723,7 @@ public class StandardContext extends ContainerBase
         postWorkDirectory();
 
         // Add missing components as necessary
-        if (getResources() == null) {   // (1) Required by Loader
+        if (getResources() == null) { // (1) Required by Loader
             if (log.isDebugEnabled()) {
                 log.debug("Configuring default Resources");
             }
@@ -5031,8 +4756,7 @@ public class StandardContext extends ContainerBase
         // Validate required extensions
         boolean dependencyCheck = true;
         try {
-            dependencyCheck = ExtensionValidator.validateApplication
-                (getResources(), this);
+            dependencyCheck = ExtensionValidator.validateApplication(getResources(), this);
         } catch (IOException ioe) {
             log.error(sm.getString("standardContext.extensionValidationError"), ioe);
             dependencyCheck = false;
@@ -5045,8 +4769,7 @@ public class StandardContext extends ContainerBase
 
         // Reading the "catalina.useNaming" environment variable
         String useNamingProperty = System.getProperty("catalina.useNaming");
-        if ((useNamingProperty != null)
-            && (useNamingProperty.equals("false"))) {
+        if ((useNamingProperty != null) && (useNamingProperty.equals("false"))) {
             useNaming = false;
         }
 
@@ -5112,7 +4835,8 @@ public class StandardContext extends ContainerBase
                     CredentialHandler safeHandler = new CredentialHandler() {
                         @Override
                         public boolean matches(String inputCredentials, String storedCredentials) {
-                            return getRealmInternal().getCredentialHandler().matches(inputCredentials, storedCredentials);
+                            return getRealmInternal().getCredentialHandler().matches(inputCredentials,
+                                    storedCredentials);
                         }
 
                         @Override
@@ -5145,8 +4869,7 @@ public class StandardContext extends ContainerBase
                 if (manager == null) {
                     if (log.isDebugEnabled()) {
                         log.debug(sm.getString("standardContext.cluster.noManager",
-                                Boolean.valueOf((getCluster() != null)),
-                                Boolean.valueOf(distributable)));
+                                Boolean.valueOf((getCluster() != null)), Boolean.valueOf(distributable)));
                     }
                     if ((getCluster() != null) && distributable) {
                         try {
@@ -5163,15 +4886,14 @@ public class StandardContext extends ContainerBase
                 // Configure default manager if none was specified
                 if (contextManager != null) {
                     if (log.isDebugEnabled()) {
-                        log.debug(sm.getString("standardContext.manager",
-                                contextManager.getClass().getName()));
+                        log.debug(sm.getString("standardContext.manager", contextManager.getClass().getName()));
                     }
                     setManager(contextManager);
                 }
 
-                if (manager!=null && (getCluster() != null) && distributable) {
-                    //let the cluster know that there is a context that is distributable
-                    //and that it has its own manager
+                if (manager != null && (getCluster() != null) && distributable) {
+                    // let the cluster know that there is a context that is distributable
+                    // and that it has its own manager
                     getCluster().registerManager(manager);
                 }
             }
@@ -5183,19 +4905,16 @@ public class StandardContext extends ContainerBase
 
             // We put the resources into the servlet context
             if (ok) {
-                getServletContext().setAttribute
-                    (Globals.RESOURCES_ATTR, getResources());
+                getServletContext().setAttribute(Globals.RESOURCES_ATTR, getResources());
 
                 if (getInstanceManager() == null) {
                     setInstanceManager(createInstanceManager());
                 }
-                getServletContext().setAttribute(
-                        InstanceManager.class.getName(), getInstanceManager());
+                getServletContext().setAttribute(InstanceManager.class.getName(), getInstanceManager());
                 InstanceManagerBindings.bind(getLoader().getClassLoader(), getInstanceManager());
 
                 // Create context attributes that will be required
-                getServletContext().setAttribute(
-                        JarScanner.class.getName(), getJarScanner());
+                getServletContext().setAttribute(JarScanner.class.getName(), getJarScanner());
 
                 // Make the version info available
                 getServletContext().setAttribute(Globals.WEBAPP_VERSION, getWebappVersion());
@@ -5205,11 +4924,9 @@ public class StandardContext extends ContainerBase
             mergeParameters();
 
             // Call ServletContainerInitializers
-            for (Map.Entry<ServletContainerInitializer, Set<Class<?>>> entry :
-                initializers.entrySet()) {
+            for (Map.Entry<ServletContainerInitializer, Set<Class<?>>> entry : initializers.entrySet()) {
                 try {
-                    entry.getKey().onStartup(entry.getValue(),
-                            getServletContext());
+                    entry.getKey().onStartup(entry.getValue(), getServletContext());
                 } catch (ServletException e) {
                     log.error(sm.getString("standardContext.sciFail"), e);
                     ok = false;
@@ -5238,7 +4955,7 @@ public class StandardContext extends ContainerBase
                 if (manager instanceof Lifecycle) {
                     ((Lifecycle) manager).start();
                 }
-            } catch(Exception e) {
+            } catch (Exception e) {
                 log.error(sm.getString("standardContext.managerFail"), e);
                 ok = false;
             }
@@ -5253,7 +4970,7 @@ public class StandardContext extends ContainerBase
 
             // Load and initialize all "load on startup" servlets
             if (ok) {
-                if (!loadOnStartup(findChildren())){
+                if (!loadOnStartup(findChildren())) {
                     log.error(sm.getString("standardContext.servletFail"));
                     ok = false;
                 }
@@ -5275,13 +4992,12 @@ public class StandardContext extends ContainerBase
             log.error(sm.getString("standardContext.startFailed", getName()));
         }
 
-        startTime=System.currentTimeMillis();
+        startTime = System.currentTimeMillis();
 
         // Send j2ee.state.running notification
         if (ok && (this.getObjectName() != null)) {
-            Notification notification =
-                new Notification("j2ee.state.running", this.getObjectName(),
-                                 sequenceNumber.getAndIncrement());
+            Notification notification = new Notification("j2ee.state.running", this.getObjectName(),
+                    sequenceNumber.getAndIncrement());
             broadcaster.sendNotification(notification);
         }
 
@@ -5296,8 +5012,8 @@ public class StandardContext extends ContainerBase
             setState(LifecycleState.FAILED);
             // Send j2ee.object.failed notification
             if (this.getObjectName() != null) {
-                Notification notification = new Notification("j2ee.object.failed",
-                        this.getObjectName(), sequenceNumber.getAndIncrement());
+                Notification notification = new Notification("j2ee.object.failed", this.getObjectName(),
+                        sequenceNumber.getAndIncrement());
                 broadcaster.sendNotification(notification);
             }
         } else {
@@ -5306,11 +5022,9 @@ public class StandardContext extends ContainerBase
     }
 
 
-    private void checkConstraintsForUncoveredMethods(
-            SecurityConstraint[] constraints) {
-        SecurityConstraint[] newConstraints =
-                SecurityConstraint.findUncoveredHttpMethods(constraints,
-                        getDenyUncoveredHttpMethods(), getLogger());
+    private void checkConstraintsForUncoveredMethods(SecurityConstraint[] constraints) {
+        SecurityConstraint[] newConstraints = SecurityConstraint.findUncoveredHttpMethods(constraints,
+                getDenyUncoveredHttpMethods(), getLogger());
         for (SecurityConstraint constraint : newConstraints) {
             addConstraint(constraint);
         }
@@ -5324,32 +5038,31 @@ public class StandardContext extends ContainerBase
             context = getNamingContextListener().getEnvContext();
         }
         Map<String, Map<String, String>> injectionMap = buildInjectionMap(
-                getIgnoreAnnotations() ? new NamingResourcesImpl(): getNamingResources());
-       return new DefaultInstanceManager(context, injectionMap,
-               this, this.getClass().getClassLoader());
+                getIgnoreAnnotations() ? new NamingResourcesImpl() : getNamingResources());
+        return new DefaultInstanceManager(context, injectionMap, this, this.getClass().getClassLoader());
     }
 
     private Map<String, Map<String, String>> buildInjectionMap(NamingResourcesImpl namingResources) {
         Map<String, Map<String, String>> injectionMap = new HashMap<>();
-        for (Injectable resource: namingResources.findLocalEjbs()) {
+        for (Injectable resource : namingResources.findLocalEjbs()) {
             addInjectionTarget(resource, injectionMap);
         }
-        for (Injectable resource: namingResources.findEjbs()) {
+        for (Injectable resource : namingResources.findEjbs()) {
             addInjectionTarget(resource, injectionMap);
         }
-        for (Injectable resource: namingResources.findEnvironments()) {
+        for (Injectable resource : namingResources.findEnvironments()) {
             addInjectionTarget(resource, injectionMap);
         }
-        for (Injectable resource: namingResources.findMessageDestinationRefs()) {
+        for (Injectable resource : namingResources.findMessageDestinationRefs()) {
             addInjectionTarget(resource, injectionMap);
         }
-        for (Injectable resource: namingResources.findResourceEnvRefs()) {
+        for (Injectable resource : namingResources.findResourceEnvRefs()) {
             addInjectionTarget(resource, injectionMap);
         }
-        for (Injectable resource: namingResources.findResources()) {
+        for (Injectable resource : namingResources.findResources()) {
             addInjectionTarget(resource, injectionMap);
         }
-        for (Injectable resource: namingResources.findServices()) {
+        for (Injectable resource : namingResources.findServices()) {
             addInjectionTarget(resource, injectionMap);
         }
         return injectionMap;
@@ -5359,24 +5072,22 @@ public class StandardContext extends ContainerBase
         List<InjectionTarget> injectionTargets = resource.getInjectionTargets();
         if (injectionTargets != null && injectionTargets.size() > 0) {
             String jndiName = resource.getName();
-            for (InjectionTarget injectionTarget: injectionTargets) {
+            for (InjectionTarget injectionTarget : injectionTargets) {
                 String clazz = injectionTarget.getTargetClass();
-                injectionMap.computeIfAbsent(clazz, k -> new HashMap<>())
-                    .put(injectionTarget.getTargetName(), jndiName);
+                injectionMap.computeIfAbsent(clazz, k -> new HashMap<>()).put(injectionTarget.getTargetName(),
+                        jndiName);
             }
         }
     }
 
 
-
     /**
-     * Merge the context initialization parameters specified in the application
-     * deployment descriptor with the application parameters described in the
-     * server configuration, respecting the <code>override</code> property of
+     * Merge the context initialization parameters specified in the application deployment descriptor with the
+     * application parameters described in the server configuration, respecting the <code>override</code> property of
      * the application parameters appropriately.
      */
     private void mergeParameters() {
-        Map<String,String> mergedParams = new HashMap<>();
+        Map<String, String> mergedParams = new HashMap<>();
 
         String names[] = findParameters();
         for (String s : names) {
@@ -5386,15 +5097,14 @@ public class StandardContext extends ContainerBase
         ApplicationParameter params[] = findApplicationParameters();
         for (ApplicationParameter param : params) {
             if (param.getOverride()) {
-                mergedParams.computeIfAbsent(param.getName(),
-                    k -> param.getValue());
+                mergedParams.computeIfAbsent(param.getName(), k -> param.getValue());
             } else {
                 mergedParams.put(param.getName(), param.getValue());
             }
         }
 
         ServletContext sc = getServletContext();
-        for (Map.Entry<String,String> entry : mergedParams.entrySet()) {
+        for (Map.Entry<String, String> entry : mergedParams.entrySet()) {
             sc.setInitParameter(entry.getKey(), entry.getValue());
         }
 
@@ -5402,20 +5112,19 @@ public class StandardContext extends ContainerBase
 
 
     /**
-     * Stop this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
+     * Stop this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void stopInternal() throws LifecycleException {
 
         // Send j2ee.state.stopping notification
         if (this.getObjectName() != null) {
-            Notification notification =
-                new Notification("j2ee.state.stopping", this.getObjectName(),
-                                 sequenceNumber.getAndIncrement());
+            Notification notification = new Notification("j2ee.state.stopping", this.getObjectName(),
+                    sequenceNumber.getAndIncrement());
             broadcaster.sendNotification(notification);
         }
 
@@ -5481,8 +5190,7 @@ public class StandardContext extends ContainerBase
             fireLifecycleEvent(Lifecycle.CONFIGURE_STOP_EVENT, null);
 
             // Stop the Valves in our pipeline (including the basic), if any
-            if (pipeline instanceof Lifecycle &&
-                    ((Lifecycle) pipeline).getState().isAvailable()) {
+            if (pipeline instanceof Lifecycle && ((Lifecycle) pipeline).getState().isAvailable()) {
                 ((Lifecycle) pipeline).stop();
             }
 
@@ -5516,9 +5224,8 @@ public class StandardContext extends ContainerBase
 
         // Send j2ee.state.stopped notification
         if (this.getObjectName() != null) {
-            Notification notification =
-                new Notification("j2ee.state.stopped", this.getObjectName(),
-                                sequenceNumber.getAndIncrement());
+            Notification notification = new Notification("j2ee.state.stopped", this.getObjectName(),
+                    sequenceNumber.getAndIncrement());
             broadcaster.sendNotification(notification);
         }
 
@@ -5528,11 +5235,11 @@ public class StandardContext extends ContainerBase
         // This object will no longer be visible or used.
         try {
             resetContext();
-        } catch( Exception ex ) {
-            log.error( "Error resetting context " + this + " " + ex, ex );
+        } catch (Exception ex) {
+            log.error("Error resetting context " + this + " " + ex, ex);
         }
 
-        //reset the instance manager
+        // reset the instance manager
         setInstanceManager(null);
 
         if (log.isDebugEnabled()) {
@@ -5542,14 +5249,10 @@ public class StandardContext extends ContainerBase
     }
 
     /**
-     * Destroy needs to clean up the context completely.
-     *
-     * The problem is that undoing all the config in start() and restoring
-     * a 'fresh' state is impossible. After stop()/destroy()/init()/start()
-     * we should have the same state as if a fresh start was done - i.e
-     * read modified web.xml, etc. This can only be done by completely
-     * removing the context object and remapping a new one, or by cleaning
-     * up everything.
+     * Destroy needs to clean up the context completely. The problem is that undoing all the config in start() and
+     * restoring a 'fresh' state is impossible. After stop()/destroy()/init()/start() we should have the same state as
+     * if a fresh start was done - i.e read modified web.xml, etc. This can only be done by completely removing the
+     * context object and remapping a new one, or by cleaning up everything.
      */
     @Override
     protected void destroyInternal() throws LifecycleException {
@@ -5558,9 +5261,8 @@ public class StandardContext extends ContainerBase
         // have been set so the notification can't be created
         if (getObjectName() != null) {
             // Send j2ee.object.deleted notification
-            Notification notification =
-                new Notification("j2ee.object.deleted", this.getObjectName(),
-                                 sequenceNumber.getAndIncrement());
+            Notification notification = new Notification("j2ee.object.deleted", this.getObjectName(),
+                    sequenceNumber.getAndIncrement());
             broadcaster.sendNotification(notification);
         }
 
@@ -5598,8 +5300,7 @@ public class StandardContext extends ContainerBase
             try {
                 loader.backgroundProcess();
             } catch (Exception e) {
-                log.warn(sm.getString(
-                        "standardContext.backgroundProcess.loader", loader), e);
+                log.warn(sm.getString("standardContext.backgroundProcess.loader", loader), e);
             }
         }
         Manager manager = getManager();
@@ -5607,9 +5308,7 @@ public class StandardContext extends ContainerBase
             try {
                 manager.backgroundProcess();
             } catch (Exception e) {
... 4126 lines suppressed ...


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