freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vojtech Knyttl (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FREEMARKER-48) When custom fremarker method throws exception, it is impossible to find line/row where called
Date Fri, 07 Apr 2017 10:08:41 GMT

    [ https://issues.apache.org/jira/browse/FREEMARKER-48?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15960576#comment-15960576
] 

Vojtech Knyttl commented on FREEMARKER-48:
------------------------------------------

This also happens when division by zero in the form. You have basically no chance of debugging:

```
java.lang.IllegalStateException: Error while freemarker rendering:Ticketing/Reporting/SalesAverage.ftl
: / by zero : class java.lang.ArithmeticException
	org.maite.mvc.FreemarkerService.render(FreemarkerService.java:64)
	org.maite.mvc.FreemarkerService.render(FreemarkerService.java:48)
	org.maite.mvc.FreemarkerService$$FastClassBySpringCGLIB$$c133ab89.invoke(<generated>)
	org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:629)
	org.maite.mvc.FreemarkerService$$EnhancerBySpringCGLIB$$37aa939f.render(<generated>)
```

> When custom fremarker method throws exception, it is impossible to find line/row where
called
> ---------------------------------------------------------------------------------------------
>
>                 Key: FREEMARKER-48
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-48
>             Project: Apache Freemarker
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 2.3.25-incubating
>         Environment: Any
>            Reporter: Vojtech Knyttl
>
> Consider this stacktrace:
> https://gist.github.com/knyttl/dba8f94b9736eb2751074c34dce7b467
> On line `DispatcherServlet.renderView(DispatcherServlet.java:308)` I have started freemarker
to render a template. During that process it uses custom method (`HrefMethod.exec(HrefMethod.java:28)`),
but this method threw an exception. However Freemarker does not report a line/row of the template
where this method was called making it very hard for debug.
> I would be happy if `freemarker.core.MethodCall._eval(MethodCall.java:65)` had some try-catch
blcok, that in case of an exception would add lines/rows/details of the element that caused
the exception.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message