freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebastian Staudt (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (FREEMARKER-44) Default adapters should handle RuntimeExceptions
Date Fri, 16 Dec 2016 08:41:58 GMT

     [ 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)

Mime
View raw message