https://issues.apache.org/bugzilla/show_bug.cgi?id=44897
Summary: HttpServletRequest's .getParameter(String) method
returns null for parameters with invalid URL encodings
Product: Tomcat 5
Version: 5.5.26
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]
As per the JavaDocs:
http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletRequest.html#getParameter(java.lang.String)
"public java.lang.String getParameter(java.lang.String name)
Returns the value of a request parameter as a String, or null if the parameter
does not exist..."
However, given the following URL:
http://localhost/webappName/?foo=bar%4xbaz
httpServletRequestObject.getParameter("foo") will return null despite the
existence of the parameter "foo".
The problem, as far as I can tell, is the presence of the invalid URL encoding
'%xy' (where x or y are any non hexadecimal character). I expected that
getParameter("foo") would do one of the following in this situation:
1. Return "bar%4xbaz" (as does other languages such as PHP or Ruby on Rails)
2. Throw a Java UnsupportedEncodingException (see
http://java.sun.com/j2se/1.5.0/docs/api/java/io/UnsupportedEncodingException.html).
Making the data inaccessible via getParameter(String) (ie: returning null)
seems to be less helpful than either one of the above.
I was able to confirm this behavior in Tomcat 5.0.23 as well as 5.5.26.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]