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

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

commit 3bb5881cf432b81c858f84969a801f9681681e33
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Nov 7 14:10:30 2023 +0000

    Clean-up - no functional change
---
 .../catalina/core/ApplicationHttpRequest.java      | 63 ++++++----------------
 .../apache/catalina/core/ApplicationRequest.java   | 38 ++-----------
 2 files changed, 19 insertions(+), 82 deletions(-)

diff --git a/java/org/apache/catalina/core/ApplicationHttpRequest.java 
b/java/org/apache/catalina/core/ApplicationHttpRequest.java
index 11779d364f..fe2c400219 100644
--- a/java/org/apache/catalina/core/ApplicationHttpRequest.java
+++ b/java/org/apache/catalina/core/ApplicationHttpRequest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.catalina.core;
 
-
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
@@ -50,7 +49,6 @@ import org.apache.tomcat.util.buf.MessageBytes;
 import org.apache.tomcat.util.http.Parameters;
 import org.apache.tomcat.util.res.StringManager;
 
-
 /**
  * Wrapper around a <code>jakarta.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
@@ -82,29 +80,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
     private static final int SPECIALS_FIRST_FORWARD_INDEX = 6;
 
 
-    // ----------------------------------------------------------- Constructors
-
-
-    /**
-     * 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}
-     */
-    ApplicationHttpRequest(HttpServletRequest request, Context context, 
boolean crossContext) {
-
-        super(request);
-        this.context = context;
-        this.crossContext = crossContext;
-        setRequest(request);
-
-    }
-
-
-    // ----------------------------------------------------- Instance Variables
-
-
     /**
      * The context for this request.
      */
@@ -195,6 +170,21 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
     protected final Object[] specialAttributes = new Object[specials.length];
 
 
+    /**
+     * 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}
+     */
+    ApplicationHttpRequest(HttpServletRequest request, Context context, 
boolean crossContext) {
+        super(request);
+        this.context = context;
+        this.crossContext = crossContext;
+        setRequest(request);
+    }
+
+
     // ------------------------------------------------- ServletRequest Methods
 
     @Override
@@ -238,7 +228,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
                 return specialAttributes[pos];
             }
         }
-
     }
 
 
@@ -258,11 +247,9 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
      */
     @Override
     public void removeAttribute(String name) {
-
         if (!removeSpecial(name)) {
             getRequest().removeAttribute(name);
         }
-
     }
 
 
@@ -286,7 +273,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
         if (!setSpecial(name, value)) {
             getRequest().setAttribute(name, value);
         }
-
     }
 
 
@@ -351,7 +337,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
         }
 
         return context.getServletContext().getRequestDispatcher(relative);
-
     }
 
 
@@ -366,7 +351,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
 
     // --------------------------------------------- HttpServletRequest Methods
 
-
     /**
      * Override the <code>getContextPath()</code> method of the wrapped 
request.
      */
@@ -549,7 +533,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
         } else {
             return super.getSession(create);
         }
-
     }
 
 
@@ -617,9 +600,7 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
      * @param contextPath The new context path
      */
     void setContextPath(String contextPath) {
-
         this.contextPath = contextPath;
-
     }
 
 
@@ -629,9 +610,7 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
      * @param pathInfo The new path info
      */
     void setPathInfo(String pathInfo) {
-
         this.pathInfo = pathInfo;
-
     }
 
 
@@ -641,9 +620,7 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
      * @param queryString The new query string
      */
     void setQueryString(String queryString) {
-
         this.queryString = queryString;
-
     }
 
 
@@ -676,9 +653,7 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
      * @param requestURI The new request URI
      */
     void setRequestURI(String requestURI) {
-
         this.requestURI = requestURI;
-
     }
 
 
@@ -688,9 +663,7 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
      * @param servletPath The new servlet path
      */
     void setServletPath(String servletPath) {
-
         this.servletPath = servletPath;
-
     }
 
 
@@ -742,7 +715,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
             }
         }
         return false;
-
     }
 
 
@@ -821,7 +793,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
 
     // ------------------------------------------------------ Private Methods
 
