tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r905073 - in /tomcat/trunk/java/org/apache/catalina/util: LocalStrings.properties RequestUtil.java
Date Sun, 31 Jan 2010 17:07:26 GMT
Author: markt
Date: Sun Jan 31 17:07:26 2010
New Revision: 905073

URL: http://svn.apache.org/viewvc?rev=905073&view=rev
Log:
Align implementation with comments. Unit test now passes.

Modified:
    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/util/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties?rev=905073&r1=905072&r2=905073&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties Sun Jan 31 17:07:26
2010
@@ -22,7 +22,9 @@
 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.convertHexDigit.notHex=[{0}] is not a hexadecimal digit
 requestUtil.parseParameters.uee=Unable to parse the parameters since the encoding [{0}] is
not supported.
+requestUtil.urlDecode.missingDigit=The % character must be followed by two hexademical digits
 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=905073&r1=905072&r2=905073&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java Sun Jan 31 17:07:26 2010
@@ -326,6 +326,10 @@
             if (b == '+' && isQuery) {
                 b = (byte)' ';
             } else if (b == '%') {
+                if (ix + 2 >= len) {
+                    throw new IllegalArgumentException(
+                            sm.getString("requestUtil.urlDecode.missingDigit"));
+                }
                 b = (byte) ((convertHexDigit(bytes[ix++]) << 4)
                             + convertHexDigit(bytes[ix++]));
             }
@@ -353,7 +357,9 @@
         if ((b >= '0') && (b <= '9')) return (byte)(b - '0');
         if ((b >= 'a') && (b <= 'f')) return (byte)(b - 'a' + 10);
         if ((b >= 'A') && (b <= 'F')) return (byte)(b - 'A' + 10);
-        return 0;
+        throw new IllegalArgumentException(
+                sm.getString("requestUtil.convertHexDigit.notHex",
+                        Character.valueOf((char)b)));
     }
 
 



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


Mime
View raw message