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 2010/01/31 14:30:30 UTC
svn commit: r905037 -
/tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java
Author: markt
Date: Sun Jan 31 13:30:30 2010
New Revision: 905037
URL: http://svn.apache.org/viewvc?rev=905037&view=rev
Log:
Align url decoding for bytes with url decoding for Strings. No functional change (for Tomcat) since the methods that use bytes are not called directly
Modified:
tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java
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=905037&r1=905036&r2=905037&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java Sun Jan 31 13:30:30 2010
@@ -307,7 +307,8 @@
* 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
+ * @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
@@ -315,7 +316,7 @@
public static String URLDecode(byte[] bytes, String enc, boolean isQuery) {
if (bytes == null)
- return (null);
+ return null;
int len = bytes.length;
int ix = 0;
@@ -333,8 +334,9 @@
if (enc != null) {
try {
return new String(bytes, 0, ox, enc);
- } catch (Exception e) {
- e.printStackTrace();
+ } catch (UnsupportedEncodingException uee) {
+ log.debug(sm.getString("requestUtil.urlDecode.uee", enc), uee);
+ return null;
}
}
return new String(bytes, 0, ox);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org