tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r905035 - in /tomcat/trunk/java/org/apache/catalina: core/ApplicationHttpRequest.java util/LocalStrings.properties util/RequestUtil.java
Date Sun, 31 Jan 2010 13:22:04 GMT
Author: markt
Date: Sun Jan 31 13:22:04 2010
New Revision: 905035

URL: http://svn.apache.org/viewvc?rev=905035&view=rev
Log:
Make it clearer how unsupported encodings are handled
No functional change for supported encodings
Log attempted use of unsupported encodings, removing some empty catch blocks in the process

Modified:
    tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
    tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java?rev=905035&r1=905034&r2=905035&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java Sun Jan 31 13:22:04
2010
@@ -882,12 +882,8 @@
         String encoding = getCharacterEncoding();
         if (encoding == null)
             encoding = "ISO-8859-1";
-        try {
-            RequestUtil.parseParameters
-                (queryParameters, queryParamString, encoding);
-        } catch (Exception e) {
-            // Ignore
-        }
+        RequestUtil.parseParameters(queryParameters, queryParamString,
+                encoding);
         Iterator<String> keys = parameters.keySet().iterator();
         while (keys.hasNext()) {
             String key = keys.next();

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=905035&r1=905034&r2=905035&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties Sun Jan 31 13:22:04
2010
@@ -22,5 +22,7 @@
 extensionValidator.extension-not-found-error=ExtensionValidator[{0}][{1}]: Required extension
"{2}" not found.
 extensionValidator.extension-validation-error=ExtensionValidator[{0}]: Failure to find {1}
required extension(s).
 extensionValidator.failload=Failure loading extension {0}
+requestUtil.parseParameters.uee=Unable to parse the parameters since the encoding [{0}] is
not supported.
+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.
 

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=905035&r1=905034&r2=905035&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:22:04 2010
@@ -184,11 +184,12 @@
      *
      * @param map Map that accumulates the resulting parameters
      * @param data Input string containing request parameters
-     *
-     * @exception IllegalArgumentException if the data is malformed
+     * @param encoding The encoding to use; if null, the default encoding is
+     * used. 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,
-            String encoding) throws UnsupportedEncodingException {
+            String encoding) {
 
         if ((data != null) && (data.length() > 0)) {
 
@@ -202,10 +203,12 @@
                 } else {
                     bytes = data.getBytes(encoding);
                 }
+                parseParameters(map, bytes, encoding);
             } catch (UnsupportedEncodingException uee) {
+                log.debug(sm.getString("requestUtil.parseParameters.uee",
+                        encoding), uee);
             }
 
-            parseParameters(map, bytes, encoding);
         }
 
     }
@@ -391,9 +394,11 @@
      *
      * @param map Map that accumulates the resulting parameters
      * @param data Input string containing request parameters
-     * @param encoding Encoding to use for converting hex
+     * @param encoding The encoding to use; if null, the default encoding is
+     * used
      *
-     * @exception UnsupportedEncodingException if the data is malformed
+     * @exception UnsupportedEncodingException if the requested encoding is not
+     * supported.
      */
     public static void parseParameters(Map<String,String[]> map, byte[] data,
             String encoding) throws UnsupportedEncodingException {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message