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 2013/07/08 22:32:53 UTC
svn commit: r1500934 - in /tomcat/trunk: java/org/apache/catalina/core/
java/org/apache/catalina/deploy/ java/org/apache/catalina/servlets/
java/org/apache/catalina/util/ java/org/apache/tomcat/util/buf/
test/org/apache/catalina/util/ test/org/apache/t...
Author: markt
Date: Mon Jul 8 20:32:53 2013
New Revision: 1500934
URL: http://svn.apache.org/r1500934
Log:
Move URL decoding util methods to support upcoming refactoring of
web.xml parsing.
Added:
tomcat/trunk/test/org/apache/tomcat/util/buf/TestUDecoder.java
- copied, changed from r1500887, tomcat/trunk/test/org/apache/catalina/util/TestRequestUtil.java
Removed:
tomcat/trunk/test/org/apache/catalina/util/TestRequestUtil.java
Modified:
tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
tomcat/trunk/java/org/apache/catalina/deploy/ErrorPage.java
tomcat/trunk/java/org/apache/catalina/deploy/FilterMap.java
tomcat/trunk/java/org/apache/catalina/deploy/LoginConfig.java
tomcat/trunk/java/org/apache/catalina/deploy/SecurityCollection.java
tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java
tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties
tomcat/trunk/java/org/apache/catalina/util/RequestUtil.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/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1500934&r1=1500933&r2=1500934&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Mon Jul 8 20:32:53 2013
@@ -115,7 +115,6 @@ import org.apache.catalina.startup.TldCo
import org.apache.catalina.util.CharsetMapper;
import org.apache.catalina.util.ContextName;
import org.apache.catalina.util.ExtensionValidator;
-import org.apache.catalina.util.RequestUtil;
import org.apache.catalina.util.URLEncoder;
import org.apache.catalina.webresources.StandardRoot;
import org.apache.juli.logging.Log;
@@ -125,6 +124,7 @@ import org.apache.tomcat.InstanceManager
import org.apache.tomcat.JarScanner;
import org.apache.tomcat.util.ExceptionUtils;
import org.apache.tomcat.util.IntrospectionUtils;
+import org.apache.tomcat.util.buf.UDecoder;
import org.apache.tomcat.util.scan.StandardJarScanner;
/**
@@ -3172,7 +3172,7 @@ public class StandardContext extends Con
if (findChild(name) == null)
throw new IllegalArgumentException
(sm.getString("standardContext.servletMap.name", name));
- String decodedPattern = adjustURLPattern(RequestUtil.URLDecode(pattern));
+ String decodedPattern = adjustURLPattern(UDecoder.URLDecode(pattern));
if (!validateURLPattern(decodedPattern))
throw new IllegalArgumentException
(sm.getString("standardContext.servletMap.pattern", decodedPattern));
Modified: tomcat/trunk/java/org/apache/catalina/deploy/ErrorPage.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/deploy/ErrorPage.java?rev=1500934&r1=1500933&r2=1500934&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/deploy/ErrorPage.java (original)
+++ tomcat/trunk/java/org/apache/catalina/deploy/ErrorPage.java Mon Jul 8 20:32:53 2013
@@ -21,7 +21,7 @@ package org.apache.catalina.deploy;
import java.io.Serializable;
-import org.apache.catalina.util.RequestUtil;
+import org.apache.tomcat.util.buf.UDecoder;
/**
@@ -142,7 +142,7 @@ public class ErrorPage implements Serial
// if ((location == null) || !location.startsWith("/"))
// throw new IllegalArgumentException
// ("Error Page Location must start with a '/'");
- this.location = RequestUtil.URLDecode(location);
+ this.location = UDecoder.URLDecode(location);
}
Modified: tomcat/trunk/java/org/apache/catalina/deploy/FilterMap.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/deploy/FilterMap.java?rev=1500934&r1=1500933&r2=1500934&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/deploy/FilterMap.java (original)
+++ tomcat/trunk/java/org/apache/catalina/deploy/FilterMap.java Mon Jul 8 20:32:53 2013
@@ -25,7 +25,7 @@ import java.util.Locale;
import javax.servlet.DispatcherType;
-import org.apache.catalina.util.RequestUtil;
+import org.apache.tomcat.util.buf.UDecoder;
/**
@@ -138,7 +138,7 @@ public class FilterMap implements Serial
} else {
String[] results = new String[urlPatterns.length + 1];
System.arraycopy(urlPatterns, 0, results, 0, urlPatterns.length);
- results[urlPatterns.length] = RequestUtil.URLDecode(urlPattern);
+ results[urlPatterns.length] = UDecoder.URLDecode(urlPattern);
urlPatterns = results;
}
}
Modified: tomcat/trunk/java/org/apache/catalina/deploy/LoginConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/deploy/LoginConfig.java?rev=1500934&r1=1500933&r2=1500934&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/deploy/LoginConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/deploy/LoginConfig.java Mon Jul 8 20:32:53 2013
@@ -21,7 +21,7 @@ package org.apache.catalina.deploy;
import java.io.Serializable;
-import org.apache.catalina.util.RequestUtil;
+import org.apache.tomcat.util.buf.UDecoder;
/**
@@ -103,7 +103,7 @@ public class LoginConfig implements Seri
// if ((errorPage == null) || !errorPage.startsWith("/"))
// throw new IllegalArgumentException
// ("Error Page resource path must start with a '/'");
- this.errorPage = RequestUtil.URLDecode(errorPage);
+ this.errorPage = UDecoder.URLDecode(errorPage);
}
@@ -120,7 +120,7 @@ public class LoginConfig implements Seri
// if ((loginPage == null) || !loginPage.startsWith("/"))
// throw new IllegalArgumentException
// ("Login Page resource path must start with a '/'");
- this.loginPage = RequestUtil.URLDecode(loginPage);
+ this.loginPage = UDecoder.URLDecode(loginPage);
}
Modified: tomcat/trunk/java/org/apache/catalina/deploy/SecurityCollection.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/deploy/SecurityCollection.java?rev=1500934&r1=1500933&r2=1500934&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/deploy/SecurityCollection.java (original)
+++ tomcat/trunk/java/org/apache/catalina/deploy/SecurityCollection.java Mon Jul 8 20:32:53 2013
@@ -21,7 +21,7 @@ package org.apache.catalina.deploy;
import java.io.Serializable;
-import org.apache.catalina.util.RequestUtil;
+import org.apache.tomcat.util.buf.UDecoder;
/**
@@ -214,7 +214,7 @@ public class SecurityCollection implemen
if (pattern == null)
return;
- String decodedPattern = RequestUtil.URLDecode(pattern);
+ String decodedPattern = UDecoder.URLDecode(pattern);
String results[] = new String[patterns.length + 1];
for (int i = 0; i < patterns.length; i++) {
results[i] = patterns[i];
Modified: tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java?rev=1500934&r1=1500933&r2=1500934&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java Mon Jul 8 20:32:53 2013
@@ -46,6 +46,7 @@ import org.apache.catalina.util.DOMWrite
import org.apache.catalina.util.MD5Encoder;
import org.apache.catalina.util.XMLWriter;
import org.apache.tomcat.util.buf.B2CConverter;
+import org.apache.tomcat.util.buf.UDecoder;
import org.apache.tomcat.util.http.FastHttpDateFormat;
import org.apache.tomcat.util.http.RequestUtil;
import org.w3c.dom.Document;
@@ -1501,8 +1502,7 @@ public class WebdavServlet
}
// Remove url encoding from destination
- destinationPath = org.apache.catalina.util.RequestUtil.URLDecode(
- destinationPath, "UTF8");
+ destinationPath = UDecoder.URLDecode(destinationPath, "UTF8");
int protocolIndex = destinationPath.indexOf("://");
if (protocolIndex >= 0) {
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=1500934&r1=1500933&r2=1500934&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties Mon Jul 8 20:32:53 2013
@@ -38,8 +38,6 @@ lifecycleMBeanBase.unregisterFail=Failed
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.
-requestUtil.urlDecode.missingDigit=The % character must be followed by two hexademical digits
-requestUtil.urlDecode.uee=Unable to URL decode the specified input since the encoding [{0}] is not supported.
SecurityUtil.doAsPrivilege=An exception occurs when running the PrivilegedExceptionAction block.
sessionIdGenerator.createRandom=Creation of SecureRandom instance for session ID generation using [{0}] took [{1}] milliseconds.
sessionIdGenerator.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=1500934&r1=1500933&r2=1500934&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java Mon Jul 8 20:32:53 2013
@@ -124,118 +124,6 @@ public final class RequestUtil {
/**
- * Decode and return the specified URL-encoded String.
- * When the byte array is converted to a string, the system default
- * character encoding is used... This may be different than some other
- * servers. It is assumed the string is not a query string.
- *
- * @param str The url-encoded string
- *
- * @exception IllegalArgumentException if a '%' character is not followed
- * by a valid 2-digit hexadecimal number
- */
- public static String URLDecode(String str) {
- return URLDecode(str, null);
- }
-
-
- /**
- * 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 enc The encoding to use; if null, the default encoding is used. If
- * an unsupported encoding is specified null will be returned
- * @exception IllegalArgumentException if a '%' character is not followed
- * by a valid 2-digit hexadecimal number
- */
- public static String URLDecode(String str, String enc) {
- return URLDecode(str, enc, false);
- }
-
- /**
- * Decode and return the specified URL-encoded String.
- *
- * @param str The url-encoded string
- * @param enc The encoding to use; if null, the default encoding is used. If
- * an unsupported encoding is specified null will be returned
- * @param isQuery Is this a query string being processed
- * @exception IllegalArgumentException if a '%' character is not followed
- * by a valid 2-digit hexadecimal number
- */
- public static String URLDecode(String str, String enc, boolean isQuery) {
- if (str == null)
- return (null);
-
- // use the specified encoding to extract bytes out of the
- // given string so that the encoding is not lost. If an
- // encoding is not specified, use ISO-8859-1
- byte[] bytes = null;
- try {
- if (enc == null) {
- bytes = str.getBytes(B2CConverter.ISO_8859_1);
- } else {
- bytes = str.getBytes(B2CConverter.getCharset(enc));
- }
- } catch (UnsupportedEncodingException uee) {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("requestUtil.urlDecode.uee", enc), uee);
- }
- }
-
- 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, the default encoding is used. If
- * an unsupported encoding is specified null will be returned
- * @param isQuery Is this a query string being processed
- * @exception IllegalArgumentException if a '%' character is not followed
- * by a valid 2-digit hexadecimal number
- */
- public static String URLDecode(byte[] bytes, String enc, boolean isQuery) {
-
- if (bytes == null)
- return null;
-
- int len = bytes.length;
- int ix = 0;
- int ox = 0;
- while (ix < len) {
- byte b = bytes[ix++]; // Get byte to test
- if (b == '+' && isQuery) {
- b = (byte)' ';
- } else if (b == '%') {
- if (ix + 2 > len) {
- throw new IllegalArgumentException(
- sm.getString("requestUtil.urlDecode.missingDigit"));
- }
- b = (byte) ((convertHexDigit(bytes[ix++]) << 4)
- + convertHexDigit(bytes[ix++]));
- }
- bytes[ox++] = b;
- }
- if (enc != null) {
- try {
- return new String(bytes, 0, ox, B2CConverter.getCharset(enc));
- } catch (UnsupportedEncodingException uee) {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("requestUtil.urlDecode.uee", enc), uee);
- }
- return null;
- }
- }
- return new String(bytes, 0, ox);
-
- }
-
-
- /**
* Convert a byte character value to hexadecimal digit value.
*
* @param b the character value byte
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=1500934&r1=1500933&r2=1500934&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/LocalStrings.properties Mon Jul 8 20:32:53 2013
@@ -15,3 +15,7 @@
b2cConverter.unknownEncoding=The character encoding [{0}] is not supported
c2bConverter.recycleFailed=Failed to recycle the C2B Converter. Creating new BufferedWriter, WriteConvertor and IntermediateOutputStream.
+
+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.
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=1500934&r1=1500933&r2=1500934&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java Mon Jul 8 20:32:53 2013
@@ -18,6 +18,11 @@ package org.apache.tomcat.util.buf;
import java.io.CharConversionException;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.res.StringManager;
/**
* All URL decoding happens here. This way we can reuse, review, optimize
@@ -29,6 +34,11 @@ import java.io.IOException;
*/
public final class UDecoder {
+ private static final StringManager sm =
+ StringManager.getManager(Constants.Package);
+
+ private static final Log log = LogFactory.getLog(UDecoder.class);
+
private static final boolean ALLOW_ENCODED_SLASH =
Boolean.valueOf(System.getProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "false")).booleanValue();
@@ -266,6 +276,128 @@ public final class UDecoder {
}
+ /**
+ * Decode and return the specified URL-encoded String.
+ * When the byte array is converted to a string, the system default
+ * character encoding is used... This may be different than some other
+ * servers. It is assumed the string is not a query string.
+ *
+ * @param str The url-encoded string
+ *
+ * @exception IllegalArgumentException if a '%' character is not followed
+ * by a valid 2-digit hexadecimal number
+ */
+ public static String URLDecode(String str) {
+ return URLDecode(str, null);
+ }
+
+
+ /**
+ * 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 enc The encoding to use; if null, the default encoding is used. If
+ * an unsupported encoding is specified null will be returned
+ * @exception IllegalArgumentException if a '%' character is not followed
+ * by a valid 2-digit hexadecimal number
+ */
+ public static String URLDecode(String str, String enc) {
+ return URLDecode(str, enc, false);
+ }
+
+
+ /**
+ * Decode and return the specified URL-encoded String.
+ *
+ * @param str The url-encoded string
+ * @param enc The encoding to use; if null, the default encoding is used. If
+ * an unsupported encoding is specified null will be returned
+ * @param isQuery Is this a query string being processed
+ * @exception IllegalArgumentException if a '%' character is not followed
+ * by a valid 2-digit hexadecimal number
+ */
+ public static String URLDecode(String str, String enc, boolean isQuery) {
+ if (str == null)
+ return (null);
+
+ // use the specified encoding to extract bytes out of the
+ // given string so that the encoding is not lost. If an
+ // encoding is not specified, use ISO-8859-1
+ byte[] bytes = null;
+ try {
+ if (enc == null) {
+ bytes = str.getBytes(B2CConverter.ISO_8859_1);
+ } else {
+ bytes = str.getBytes(B2CConverter.getCharset(enc));
+ }
+ } catch (UnsupportedEncodingException uee) {
+ if (log.isDebugEnabled()) {
+ log.debug(sm.getString("uDecoder.urlDecode.uee", enc), uee);
+ }
+ }
+
+ 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, the default encoding is used. If
+ * an unsupported encoding is specified null will be returned
+ * @param isQuery Is this a query string being processed
+ * @exception IllegalArgumentException if a '%' character is not followed
+ * by a valid 2-digit hexadecimal number
+ */
+ public static String URLDecode(byte[] bytes, String enc, boolean isQuery) {
+
+ if (bytes == null)
+ return null;
+
+ int len = bytes.length;
+ int ix = 0;
+ int ox = 0;
+ while (ix < len) {
+ byte b = bytes[ix++]; // Get byte to test
+ if (b == '+' && isQuery) {
+ b = (byte)' ';
+ } else if (b == '%') {
+ if (ix + 2 > len) {
+ throw new IllegalArgumentException(
+ sm.getString("requestUtil.urlDecode.missingDigit"));
+ }
+ b = (byte) ((convertHexDigit(bytes[ix++]) << 4)
+ + convertHexDigit(bytes[ix++]));
+ }
+ bytes[ox++] = b;
+ }
+ if (enc != null) {
+ try {
+ return new String(bytes, 0, ox, B2CConverter.getCharset(enc));
+ } catch (UnsupportedEncodingException uee) {
+ if (log.isDebugEnabled()) {
+ log.debug(sm.getString("uDecoder.urlDecode.uee", enc), uee);
+ }
+ return null;
+ }
+ }
+ return new String(bytes, 0, ox);
+
+ }
+
+
+ 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("uDecoder.convertHexDigit.notHex",
+ Character.valueOf((char)b)));
+ }
+
private static boolean isHexDigit( int c ) {
return ( ( c>='0' && c<='9' ) ||
@@ -273,6 +405,7 @@ public final class UDecoder {
( c>='A' && c<='F' ));
}
+
private static int x2c( byte b1, byte b2 ) {
int digit= (b1>='A') ? ( (b1 & 0xDF)-'A') + 10 :
(b1 -'0');
@@ -282,6 +415,7 @@ public final class UDecoder {
return digit;
}
+
private static int x2c( char b1, char b2 ) {
int digit= (b1>='A') ? ( (b1 & 0xDF)-'A') + 10 :
(b1 -'0');
@@ -290,5 +424,4 @@ public final class UDecoder {
(b2 -'0');
return digit;
}
-
}
Copied: tomcat/trunk/test/org/apache/tomcat/util/buf/TestUDecoder.java (from r1500887, tomcat/trunk/test/org/apache/catalina/util/TestRequestUtil.java)
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/buf/TestUDecoder.java?p2=tomcat/trunk/test/org/apache/tomcat/util/buf/TestUDecoder.java&p1=tomcat/trunk/test/org/apache/catalina/util/TestRequestUtil.java&r1=1500887&r2=1500934&rev=1500934&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/util/TestRequestUtil.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/util/buf/TestUDecoder.java Mon Jul 8 20:32:53 2013
@@ -14,21 +14,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.catalina.util;
+package org.apache.tomcat.util.buf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
-public class TestRequestUtil {
+public class TestUDecoder {
@Test
public void testURLDecodeStringInvalid() {
// %n rather than %nn should throw an IAE according to the Javadoc
Exception exception = null;
try {
- RequestUtil.URLDecode("%5xxxxx");
+ UDecoder.URLDecode("%5xxxxx");
} catch (Exception e) {
exception = e;
}
@@ -37,7 +37,7 @@ public class TestRequestUtil {
// Edge case trying to trigger ArrayIndexOutOfBoundsException
exception = null;
try {
- RequestUtil.URLDecode("%5");
+ UDecoder.URLDecode("%5");
} catch (Exception e) {
exception = e;
}
@@ -47,42 +47,41 @@ public class TestRequestUtil {
@Test
public void testURLDecodeStringValidIso88591Start() {
- String result = RequestUtil.URLDecode("%41xxxx", "ISO-8859-1");
+ String result = UDecoder.URLDecode("%41xxxx", "ISO-8859-1");
assertEquals("Axxxx", result);
}
@Test
public void testURLDecodeStringValidIso88591Middle() {
- String result = RequestUtil.URLDecode("xx%41xx", "ISO-8859-1");
+ String result = UDecoder.URLDecode("xx%41xx", "ISO-8859-1");
assertEquals("xxAxx", result);
}
@Test
public void testURLDecodeStringValidIso88591End() {
- String result = RequestUtil.URLDecode("xxxx%41", "ISO-8859-1");
+ String result = UDecoder.URLDecode("xxxx%41", "ISO-8859-1");
assertEquals("xxxxA", result);
}
@Test
public void testURLDecodeStringValidUtf8Start() {
- String result = RequestUtil.URLDecode("%c3%aaxxxx", "UTF-8");
+ String result = UDecoder.URLDecode("%c3%aaxxxx", "UTF-8");
assertEquals("\u00eaxxxx", result);
}
@Test
public void testURLDecodeStringValidUtf8Middle() {
- String result = RequestUtil.URLDecode("xx%c3%aaxx", "UTF-8");
+ String result = UDecoder.URLDecode("xx%c3%aaxx", "UTF-8");
assertEquals("xx\u00eaxx", result);
}
@Test
public void testURLDecodeStringValidUtf8End() {
- String result = RequestUtil.URLDecode("xxxx%c3%aa", "UTF-8");
+ String result = UDecoder.URLDecode("xxxx%c3%aa", "UTF-8");
assertEquals("xxxx\u00ea", result);
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org