Custom error page not rendered (jsp templates) ----------------------------------------------
Key: MAGNOLIA-3107 URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-3107 Project: Magnolia Issue Type: Bug Components: templating Affects Versions: 4.3 M2, 4.2.3, 4.1.4, 4.0.3 Reporter: Diego Schivo Assignee: Philipp Bärfuss Attachments: JspTemplateRenderer.patch The problem occurs when an exception (eg: NullPointerException) is thrown during the rendering of a page with jsp template: if a custom error page (also with jsp template) has been configured in web.xml, it does not display (blank page instead). Example of web.xml configuration: {code} <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/myapp/errors/error.html</location> </error-page> {code} The MgnlMainFilter receives the request for the error page, but immediatly bypasses it, due to voter "dontDispatchOnForwardAttribute": {code} 2010-03-04 10:57:32,437 DEBUG info.magnolia.cms.filters.MgnlMainFilter MgnlMainFilter.java(doFilter:93) Handling URI: /myapp/errors/error.html - Path info: null 2010-03-04 10:57:32,437 DEBUG info.magnolia.voting.DefaultVoting DefaultVoting.java(vote:58) voter [dontDispatchOnForwardAttribute: ] fired 1 2010-03-04 10:57:32,437 DEBUG info.magnolia.voting.DefaultVoting DefaultVoting.java(vote:62) highest vote is now 1 {code} I found that the dontDispatchOnForwardAttribute voter prevents the rendering of the error page because just before starting the rendering of the original page (the one that throws the Exception) an attribute DONT_DISPATCH_ON_FORWARD_ATTRIBUTE was put in request by the JspTemplateRenderer: {code} // set this attribute to avoid a second dispatching of the filters request.setAttribute(DontDispatchOnForwardAttributeVoter.DONT_DISPATCH_ON_FORWARD_ATTRIBUTE, Boolean.TRUE); {code} JspTemplateRenderer should remove that attribute when catching the exception: this would fix the problem. See attached patch: JspTemplateRenderer.patch -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.magnolia-cms.com/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com> ----------------------------------------------------------------