You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by je...@apache.org on 2008/04/25 12:15:56 UTC
svn commit: r651562 -
/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
Author: jeromy
Date: Fri Apr 25 03:15:55 2008
New Revision: 651562
URL: http://svn.apache.org/viewvc?rev=651562&view=rev
Log:
FreemarkerTemplateEngine no longer swallows freemarker.core.ParseException
WW-2615
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java?rev=651562&r1=651561&r2=651562&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java Fri Apr 25 03:15:55 2008
@@ -45,6 +45,7 @@
import freemarker.template.Configuration;
import freemarker.template.SimpleHash;
+import freemarker.core.ParseException;
/**
* Freemarker based template engine.
@@ -118,7 +119,12 @@
// try to load, and if it works, stop at the first one
template = config.getTemplate(templateName);
break;
+ } catch (ParseException e) {
+ // template was found but was invalid - always report this.
+ exception = e;
+ break;
} catch (IOException e) {
+ // FileNotFoundException is anticipated - report the first IOException if no template found
if (exception == null) {
exception = e;
}
@@ -133,11 +139,6 @@
LOG.error("Attempted: " + getFinalTemplateName(t));
}
LOG.error("The TemplateLoader provided by the FreeMarker Configuration was a: "+config.getTemplateLoader().getClass().getName());
- if (freemarkerCaching) {
- LOG.error("FreeMarker Template caching is enabled ("+StrutsConstants.STRUTS_FREEMARKER_TEMPLATES_CACHE+"=true) and this template is now cached as missing (the TemplateLoader won't be asked again)");
- } else {
- LOG.error("FreeMarker Template caching is disabled ("+StrutsConstants.STRUTS_FREEMARKER_TEMPLATES_CACHE+"=false)");
- }
}
if (exception != null) {
throw exception;