From: markt Date: Sun, 31 Jan 2010 13:30:30 +0000 (+0000) Subject: Align url decoding for bytes with url decoding for Strings. No functional change... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a6f9fef4e7d7758d2da23430beb625a61c684410;p=tomcat7.0 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 git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@905037 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/util/RequestUtil.java b/java/org/apache/catalina/util/RequestUtil.java index 9c8c8636d..150f6ec21 100644 --- a/java/org/apache/catalina/util/RequestUtil.java +++ b/java/org/apache/catalina/util/RequestUtil.java @@ -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);