[
https://issues.apache.org/jira/browse/WW-4026?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lukasz Lenart updated WW-4026:
------------------------------
Description:
I notice that exceptions parsing freemarker results are swallowed (ie: not
reported, logged, or passed on). I put in a fix 2 years ago and have been
updating my fix in the code ever since. This does work very well for me.
{noformat}
@@ -118,6 +120,8 @@
private String pContentType = "text/html";
private static final String PARENT_TEMPLATE_WRITER =
FreemarkerResult.class.getName() + ".parentWriter";
+ private static final Logger LOG =
LoggerFactory.getLogger(FreemarkerResult.class);
+
public FreemarkerResult() {
super();
}
@@ -200,6 +204,14 @@
} else {
template.process(model, writer);
}
+ } catch (TemplateException e) {
+ if (LOG.isErrorEnabled())
+ LOG.error("Error processing Freemarker result",e);
+ throw e;
+ } catch (IOException e) {
+ if (LOG.isErrorEnabled())
+ LOG.error("Error processing Freemarker result",e);
+ throw e;
} finally {
// Give subclasses a chance to hook into postprocessing
postTemplateProcess(template, model);
{noformat}
Please consider implementing this. It would help a number of people who are
having issues and need to debug their ftl files.
was:
I notice that exceptions parsing freemarker results are swallowed (ie: not
reported, logged, or passed on). I put in a fix 2 years ago and have been
updating my fix in the code ever since. This does work very well for me.
@@ -118,6 +120,8 @@
private String pContentType = "text/html";
private static final String PARENT_TEMPLATE_WRITER =
FreemarkerResult.class.getName() + ".parentWriter";
+ private static final Logger LOG =
LoggerFactory.getLogger(FreemarkerResult.class);
+
public FreemarkerResult() {
super();
}
@@ -200,6 +204,14 @@
} else {
template.process(model, writer);
}
+ } catch (TemplateException e) {
+ if (LOG.isErrorEnabled())
+ LOG.error("Error processing Freemarker result",e);
+ throw e;
+ } catch (IOException e) {
+ if (LOG.isErrorEnabled())
+ LOG.error("Error processing Freemarker result",e);
+ throw e;
} finally {
// Give subclasses a chance to hook into postprocessing
postTemplateProcess(template, model);
Please consider implementing this. It would help a number of people who are
having issues and need to debug their ftl files.
> Exceptions swallowed in FreemarkerResult
> ----------------------------------------
>
> Key: WW-4026
> URL: https://issues.apache.org/jira/browse/WW-4026
> Project: Struts 2
> Issue Type: Bug
> Components: Value Stack
> Affects Versions: 2.3.12
> Reporter: Christian Wolfgang Stone
> Fix For: 2.3.14
>
>
> I notice that exceptions parsing freemarker results are swallowed (ie: not
> reported, logged, or passed on). I put in a fix 2 years ago and have been
> updating my fix in the code ever since. This does work very well for me.
> {noformat}
> @@ -118,6 +120,8 @@
> private String pContentType = "text/html";
> private static final String PARENT_TEMPLATE_WRITER =
> FreemarkerResult.class.getName() + ".parentWriter";
>
> + private static final Logger LOG =
> LoggerFactory.getLogger(FreemarkerResult.class);
> +
> public FreemarkerResult() {
> super();
> }
> @@ -200,6 +204,14 @@
> } else {
> template.process(model, writer);
> }
> + } catch (TemplateException e) {
> + if (LOG.isErrorEnabled())
> + LOG.error("Error processing Freemarker result",e);
> + throw e;
> + } catch (IOException e) {
> + if (LOG.isErrorEnabled())
> + LOG.error("Error processing Freemarker result",e);
> + throw e;
> } finally {
> // Give subclasses a chance to hook into postprocessing
> postTemplateProcess(template, model);
> {noformat}
> Please consider implementing this. It would help a number of people who are
> having issues and need to debug their ftl files.
--
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