From 51cb141c5ecddecd0dc5ea0a71ed2bd2c66d29f9 Mon Sep 17 00:00:00 2001 From: Deepak Dixit Date: Sat, 20 Feb 2016 12:01:23 +0000 Subject: [PATCH] OFBIZ-6277: Merge changes from r1675521 to Trunk: Log: ============================================================ new Configuration() is deprecated; instead, the desired freemarker version should be passed in. To make it easier to control the version centrally, add a helper method on FreeMarkerWorker that wraps the instantiation of the Configuration object. ============================================================ git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1731380 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/ofbiz/base/util/template/FreeMarkerWorker.java | 6 +++++- .../entity/src/org/ofbiz/entity/util/EntitySaxReader.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java b/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java index bca6eee9bc..a47bfd27a3 100644 --- a/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java +++ b/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java @@ -88,8 +88,12 @@ public class FreeMarkerWorker { return defaultOfbizWrapper; } + public static Configuration newConfiguration() { + return new Configuration(version); + } + public static Configuration makeConfiguration(BeansWrapper wrapper) { - Configuration newConfig = new Configuration(version); + Configuration newConfig = newConfiguration(); newConfig.setObjectWrapper(wrapper); TemplateHashModel staticModels = wrapper.getStaticModels(); diff --git a/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java b/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java index 075beee085..b48c3a3361 100644 --- a/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java +++ b/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java @@ -376,7 +376,7 @@ public class EntitySaxReader implements javolution.xml.sax.ContentHandler, Error Reader templateReader = new InputStreamReader(templateUrl.openStream()); StringWriter outWriter = new StringWriter(); - Configuration config = new Configuration(FreeMarkerWorker.version); + Configuration config = FreeMarkerWorker.newConfiguration(); config.setObjectWrapper(FreeMarkerWorker.getDefaultOfbizWrapper()); config.setSetting("datetime_format", "yyyy-MM-dd HH:mm:ss.SSS");