DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14541>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14541 NPE: in HttpRequest.decode() when setCharacterEncoding() is used. Summary: NPE: in HttpRequest.decode() when setCharacterEncoding() is used. Product: Cocoon 2 Version: 2.0.3 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: core AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] If you changed the form-encoding in a corg.apache.cocoon.environment.http.HttpRequest, then if you call getParameter (String) or getParameterValues(String) on the same request object, looking for a parameter which is not supplied, a NullPointerException is thrown in the decode() method. To Reproduce, create a trivial pipeline such as the following: (in this example "request-parameter" refers to a org.apache.cocoon.matching.RequestParameterMatcher, and "set-encoding" is a org.apache.cocoon.acting.SetCharacterEncodingAction.) <map:match pattern="foo"> <map:act type="set-encoding"> <map:parameter name="form-encoding" value="UTF-8"/> </map:act> <map:match type="request-parameter" pattern="EMPTY_PARAM"> <!-- any generator and serializer can be here --> </map:match> </map:match> Accessing the url "/foo?EMPTY_PARAM=bar" works successfully. However, accessing the url: "/foo" This will throw a NPE, even though this pipeline should not continue to execute past the second matcher. I am pretty sure this bug can be fixed with a simple null check in the decode() method of HttpRequest (line 300), i.e. if (str == null) return null; else { str.getBytes(); ... } *WORKAROUND* This bug can be avoided by writing a custom action which calls request.setCharacterEncoding(null) before an optional parameter is attempted to be retrieved from the sitemap. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]