Author: markt Date: Sun Jan 31 13:08:39 2010 New Revision: 905030 URL: http://svn.apache.org/viewvc?rev=905030&view=rev Log: Be clear in Javadoc about how unsupported encodings are handled. Add a debug message for this case.
Modified: tomcat/trunk/java/org/apache/catalina/util/RequestUtil.java 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=905030&r1=905029&r2=905030&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:08:39 2010 @@ -23,6 +23,10 @@ import java.util.Map; import java.util.TimeZone; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.res.StringManager; + /** * General purpose request parsing and encoding utility methods. @@ -35,6 +39,14 @@ public final class RequestUtil { + private static final Log log = LogFactory.getLog(RequestUtil.class); + + /** + * The string resources for this package. + */ + private static final StringManager sm = + StringManager.getManager("org.apache.catalina.util"); + /** * The DateFormat to use for generating readable dates in cookies. */ @@ -220,7 +232,8 @@ * string is not a query string. * * @param str The url-encoded string - * @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 * @exception IllegalArgumentException if a '%' character is not followed * by a valid 2-digit hexadecimal number */ @@ -232,7 +245,8 @@ * Decode and return the specified URL-encoded String. * * @param str The url-encoded string - * @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 @@ -251,7 +265,9 @@ } else { bytes = str.getBytes(enc); } - } catch (UnsupportedEncodingException uee) {} + } catch (UnsupportedEncodingException uee) { + log.debug(sm.getString("requestUtil.urlDecode.uee", enc), uee); + } return URLDecode(bytes, enc, isQuery); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org