Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51650
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 12 Aug 2011 09:09:32 +0000 (09:09 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 12 Aug 2011 09:09:32 +0000 (09:09 +0000)
Code clean-up

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1157018 13f79535-47bb-0310-9956-ffa450edef68

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

index ae5615a..bf099a3 100644 (file)
@@ -174,8 +174,8 @@ public final class RequestUtil {
      *
      * @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. If an unsupported encoding is specified the parameters will not be
+     * @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
      */
     public static void parseParameters(Map<String,String[]> map, String data,
@@ -184,15 +184,10 @@ public final class RequestUtil {
         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. If an
-            // encoding is not specified, let it use platform default
+            // given string so that the encoding is not lost.
             byte[] bytes = null;
             try {
-                if (encoding == null) {
-                    bytes = data.getBytes(Charset.defaultCharset());
-                } else {
-                    bytes = data.getBytes(B2CConverter.getCharset(encoding));
-                }
+                bytes = data.getBytes(B2CConverter.getCharset(encoding));
                 parseParameters(map, bytes, encoding);
             } catch (UnsupportedEncodingException uee) {
                 if (log.isDebugEnabled()) {