Author: markt
Date: Wed Jan 13 14:17:26 2016
New Revision: 1724430
URL: http://svn.apache.org/viewvc?rev=1724430&view=rev
Log:
Remove deprecated code.
Clean-up
Modified:
tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties
tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java
Modified: tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties?rev=1724430&r1=1724429&r2=1724430&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties Wed Jan
13 14:17:26 2016
@@ -36,8 +36,6 @@ lifecycleBase.stopFail=Failed to stop co
lifecycleMBeanBase.registerFail=Failed to register object [{0}] with name
[{0}] during component initialisation
lifecycleMBeanBase.unregisterFail=Failed to unregister MBean with name [{0}]
during component destruction
lifecycleMBeanBase.unregisterNoServer=No MBean server was available to
unregister the MBean [{0}]
-requestUtil.convertHexDigit.notHex=[{0}] is not a hexadecimal digit
-requestUtil.parseParameters.uee=Unable to parse the parameters since the
encoding [{0}] is not supported.
SecurityUtil.doAsPrivilege=An exception occurs when running the
PrivilegedExceptionAction block.
sessionIdGeneratorBase.createRandom=Creation of SecureRandom instance for
session ID generation using [{0}] took [{1}] milliseconds.
sessionIdGeneratorBase.random=Exception initializing random number generator
of class [{0}]. Falling back to java.secure.SecureRandom
Modified: tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java?rev=1724430&r1=1724429&r2=1724430&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java Wed Jan 13
14:17:26 2016
@@ -16,16 +16,6 @@
*/
package org.apache.catalina.util;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
-import java.util.Map;
-
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.util.buf.B2CConverter;
-import org.apache.tomcat.util.res.StringManager;
-
-
/**
* General purpose request parsing and encoding utility methods.
*
@@ -34,16 +24,6 @@ import org.apache.tomcat.util.res.String
*/
public final class RequestUtil {
-
- private static final Log log = LogFactory.getLog(RequestUtil.class);
-
- /**
- * The string resources for this package.
- */
- private static final StringManager sm =
- StringManager.getManager("org.apache.catalina.util");
-
-
/**
* Filter the specified message string for characters that are sensitive
* in HTML. This avoids potential attacks caused by including JavaScript
@@ -55,8 +35,9 @@ public final class RequestUtil {
*/
public static String filter(String message) {
- if (message == null)
- return (null);
+ if (message == null) {
+ return null;
+ }
char content[] = new char[message.length()];
message.getChars(0, message.length(), content, 0);
@@ -79,163 +60,6 @@ public final class RequestUtil {
result.append(content[i]);
}
}
- return (result.toString());
-
- }
-
-
- /**
- * Append request parameters from the specified String to the specified
- * Map. It is presumed that the specified Map is not accessed from any
- * other thread, so no synchronization is performed.
- * <p>
- * <strong>IMPLEMENTATION NOTE</strong>: URL decoding is performed
- * individually on the parsed name and value elements, rather than on
- * the entire query string ahead of time, to properly deal with the case
- * where the name or value includes an encoded "=" or "&" character
- * that would otherwise be interpreted as a delimiter.
- *
- * @param map Map that accumulates the resulting parameters
- * @param data Input string containing request parameters
- * @param encoding The encoding to use; encoding must not be null.
- * If an unsupported encoding is specified the parameters will not be
- * parsed and the map will not be modified
- *
- * @deprecated Unused. This will be removed in Tomcat 9.0.x.
- */
- @Deprecated
- public static void parseParameters(Map<String,String[]> map, String data,
- String encoding) {
-
- if ((data != null) && (data.length() > 0)) {
-
- // use the specified encoding to extract bytes out of the
- // given string so that the encoding is not lost.
- byte[] bytes = null;
- try {
- bytes = data.getBytes(B2CConverter.getCharset(encoding));
- parseParameters(map, bytes, encoding);
- } catch (UnsupportedEncodingException uee) {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("requestUtil.parseParameters.uee",
- encoding), uee);
- }
- }
-
- }
-
- }
-
-
- /**
- * Convert a byte character value to hexadecimal digit value.
- *
- * @param b the character value byte
- */
- private static byte convertHexDigit( byte b ) {
- if ((b >= '0') && (b <= '9')) return (byte)(b - '0');
- if ((b >= 'a') && (b <= 'f')) return (byte)(b - 'a' + 10);
- if ((b >= 'A') && (b <= 'F')) return (byte)(b - 'A' + 10);
- throw new IllegalArgumentException(
- sm.getString("requestUtil.convertHexDigit.notHex",
- Character.valueOf((char)b)));
- }
-
-
- /**
- * Put name and value pair in map. When name already exist, add value
- * to array of values.
- *
- * @param map The map to populate
- * @param name The parameter name
- * @param value The parameter value
- */
- private static void putMapEntry( Map<String,String[]> map, String name,
- String value) {
- String[] newValues = null;
- String[] oldValues = map.get(name);
- if (oldValues == null) {
- newValues = new String[1];
- newValues[0] = value;
- } else {
- newValues = new String[oldValues.length + 1];
- System.arraycopy(oldValues, 0, newValues, 0, oldValues.length);
- newValues[oldValues.length] = value;
- }
- map.put(name, newValues);
- }
-
-
- /**
- * Append request parameters from the specified String to the specified
- * Map. It is presumed that the specified Map is not accessed from any
- * other thread, so no synchronization is performed.
- * <p>
- * <strong>IMPLEMENTATION NOTE</strong>: URL decoding is performed
- * individually on the parsed name and value elements, rather than on
- * the entire query string ahead of time, to properly deal with the case
- * where the name or value includes an encoded "=" or "&" character
- * that would otherwise be interpreted as a delimiter.
- *
- * NOTE: byte array data is modified by this method. Caller beware.
- *
- * @param map Map that accumulates the resulting parameters
- * @param data Input string containing request parameters
- * @param encoding The encoding to use; if null, the default encoding is
- * used
- *
- * @exception UnsupportedEncodingException if the requested encoding is not
- * supported.
- *
- * @deprecated Unused. This will be removed in Tomcat 9.0.x.
- */
- @Deprecated
- public static void parseParameters(Map<String,String[]> map, byte[] data,
- String encoding) throws UnsupportedEncodingException {
-
- Charset charset = B2CConverter.getCharset(encoding);
-
- if (data != null && data.length > 0) {
- int ix = 0;
- int ox = 0;
- String key = null;
- String value = null;
- while (ix < data.length) {
- byte c = data[ix++];
- switch ((char) c) {
- case '&':
- value = new String(data, 0, ox, charset);
- if (key != null) {
- putMapEntry(map, key, value);
- key = null;
- }
- ox = 0;
- break;
- case '=':
- if (key == null) {
- key = new String(data, 0, ox, charset);
- ox = 0;
- } else {
- data[ox++] = c;
- }
- break;
- case '+':
- data[ox++] = (byte)' ';
- break;
- case '%':
- data[ox++] = (byte)((convertHexDigit(data[ix++]) << 4)
- + convertHexDigit(data[ix++]));
- break;
- default:
- data[ox++] = c;
- }
- }
- //The last value does not end in '&'. So save it now.
- if (key != null) {
- value = new String(data, 0, ox, charset);
- putMapEntry(map, key, value);
- }
- }
-
+ return result.toString();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]