Sebastian Staudt created FREEMARKER-44:
------------------------------------------
Summary: 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.25-incubating, 2.3.24-incubating, 2.3.23
Environment: Tomcat 8.5.8, Spring 4.3.4, Hibernate 5.1.3
Reporter: Sebastian Staudt
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)