You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by "Sebastian Staudt (JIRA)" <ji...@apache.org> on 2016/12/16 08:41:58 UTC
[jira] [Updated] (FREEMARKER-44) Default adapters should handle
RuntimeExceptions
[ https://issues.apache.org/jira/browse/FREEMARKER-44?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebastian Staudt updated FREEMARKER-44:
---------------------------------------
Description:
I'm using Freemarker in a Spring web application and started to move to lazy loaded Hibernate associations recently.
I noticed that Hibernate's infamous {{LazyInitializationException}} causes the exception to be handled by the {{DispatcherServlet}}, leaving my {{TemplateExceptionHandler}} unnoticed.
After digging a bit through Freemarker's code the reason seems to be that default adapters like {{DefaultListAdapter}} do not handle exception e.g. when calling {{list.size()}}.
IMHO, the default adapters should catch {{RuntimeException}} s inside their methods and rethrow them wrapped into a {{TemplateException}}.
was:
I'm using Freemarker in a Spring web application and started to move to lazy loaded Hibernate associations recently.
I noticed that Hibernate's infamous {{LazyInitializationException}} causes the exception to be handled by the {{DispatcherServlet}}, leaving my {{TemplateExceptionHandler}} unnoticed.
After digging a bit through Freemarker's code the reason seems to be that default adapters like {{DefaultListAdapter}} do not handle exception e.g. when calling {{list.size()}}.
IMHO, the default adapters should catch {{RuntimeException}}s inside their methods and rethrow them wrapped into a {{TemplateException}}.
> Default adapters should handle RuntimeExceptions
> ------------------------------------------------
>
> Key: FREEMARKER-44
> URL: https://issues.apache.org/jira/browse/FREEMARKER-44
> Project: Apache Freemarker
> Issue Type: Bug
> Components: engine
> Affects Versions: 2.3.23, 2.3.24-incubating, 2.3.25-incubating
> Environment: Tomcat 8.5.8, Spring 4.3.4, Hibernate 5.1.3
> Reporter: Sebastian Staudt
> Labels: exception-handling
>
> I'm using Freemarker in a Spring web application and started to move to lazy loaded Hibernate associations recently.
> I noticed that Hibernate's infamous {{LazyInitializationException}} causes the exception to be handled by the {{DispatcherServlet}}, leaving my {{TemplateExceptionHandler}} unnoticed.
> After digging a bit through Freemarker's code the reason seems to be that default adapters like {{DefaultListAdapter}} do not handle exception e.g. when calling {{list.size()}}.
> IMHO, the default adapters should catch {{RuntimeException}} s inside their methods and rethrow them wrapped into a {{TemplateException}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)