-
     /**
      * 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
@@ -877,7 +848,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
 
     // ----------------------------------- AttributeNamesEnumerator Inner Class
 
-
     /**
      * Utility class used to expose the special attributes as being available 
as request attributes.
      */
@@ -934,8 +904,5 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
             }
             return result;
         }
-
     }
-
-
 }
diff --git a/java/org/apache/catalina/core/ApplicationRequest.java 
b/java/org/apache/catalina/core/ApplicationRequest.java
index d3f247267a..e0347353ee 100644
--- a/java/org/apache/catalina/core/ApplicationRequest.java
+++ b/java/org/apache/catalina/core/ApplicationRequest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.catalina.core;
 
-
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -25,7 +24,6 @@ import jakarta.servlet.RequestDispatcher;
 import jakarta.servlet.ServletRequest;
 import jakarta.servlet.ServletRequestWrapper;
 
-
 /**
  * Wrapper around a <code>jakarta.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
@@ -41,9 +39,6 @@ import jakarta.servlet.ServletRequestWrapper;
 class ApplicationRequest extends ServletRequestWrapper {
 
 
-    // ------------------------------------------------------- Static Variables
-
-
     /**
      * The set of attribute names that are special for request dispatchers.
      */
@@ -56,7 +51,10 @@ class ApplicationRequest extends ServletRequestWrapper {
                     RequestDispatcher.FORWARD_QUERY_STRING, 
RequestDispatcher.FORWARD_MAPPING };
 
 
-    // ----------------------------------------------------------- Constructors
+    /**
+     * 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<>();
 
 
     /**
@@ -65,25 +63,13 @@ class ApplicationRequest extends ServletRequestWrapper {
      * @param request The servlet request being wrapped
      */
     ApplicationRequest(ServletRequest request) {
-
         super(request);
         setRequest(request);
-
     }
 
 
-    // ----------------------------------------------------- Instance Variables
-
-
-    /**
-     * 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<>();
-
-
     // ------------------------------------------------- ServletRequest Methods
 
-
     /**
      * Override the <code>getAttribute()</code> method of the wrapped request.
      *
@@ -91,11 +77,9 @@ class ApplicationRequest extends ServletRequestWrapper {
      */
     @Override
     public Object getAttribute(String name) {
-
         synchronized (attributes) {
             return attributes.get(name);
         }
-
     }
 
 
@@ -104,11 +88,9 @@ class ApplicationRequest extends ServletRequestWrapper {
      */
     @Override
     public Enumeration<String> getAttributeNames() {
-
         synchronized (attributes) {
             return Collections.enumeration(attributes.keySet());
         }
-
     }
 
 
@@ -119,14 +101,12 @@ class ApplicationRequest extends ServletRequestWrapper {
      */
     @Override
     public void removeAttribute(String name) {
-
         synchronized (attributes) {
             attributes.remove(name);
             if (!isSpecial(name)) {
                 getRequest().removeAttribute(name);
             }
         }
-
     }
 
 
@@ -138,20 +118,17 @@ class ApplicationRequest extends ServletRequestWrapper {
      */
     @Override
     public void setAttribute(String name, Object value) {
-
         synchronized (attributes) {
             attributes.put(name, value);
             if (!isSpecial(name)) {
                 getRequest().setAttribute(name, value);
             }
         }
-
     }
 
 
     // ------------------------------------------ ServletRequestWrapper Methods
 
-
     /**
      * Set the request that we are wrapping.
      *
@@ -159,7 +136,6 @@ class ApplicationRequest extends ServletRequestWrapper {
      */
     @Override
     public void setRequest(ServletRequest request) {
-
         super.setRequest(request);
 
         // Initialize the attributes for this request
@@ -172,28 +148,22 @@ class ApplicationRequest extends ServletRequestWrapper {
                 attributes.put(name, value);
             }
         }
-
     }
 
 
     // ------------------------------------------------------ Protected Methods
 
-
     /**
      * Is this attribute name one of the special ones that is added only for 
included servlets?
      *
      * @param name Attribute name to be tested
      */
     protected boolean isSpecial(String name) {
-
         for (String special : specials) {
             if (special.equals(name)) {
                 return true;
             }
         }
         return false;
-
     }
-
-
 }


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

Reply via email to