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 2017/05/02 09:03:58 UTC

svn commit: r1793443 - in /tomcat/trunk/java/org/apache: catalina/connector/Connector.java tomcat/util/buf/LocalStrings.properties tomcat/util/buf/UDecoder.java

Author: markt
Date: Tue May  2 09:03:58 2017
New Revision: 1793443

URL: http://svn.apache.org/viewvc?rev=1793443&view=rev
Log:
Remove deprecated code

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/Connector.java
    tomcat/trunk/java/org/apache/tomcat/util/buf/LocalStrings.properties
    tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/Connector.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Connector.java?rev=1793443&r1=1793442&r2=1793443&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Connector.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Connector.java Tue May  2 09:03:58 2017
@@ -685,6 +685,7 @@ public class Connector extends Lifecycle
      * @return the name of character encoding to be used for the URI using the
      * original case.
      */
+    //@Deprecated
     public String getURIEncoding() {
         return uriCharset.name();
     }

Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/LocalStrings.properties?rev=1793443&r1=1793442&r2=1793443&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/LocalStrings.properties Tue May  2 09:03:58 2017
@@ -21,6 +21,5 @@ hexUtils.fromHex.nonHex=The input must c
 
 uDecoder.urlDecode.missingDigit=The % character must be followed by two hexademical digits
 uDecoder.convertHexDigit.notHex=[{0}] is not a hexadecimal digit
-uDecoder.urlDecode.uee=Unable to URL decode the specified input since the encoding [{0}] is not supported.
 
 byteBufferUtils.cleaner=Cannot use direct ByteBuffer cleaner, memory leaking may occur

Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java?rev=1793443&r1=1793442&r2=1793443&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java Tue May  2 09:03:58 2017
@@ -18,12 +18,9 @@ package org.apache.tomcat.util.buf;
 
 import java.io.CharConversionException;
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
@@ -38,8 +35,6 @@ public final class UDecoder {
 
     private static final StringManager sm = StringManager.getManager(UDecoder.class);
 
-    private static final Log log = LogFactory.getLog(UDecoder.class);
-
     public static final boolean ALLOW_ENCODED_SLASH =
         Boolean.parseBoolean(System.getProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "false"));
 
@@ -314,25 +309,6 @@ public final class UDecoder {
      * string is not a query string.
      *
      * @param str The url-encoded string
-     * @param enc The encoding to use; if null, UTF-8 is used. If
-     * an unsupported encoding is specified null will be returned
-     * @return the decoded string
-     * @exception IllegalArgumentException if a '%' character is not followed
-     * by a valid 2-digit hexadecimal number
-     *
-     * @deprecated This method will be removed in Tomcat 9
-     */
-    @Deprecated
-    public static String URLDecode(String str, String enc) {
-        return URLDecode(str, enc, false);
-    }
-
-
-    /**
-     * Decode and return the specified URL-encoded String. It is assumed the
-     * string is not a query string.
-     *
-     * @param str The url-encoded string
      * @param charset The character encoding to use; if null, UTF-8 is used.
      * @return the decoded string
      * @exception IllegalArgumentException if a '%' character is not followed
@@ -342,73 +318,9 @@ public final class UDecoder {
         if (str == null) {
             return null;
         }
-        return URLDecode(str.getBytes(StandardCharsets.US_ASCII), charset, false);
-    }
-
-
-    /**
-     * Decode and return the specified URL-encoded String.
-     *
-     * @param str The url-encoded string
-     * @param enc The encoding to use; if null, UTF-8 is used. If
-     * an unsupported encoding is specified null will be returned
-     * @param isQuery Is this a query string being processed
-     * @return the decoded string
-     * @exception IllegalArgumentException if a '%' character is not followed
-     * by a valid 2-digit hexadecimal number
-     *
-     * @deprecated This method will be removed in Tomcat 9
-     */
-    @Deprecated
-    public static String URLDecode(String str, String enc, boolean isQuery) {
-        if (str == null) {
-            return null;
-        }
 
-        // URLs are always in US-ASCII
         byte[] bytes = str.getBytes(StandardCharsets.US_ASCII);
 
-        return URLDecode(bytes, enc, isQuery);
-    }
-
-
-    /**
-     * Decode and return the specified URL-encoded byte array.
-     *
-     * @param bytes The url-encoded byte array
-     * @param enc The encoding to use; if null, UTF-8 is used. If
-     * an unsupported encoding is specified null will be returned
-     * @param isQuery Is this a query string being processed
-     * @return the decoded string
-     * @exception IllegalArgumentException if a '%' character is not followed
-     * by a valid 2-digit hexadecimal number
-     *
-     * @deprecated This method will be removed in Tomcat 9
-     */
-    @Deprecated
-    public static String URLDecode(byte[] bytes, String enc, boolean isQuery) {
-        Charset charset = null;
-
-        if (enc != null) {
-            try {
-                charset = B2CConverter.getCharset(enc);
-            } catch (UnsupportedEncodingException uee) {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("uDecoder.urlDecode.uee", enc), uee);
-                }
-            }
-        }
-
-        return URLDecode(bytes, charset, isQuery);
-    }
-
-
-    private static String URLDecode(byte[] bytes, Charset charset, boolean isQuery) {
-
-        if (bytes == null) {
-            return null;
-        }
-
         if (charset == null) {
             charset = StandardCharsets.UTF_8;
         }
@@ -418,9 +330,7 @@ public final class UDecoder {
         int ox = 0;
         while (ix < len) {
             byte b = bytes[ix++];     // Get byte to test
-            if (b == '+' && isQuery) {
-                b = (byte)' ';
-            } else if (b == '%') {
+            if (b == '%') {
                 if (ix + 2 > len) {
                     throw new IllegalArgumentException(
                             sm.getString("uDecoder.urlDecode.missingDigit"));



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