struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r474482 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java
Date Mon, 13 Nov 2006 20:10:01 GMT
Author: mrdon
Date: Mon Nov 13 12:10:00 2006
New Revision: 474482

URL: http://svn.apache.org/viewvc?view=rev&rev=474482
Log:
Better handling of unloadable template engines

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java?view=diff&rev=474482&r1=474481&r2=474482
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java
Mon Nov 13 12:10:00 2006
@@ -29,6 +29,9 @@
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 /**
  * The TemplateEngineManager will return a template engine for the template
  */
@@ -38,6 +41,8 @@
     /** The default template extenstion is <code>ftl</code>. */
     public static final String DEFAULT_TEMPLATE_TYPE = "ftl";
 
+    private static final Log LOG = LogFactory.getLog(TemplateEngineManager.class);
+    
     Map templateEngines = new HashMap();
     Container container;
     String defaultTemplateType;
@@ -55,9 +60,15 @@
     @Inject(StrutsConstants.STRUTS_TEMPLATE_ENGINES)
     public void setTemplateEngines(String engines) {
         if (engines != null) {
+            TemplateEngine eng = null;
             String[] list = engines.split(",");
             for (String name : list) {
-                TemplateEngine eng = container.getInstance(TemplateEngine.class, name);
+                try {
+                    eng = container.getInstance(TemplateEngine.class, name);
+                } catch (Throwable t) {
+                    LOG.info("Unable to load engine ("+name+") due to "+t.getMessage());
+                    continue;
+                }    
                 if (eng != null) {
                     templateEngines.put(name, eng);
                 } else {



Mime
View raw message