This is one of the rare cases where it's OK to swallow an exception :)

Thanks Jacopo!

Jacques


Le 20/09/2016 à 16:51, jaco...@apache.org a écrit :
Author: jacopoc
Date: Tue Sep 20 14:51:20 2016
New Revision: 1761586

URL: http://svn.apache.org/viewvc?rev=1761586&view=rev
Log:
Fix for: Freemarker's ignore_missing attribute of the #include directive was not
working because of an issue in the OFBiz custom TemplateLoader for Freemarker
templates.
(OFBIZ-8292)

The OFBiz custom TemplateLoader now returns null if the resource is missing as
required by the TemplateLoader specification.
Additional cleanups for unused methods in the FreeMarkerWorker class and some
minor fine tuning; improved the way errors are rendered: now the full stack
trace is not shown in the screen but only in the logs.

Thanks: Jacques Le Roux for the report.

Modified:
     
ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java
     
ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java

+        protected URL getURL(String name) {
+            URL locationUrl = null;
+            try {
+                locationUrl = FlexibleLocation.resolveLocation(name);
+            } catch (Exception e) {
+                Debug.logWarning("Unable to locate the template: " + name, 
module);
+            }
+            return locationUrl != null && new 
File(locationUrl.getFile()).exists()? locationUrl: null;
          }
      }

Reply via email to