Allowed template_loader=null when loading configuration settings from string-string pairs.
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/61054200 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/61054200 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/61054200 Branch: refs/heads/2.3 Commit: 610542009ed5c0dd864d66399b55274fcdbc7b23 Parents: 1ca0b01 Author: ddekany <[email protected]> Authored: Sun Feb 5 19:13:37 2017 +0100 Committer: ddekany <[email protected]> Committed: Sun Feb 5 19:13:37 2017 +0100 ---------------------------------------------------------------------- src/main/java/freemarker/core/Configurable.java | 2 +- src/main/java/freemarker/template/Configuration.java | 4 ++-- src/manual/en_US/book.xml | 9 +++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/61054200/src/main/java/freemarker/core/Configurable.java ---------------------------------------------------------------------- diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java index 8dc4762..60372b9 100644 --- a/src/main/java/freemarker/core/Configurable.java +++ b/src/main/java/freemarker/core/Configurable.java @@ -2270,7 +2270,7 @@ public class Configurable { * <li><p>{@code "template_loader"}: * See: {@link Configuration#setTemplateLoader(TemplateLoader)}. * <br>String value: {@code "default"} (case insensitive) for the default, or else interpreted as an - * <a href="#fm_obe">object builder expression</a>. + * <a href="#fm_obe">object builder expression</a>. {@code "null"} is also allowed since 2.3.26. * * <li><p>{@code "template_lookup_strategy"}: * See: {@link Configuration#setTemplateLookupStrategy(freemarker.cache.TemplateLookupStrategy)}. http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/61054200/src/main/java/freemarker/template/Configuration.java ---------------------------------------------------------------------- diff --git a/src/main/java/freemarker/template/Configuration.java b/src/main/java/freemarker/template/Configuration.java index 2b88bde..e6bbf3d 100644 --- a/src/main/java/freemarker/template/Configuration.java +++ b/src/main/java/freemarker/template/Configuration.java @@ -1142,7 +1142,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf /** * Sets a {@link TemplateLoader} that is used to look up and load templates; - * as a side effect the template cache will be emptied. + * as a side effect the template cache will be emptied (unless the new and the old values are the same). * By providing your own {@link TemplateLoader} implementation, you can load templates from whatever kind of * storages, like from relational databases, NoSQL-storages, etc. * @@ -2968,7 +2968,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf unsetTemplateLoader(); } else { setTemplateLoader((TemplateLoader) _ObjectBuilderSettingEvaluator.eval( - value, TemplateLoader.class, false, _SettingEvaluationEnvironment.getCurrent())); + value, TemplateLoader.class, true, _SettingEvaluationEnvironment.getCurrent())); } } else if (TEMPLATE_LOOKUP_STRATEGY_KEY_SNAKE_CASE.equals(name) || TEMPLATE_LOOKUP_STRATEGY_KEY_CAMEL_CASE.equals(name)) { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/61054200/src/manual/en_US/book.xml ---------------------------------------------------------------------- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index af466b3..3f9ccef 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -26864,6 +26864,15 @@ TemplateModel x = env.getVariable("x"); // get variable x</programlisting> method encapsulates the call to the platform XML parser, we thought it's better to point this risk out.</para> </listitem> + + <listitem> + <para><literal>Configuration.setSetting(String, + String)</literal> and <literal>setSettings</literal> now allows + <literal>null</literal> value for + <literal>template_loader</literal> (because + <literal>Configuration.setTemplateLoader(null)</literal> is also + allowed for a while.).</para> + </listitem> </itemizedlist> </section>
