struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Wolfgang Stone (JIRA)" <j...@apache.org>
Subject [jira] [Created] (WW-4026) Exceptions swallowed in FreemarkerResult
Date Tue, 26 Mar 2013 02:37:15 GMT
Christian Wolfgang Stone created WW-4026:
--------------------------------------------

             Summary: 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


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.

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

Mime
View raw message