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


The following commit(s) were added to refs/heads/main by this push:
     new 0b0c786df1 Remove deprecated code
0b0c786df1 is described below

commit 0b0c786df13ad13ab77cce8cb499500432d94858
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Feb 8 13:46:42 2024 +0000

    Remove deprecated code
---
 .../apache/catalina/core/ApplicationRequest.java   | 35 ++++------------------
 java/org/apache/tomcat/util/buf/ByteChunk.java     | 18 -----------
 java/org/apache/tomcat/util/buf/StringCache.java   | 16 ----------
 java/org/apache/tomcat/util/http/MimeHeaders.java  |  5 ----
 4 files changed, 5 insertions(+), 69 deletions(-)

diff --git a/java/org/apache/catalina/core/ApplicationRequest.java 
b/java/org/apache/catalina/core/ApplicationRequest.java
index 8e0ec4576d..330e3da575 100644
--- a/java/org/apache/catalina/core/ApplicationRequest.java
+++ b/java/org/apache/catalina/core/ApplicationRequest.java
@@ -41,23 +41,13 @@ import jakarta.servlet.ServletRequestWrapper;
  */
 class ApplicationRequest extends ServletRequestWrapper {
 
-    /**
-     * The set of attribute names that are special for request dispatchers.
-     *
-     * @deprecated Will be removed without replacement in Tomcat 11 onwards.
-     */
-    @Deprecated
-    protected static final String specials[] =
-            { RequestDispatcher.INCLUDE_REQUEST_URI, 
RequestDispatcher.INCLUDE_CONTEXT_PATH,
+    private static final Set<String> specialsSet =
+            new HashSet<>(Arrays.asList(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 };
-    /*
-     * This duplicates specials but has been added to improve the performance 
of isSpecial().
-     */
-    private static final Set<String> specialsSet = new 
HashSet<>(Arrays.asList(specials));
+                    RequestDispatcher.FORWARD_QUERY_STRING, 
RequestDispatcher.FORWARD_MAPPING));
 
 
     /**
@@ -111,7 +101,7 @@ class ApplicationRequest extends ServletRequestWrapper {
     public void removeAttribute(String name) {
         synchronized (attributes) {
             attributes.remove(name);
-            if (!isSpecial(name)) {
+            if (!specialsSet.contains(name)) {
                 getRequest().removeAttribute(name);
             }
         }
@@ -128,7 +118,7 @@ class ApplicationRequest extends ServletRequestWrapper {
     public void setAttribute(String name, Object value) {
         synchronized (attributes) {
             attributes.put(name, value);
-            if (!isSpecial(name)) {
+            if (!specialsSet.contains(name)) {
                 getRequest().setAttribute(name, value);
             }
         }
@@ -157,19 +147,4 @@ class ApplicationRequest extends ServletRequestWrapper {
             }
         }
     }
-
-
-    // ------------------------------------------------------ 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
-     *
-     * @deprecated Will be removed without replacement in Tomcat 11 onwards.
-     */
-    @Deprecated
-    protected boolean isSpecial(String name) {
-        return specialsSet.contains(name);
-    }
 }
diff --git a/java/org/apache/tomcat/util/buf/ByteChunk.java 
b/java/org/apache/tomcat/util/buf/ByteChunk.java
index e297121e65..04b2e5a935 100644
--- a/java/org/apache/tomcat/util/buf/ByteChunk.java
+++ b/java/org/apache/tomcat/util/buf/ByteChunk.java
@@ -538,24 +538,6 @@ public final class ByteChunk extends AbstractChunk {
     }
 
 
-    /**
-     * Converts the current content of the byte buffer to a String using the 
configured character set.
-     *
-     * @return The result of converting the bytes to a String
-     *
-     * @deprecated Unused. This method will be removed in Tomcat 11 onwards.
-     */
-    @Deprecated
-    public String toStringInternal() {
-        try {
-            return toStringInternal(CodingErrorAction.REPLACE, 
CodingErrorAction.REPLACE);
-        } catch (CharacterCodingException e) {
-            // Unreachable code. Use of REPLACE above means the exception will 
never be thrown.
-            throw new IllegalStateException(e);
-        }
-    }
-
-
     /**
      * Converts the current content of the byte buffer to a String using the 
configured character set.
      *
diff --git a/java/org/apache/tomcat/util/buf/StringCache.java 
b/java/org/apache/tomcat/util/buf/StringCache.java
index 5b82e44f74..f86be83ec6 100644
--- a/java/org/apache/tomcat/util/buf/StringCache.java
+++ b/java/org/apache/tomcat/util/buf/StringCache.java
@@ -472,22 +472,6 @@ public class StringCache {
     }
 
 
-    /**
-     * Find an entry given its name in the cache and return the associated 
String.
-     *
-     * @param name The name to find
-     *
-     * @return the corresponding value
-     *
-     * @deprecated Unused. Will be removed in Tomcat 11.
-     *             Use {@link #find(ByteChunk, CodingErrorAction, 
CodingErrorAction)}
-     */
-    @Deprecated
-    protected static final String find(ByteChunk name) {
-        return find(name, CodingErrorAction.REPLACE, 
CodingErrorAction.REPLACE);
-    }
-
-
     /**
      * Find an entry given its name in the cache and return the associated 
String.
      *
diff --git a/java/org/apache/tomcat/util/http/MimeHeaders.java 
b/java/org/apache/tomcat/util/http/MimeHeaders.java
index dbe0cee272..1106be7ad6 100644
--- a/java/org/apache/tomcat/util/http/MimeHeaders.java
+++ b/java/org/apache/tomcat/util/http/MimeHeaders.java
@@ -124,11 +124,6 @@ public class MimeHeaders {
         count = 0;
     }
 
-    @Deprecated
-    public void clear() {
-        recycle();
-    }
-
     @Override
     public String toString() {
         StringWriter sw = new StringWriter();


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

Reply via email to