Align url decoding for bytes with url decoding for Strings. No functional change...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 31 Jan 2010 13:30:30 +0000 (13:30 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 31 Jan 2010 13:30:30 +0000 (13:30 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@905037 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/util/RequestUtil.java

index 9c8c863..150f6ec 100644 (file)
@@ -307,7 +307,8 @@ public final class RequestUtil {
      * 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 final class RequestUtil {
     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 @@ public final class RequestUtil {
         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);