You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (JIRA)" <ji...@apache.org> on 2012/10/11 14:59:03 UTC

[jira] [Resolved] (WW-3609) Struts problem report not working properly (Freemarker template error in error.ftl at line 68 in conjunction with special exception types)

     [ https://issues.apache.org/jira/browse/WW-3609?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukasz Lenart resolved WW-3609.
-------------------------------

    Resolution: Fixed
      Assignee: Lukasz Lenart

Added a better way to handle exceptions during preparing problem report, please check with the latest snapshot version.
                
> Struts problem report not working properly (Freemarker template error in error.ftl at line 68 in conjunction with special exception types)
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-3609
>                 URL: https://issues.apache.org/jira/browse/WW-3609
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.2.1
>         Environment: Sun JDK 1.6
>            Reporter: Markus Kreusch
>            Assignee: Lukasz Lenart
>            Priority: Minor
>             Fix For: 2.3.6
>
>         Attachments: freemarker-template-error.html, IndexAction.java
>
>
> I've a struts 2 application where the instantiation of an action leads to a org.hibernate.exception.GenericJDBCException. This exception is "expected" (during development) and because development mode is enabled it should lead to a "Struts Problem Report" page showing the exception details.
> The problem report page does not contain the full information of the exception but a big yellow box titled "FreeMarker template error!" appears. Details inside the box are:
> Method public java.lang.String org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on org.hibernate.exception.GenericJDBCException: could not execute query
> The problematic instruction:
> ----------
> ==> ${msg[0]} [on line 68, column 29 in org/apache/struts2/dispatcher/error.ftl]
> freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on org.hibernate.exception.GenericJDBCException: could not execute query
> 	at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)
> .... [part of the stack trace ommited]
> Caused by: java.lang.NullPointerException
> 	at freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:85)
> 	at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)
> 	... 47 more
> I could determine the exact position of the NullPointerException by debugging the code. I'm not sure why but the class SimpleMemberModel gets instantiated
> with the method org.hibernate.exception.NestableRuntimeException.getMessage(int) and null for the argTypes array. This leads to the NullPointerException at line 85 (int typeLen = argTypes.length;). Maybe struts is "confused" because the class org.hibernate.exception.NestableRuntimeException contains two methods called getMessage one without and one with an int as parameter. I'll try to create a minimal example to reproduce the behaviour as soon as possible.
> The main problem with this issue is that the stack trace of the former exception is swallowed, not printed in the logfile or anywhere else. Please check and hopefully fix this it took some hours to understand what the reason of this error is.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira