freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject incubator-freemarker git commit: Removed the logTemplateExceptions (log_template_exceptions) setting. FreeMarker now behaves as if it was false. When a FreeMarker method throws an exception, the caller is responsible for either logging it or letting it b
Date Mon, 12 Jun 2017 20:52:06 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/3 34c767555 -> 53c2fbac8


Removed the logTemplateExceptions (log_template_exceptions) setting. FreeMarker now behaves
as if it was false. When a FreeMarker method throws an exception, the caller is responsible
for either logging it or letting it bubble up.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/53c2fbac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/53c2fbac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/53c2fbac

Branch: refs/heads/3
Commit: 53c2fbac83d3f7c7e8eb68d48da26e16306832da
Parents: 34c7675
Author: ddekany <ddekany@apache.org>
Authored: Mon Jun 12 22:49:20 2017 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Mon Jun 12 22:49:20 2017 +0200

----------------------------------------------------------------------
 FM3-CHANGE-LOG.txt                              |  3 ++
 .../freemarker/core/ConfigurationTest.java      | 18 ++++---
 .../MutableProcessingConfigurationTest.java     |  8 ---
 .../core/TemplateConfigurationTest.java         |  2 -
 .../model/impl/DefaultObjectWrapperTest.java    |  1 -
 .../apache/freemarker/core/Configuration.java   | 21 --------
 .../org/apache/freemarker/core/Environment.java | 14 ++----
 .../core/MutableProcessingConfiguration.java    | 52 --------------------
 .../core/ProcessingConfiguration.java           | 18 -------
 .../org/apache/freemarker/core/Template.java    | 10 ----
 .../freemarker/core/TemplateConfiguration.java  | 23 ---------
 .../core/TemplateExceptionHandler.java          |  5 +-
 .../manual/examples/GettingStartedExample.java  |  3 --
 .../FreemarkerServletConfigurationBuilder.java  |  6 ---
 .../servlet/jsp/RealServletContainertTest.java  | 11 ++---
 15 files changed, 24 insertions(+), 171 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/FM3-CHANGE-LOG.txt
----------------------------------------------------------------------
diff --git a/FM3-CHANGE-LOG.txt b/FM3-CHANGE-LOG.txt
index f6e7a66..1970caa 100644
--- a/FM3-CHANGE-LOG.txt
+++ b/FM3-CHANGE-LOG.txt
@@ -267,3 +267,6 @@ the FreeMarer 3 changelog here:
     like applications could break when moved to another server if the application
     was unwillingly relying on the default.
   - Changed the default of logTemplateExceptions to false.
+- Removed the logTemplateExceptions (log_template_exceptions) setting. FreeMarker now
+  behaves as if it was false. When a FreeMarker method throws an exception, the
+  caller is responsible for either logging it or letting it bubble up.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
index b06035e..395e192 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
@@ -95,21 +95,23 @@ public class ConfigurationTest {
 
     @Test
     public void testUnsetAndIsSet() throws Exception {
+        // TODO This should automatically test all setting via reflection...
+
         Configuration.ExtendableBuilder<?> cfgB = new Builder(VERSION_3_0_0);
         
-        assertFalse(cfgB.isLogTemplateExceptionsSet());
-        assertFalse(cfgB.getLogTemplateExceptions());
+        assertFalse(cfgB.isAutoEscapingPolicySet());
+        assertEquals(AutoEscapingPolicy.ENABLE_IF_DEFAULT, cfgB.getAutoEscapingPolicy());
         //
-        cfgB.setLogTemplateExceptions(true);
+        cfgB.setAutoEscapingPolicy(AutoEscapingPolicy.DISABLE);
         {
-            assertTrue(cfgB.isLogTemplateExceptionsSet());
-            assertTrue(cfgB.getLogTemplateExceptions());
+            assertTrue(cfgB.isAutoEscapingPolicySet());
+            assertEquals(AutoEscapingPolicy.DISABLE, cfgB.getAutoEscapingPolicy());
         }
         //
         for (int i = 0; i < 2; i++) {
-            cfgB.unsetLogTemplateExceptions();
-            assertFalse(cfgB.isLogTemplateExceptionsSet());
-            assertFalse(cfgB.getLogTemplateExceptions());
+            cfgB.unsetAutoEscapingPolicy();
+            assertFalse(cfgB.isAutoEscapingPolicySet());
+            assertEquals(AutoEscapingPolicy.ENABLE_IF_DEFAULT, cfgB.getAutoEscapingPolicy());
         }
 
         DefaultObjectWrapper dow = new DefaultObjectWrapper.Builder(VERSION_3_0_0).build();

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-core-test/src/test/java/org/apache/freemarker/core/MutableProcessingConfigurationTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/MutableProcessingConfigurationTest.java
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/MutableProcessingConfigurationTest.java
index 001f0bc..718bc76 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/MutableProcessingConfigurationTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/MutableProcessingConfigurationTest.java
@@ -376,14 +376,6 @@ public class MutableProcessingConfigurationTest {
     }
 
     @Test
-    public void testSetLogTemplateExceptionsViaSetSettingAPI() throws ConfigurationException
{
-        Configuration.Builder cfg = new Configuration.Builder(Configuration.VERSION_3_0_0);
-        assertFalse(cfg.getLogTemplateExceptions());
-        cfg.setSetting(MutableProcessingConfiguration.LOG_TEMPLATE_EXCEPTIONS_KEY, "true");
-        assertTrue(cfg.getLogTemplateExceptions());
-    }
-
-    @Test
     public void testApiBuiltinEnabled() throws Exception {
         try {
             new Template(

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateConfigurationTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateConfigurationTest.java
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateConfigurationTest.java
index 5cf5811..47002d8 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateConfigurationTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateConfigurationTest.java
@@ -160,7 +160,6 @@ public class TemplateConfigurationTest {
         SETTING_ASSIGNMENTS.put("dateFormat", "yyyy-#DDD");
         SETTING_ASSIGNMENTS.put("dateTimeFormat", "yyyy-#DDD-@HH:mm");
         SETTING_ASSIGNMENTS.put("locale", NON_DEFAULT_LOCALE);
-        SETTING_ASSIGNMENTS.put("logTemplateExceptions", true);
         SETTING_ASSIGNMENTS.put("newBuiltinClassResolver", TemplateClassResolver.ALLOWS_NOTHING_RESOLVER);
         SETTING_ASSIGNMENTS.put("numberFormat", "0.0000");
         SETTING_ASSIGNMENTS.put("objectWrapper",
@@ -602,7 +601,6 @@ public class TemplateConfigurationTest {
 
         {
             TemplateConfiguration.Builder tcb = new TemplateConfiguration.Builder();
-            tcb.setLogTemplateExceptions(false);
             tcb.setTabSize(3);
             TemplateConfiguration tc = tcb.build();
             assertOutputWithoutAndWithTC(tc,

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
index 0a1e16c..41acce3 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
@@ -753,7 +753,6 @@ public class DefaultObjectWrapperTest {
     private String processTemplate(ObjectWrapper objectWrapper, Object value, String ftl)
             throws TemplateException, IOException {
         Configuration cfg = new TestConfigurationBuilder()
-                .logTemplateExceptions(false)
                 .objectWrapper(objectWrapper)
                 .build();
         StringWriter out = new StringWriter();

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java
index 7009bfa..d00d0d7 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java
@@ -270,7 +270,6 @@ public final class Configuration implements TopLevelConfiguration, CustomStateSc
     private final TemplateClassResolver newBuiltinClassResolver;
     private final Boolean showErrorTips;
     private final Boolean apiBuiltinEnabled;
-    private final Boolean logTemplateExceptions;
     private final Map<String, TemplateDateFormatFactory> customDateFormats;
     private final Map<String, TemplateNumberFormatFactory> customNumberFormats;
     private final Map<String, String> autoImports;
@@ -435,7 +434,6 @@ public final class Configuration implements TopLevelConfiguration, CustomStateSc
         newBuiltinClassResolver = builder.getNewBuiltinClassResolver();
         showErrorTips = builder.getShowErrorTips();
         apiBuiltinEnabled = builder.getAPIBuiltinEnabled();
-        logTemplateExceptions = builder.getLogTemplateExceptions();
         customDateFormats = _CollectionUtil.mergeImmutableMaps(
                 builder.getImpliedCustomDateFormats(), builder.getCustomDateFormats(), false);
         customNumberFormats = _CollectionUtil.mergeImmutableMaps(
@@ -1157,20 +1155,6 @@ public final class Configuration implements TopLevelConfiguration,
CustomStateSc
     }
 
     @Override
-    public boolean getLogTemplateExceptions() {
-        return logTemplateExceptions;
-    }
-
-    /**
-     * Always {@code true} in {@link Configuration}-s; even if this setting wasn't set in
the builder, it gets a default
-     * value in the {@link Configuration}.
-     */
-    @Override
-    public boolean isLogTemplateExceptionsSet() {
-        return true;
-    }
-
-    @Override
     public boolean getLazyImports() {
         return lazyImports;
     }
@@ -2785,11 +2769,6 @@ public final class Configuration implements TopLevelConfiguration,
CustomStateSc
         }
 
         @Override
-        protected boolean getDefaultLogTemplateExceptions() {
-            return false;
-        }
-
-        @Override
         protected boolean getDefaultLazyImports() {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java b/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java
index 8b14714..f0cc5a1 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java
@@ -888,14 +888,13 @@ public final class Environment extends MutableProcessingConfiguration<Environmen
         }
         lastThrowable = templateException;
 
-        // Log the exception, if logTemplateExceptions isn't false. However, even if it's
false, if we are inside
-        // an #attempt block, it has to be logged, as it certainly won't bubble up to the
caller of FreeMarker.
-        if (LOG.isErrorEnabled() && (isInAttemptBlock() || getLogTemplateExceptions()))
{
+        // Log the exception if we are inside an #attempt block; it has to be logged, as
it certainly won't bubble up
+        // to the caller of FreeMarker.
+        if (LOG.isErrorEnabled() && isInAttemptBlock()) {
             LOG.error("Error executing FreeMarker template", templateException);
         }
 
-        // Stop exception is not passed to the handler, but
-        // explicitly rethrown.
+        // Stop exception is not passed to the handler, but explicitly rethrown.
         if (templateException instanceof StopException) {
             throw templateException;
         }
@@ -1060,11 +1059,6 @@ public final class Environment extends MutableProcessingConfiguration<Environmen
     }
 
     @Override
-    protected boolean getDefaultLogTemplateExceptions() {
-        return getMainTemplate().getLogTemplateExceptions();
-    }
-
-    @Override
     protected boolean getDefaultLazyImports() {
         return getMainTemplate().getLazyImports();
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
b/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
index 5a68436..2b80ecc 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
@@ -209,13 +209,6 @@ public abstract class MutableProcessingConfiguration<SelfT extends
MutableProces
     public static final String API_BUILTIN_ENABLED_KEY = API_BUILTIN_ENABLED_KEY_SNAKE_CASE;
     
     /** Legacy, snake case ({@code like_this}) variation of the setting name. */
-    public static final String LOG_TEMPLATE_EXCEPTIONS_KEY_SNAKE_CASE = "log_template_exceptions";
-    /** Modern, camel case ({@code likeThis}) variation of the setting name. */
-    public static final String LOG_TEMPLATE_EXCEPTIONS_KEY_CAMEL_CASE = "logTemplateExceptions";
-    /** Alias to the {@code ..._SNAKE_CASE} variation due to backward compatibility constraints.
*/
-    public static final String LOG_TEMPLATE_EXCEPTIONS_KEY = LOG_TEMPLATE_EXCEPTIONS_KEY_SNAKE_CASE;
-
-    /** Legacy, snake case ({@code like_this}) variation of the setting name. */
     public static final String LAZY_IMPORTS_KEY_SNAKE_CASE = "lazy_imports";
     /** Modern, camel case ({@code likeThis}) variation of the setting name. */
     public static final String LAZY_IMPORTS_KEY_CAMEL_CASE = "lazyImports";
@@ -258,7 +251,6 @@ public abstract class MutableProcessingConfiguration<SelfT extends
MutableProces
         LAZY_AUTO_IMPORTS_KEY_SNAKE_CASE,
         LAZY_IMPORTS_KEY_SNAKE_CASE,
         LOCALE_KEY_SNAKE_CASE,
-        LOG_TEMPLATE_EXCEPTIONS_KEY_SNAKE_CASE,
         NEW_BUILTIN_CLASS_RESOLVER_KEY_SNAKE_CASE,
         NUMBER_FORMAT_KEY_SNAKE_CASE,
         OUTPUT_ENCODING_KEY_SNAKE_CASE,
@@ -285,7 +277,6 @@ public abstract class MutableProcessingConfiguration<SelfT extends
MutableProces
         LAZY_AUTO_IMPORTS_KEY_CAMEL_CASE,
         LAZY_IMPORTS_KEY_CAMEL_CASE,
         LOCALE_KEY_CAMEL_CASE,
-        LOG_TEMPLATE_EXCEPTIONS_KEY_CAMEL_CASE,
         NEW_BUILTIN_CLASS_RESOLVER_KEY_CAMEL_CASE,
         NUMBER_FORMAT_KEY_CAMEL_CASE,
         OUTPUT_ENCODING_KEY_CAMEL_CASE,
@@ -316,7 +307,6 @@ public abstract class MutableProcessingConfiguration<SelfT extends
MutableProces
     private TemplateClassResolver newBuiltinClassResolver;
     private Boolean showErrorTips;
     private Boolean apiBuiltinEnabled;
-    private Boolean logTemplateExceptions;
     private Map<String, TemplateDateFormatFactory> customDateFormats;
     private Map<String, TemplateNumberFormatFactory> customNumberFormats;
     private Map<String, String> autoImports;
@@ -1172,45 +1162,6 @@ public abstract class MutableProcessingConfiguration<SelfT extends
MutableProces
     }
 
     @Override
-    public boolean getLogTemplateExceptions() {
-         return isLogTemplateExceptionsSet() ? logTemplateExceptions : getDefaultLogTemplateExceptions();
-    }
-
-    /**
-     * Returns the value the getter method returns when the setting is not set (possibly
by inheriting the setting value
-     * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
-     */
-    protected abstract boolean getDefaultLogTemplateExceptions();
-
-    @Override
-    public boolean isLogTemplateExceptionsSet() {
-        return logTemplateExceptions != null;
-    }
-
-    /**
-     * Setter pair of {@link #getLogTemplateExceptions()}
-     */
-    public void setLogTemplateExceptions(boolean value) {
-        logTemplateExceptions = value;
-    }
-
-    /**
-     * Fluent API equivalent of {@link #setLogTemplateExceptions(boolean)}
-     */
-    public SelfT logTemplateExceptions(boolean value) {
-        setLogTemplateExceptions(value);
-        return self();
-    }
-
-    /**
-     * Resets the setting value as if it was never set (but it doesn't affect the value inherited
from another
-     * {@link ProcessingConfiguration}).
-     */
-    public void unsetLogTemplateExceptions() {
-        logTemplateExceptions = null;
-    }
-
-    @Override
     public boolean getLazyImports() {
          return isLazyImportsSet() ? lazyImports : getDefaultLazyImports();
     }
@@ -1934,9 +1885,6 @@ public abstract class MutableProcessingConfiguration<SelfT extends
MutableProces
                             "Not predefined class resolved name, nor follows class resolver
definition syntax, nor "
                             + "looks like class name");
                 }
-            } else if (LOG_TEMPLATE_EXCEPTIONS_KEY_SNAKE_CASE.equals(name)
-                    || LOG_TEMPLATE_EXCEPTIONS_KEY_CAMEL_CASE.equals(name)) {
-                setLogTemplateExceptions(_StringUtil.getYesNo(value));
             } else if (LAZY_AUTO_IMPORTS_KEY_SNAKE_CASE.equals(name) || LAZY_AUTO_IMPORTS_KEY_CAMEL_CASE.equals(name))
{
                 setLazyAutoImports(value.equals(NULL_VALUE) ? null : Boolean.valueOf(_StringUtil.getYesNo(value)));
             } else if (LAZY_IMPORTS_KEY_SNAKE_CASE.equals(name) || LAZY_IMPORTS_KEY_CAMEL_CASE.equals(name))
{

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java
b/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java
index 7186f00..085a627 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java
@@ -533,24 +533,6 @@ public interface ProcessingConfiguration {
     boolean isShowErrorTipsSet();
 
     /**
-     * Specifies if {@link TemplateException}-s thrown by template processing are logged
by FreeMarker or not. The
-     * default is {@code true} for backward compatibility, but that results in logging the
exception twice in properly
-     * written applications, because there the {@link TemplateException} thrown by the public
FreeMarker API is also
-     * logged by the caller (even if only as the cause exception of a higher level exception).
Hence, in modern
-     * applications it should be set to {@code false}. Note that this setting has no effect
on the logging of exceptions
-     * caught by {@code #attempt}; those are always logged, no mater what (because those
exceptions won't bubble up
-     * until the API caller).
-     */
-    boolean getLogTemplateExceptions();
-
-    /**
-     * Tells if this setting is set directly in this object. If not, then depending on the
implementing class, reading
-     * the setting mights returns a default value, or returns the value of the setting from
a parent object, or throws
-     * an {@link CoreSettingValueNotSetException}.
-     */
-    boolean isLogTemplateExceptionsSet();
-
-    /**
      * Specifies if {@code <#import ...>} (and {@link Environment#importLib(String,
String)}) should delay the loading
      * and processing of the imported templates until the content of the imported namespace
is actually accessed. This
      * makes the overhead of <em>unused</em> imports negligible. A drawback is
that importing a missing or otherwise

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java b/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java
index 02680fa..f134675 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java
@@ -1007,16 +1007,6 @@ public class Template implements ProcessingConfiguration, CustomStateScope
{
     }
 
     @Override
-    public boolean getLogTemplateExceptions() {
-        return tCfg != null && tCfg.isLogTemplateExceptionsSet() ? tCfg.getLogTemplateExceptions()
: cfg.getLogTemplateExceptions();
-    }
-
-    @Override
-    public boolean isLogTemplateExceptionsSet() {
-        return tCfg != null && tCfg.isLogTemplateExceptionsSet();
-    }
-
-    @Override
     public boolean getLazyImports() {
         return tCfg != null && tCfg.isLazyImportsSet() ? tCfg.getLazyImports() :
cfg.getLazyImports();
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java
b/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java
index e7ca08a..60fa9ed 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java
@@ -71,7 +71,6 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
     private final TemplateClassResolver newBuiltinClassResolver;
     private final Boolean showErrorTips;
     private final Boolean apiBuiltinEnabled;
-    private final Boolean logTemplateExceptions;
     private final Map<String, TemplateDateFormatFactory> customDateFormats;
     private final Map<String, TemplateNumberFormatFactory> customNumberFormats;
     private final Map<String, String> autoImports;
@@ -111,7 +110,6 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
         newBuiltinClassResolver = builder.isNewBuiltinClassResolverSet() ? builder.getNewBuiltinClassResolver()
: null;
         showErrorTips = builder.isShowErrorTipsSet() ? builder.getShowErrorTips() : null;
         apiBuiltinEnabled = builder.isAPIBuiltinEnabledSet() ? builder.getAPIBuiltinEnabled()
: null;
-        logTemplateExceptions = builder.isLogTemplateExceptionsSet() ? builder.getLogTemplateExceptions()
: null;
         customDateFormats = builder.isCustomDateFormatsSet() ? builder.getCustomDateFormats()
: null;
         customNumberFormats = builder.isCustomNumberFormatsSet() ? builder.getCustomNumberFormats()
: null;
         autoImports = builder.isAutoImportsSet() ? builder.getAutoImports() : null;
@@ -509,19 +507,6 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
     }
 
     @Override
-    public boolean getLogTemplateExceptions() {
-        if (!isLogTemplateExceptionsSet()) {
-            throw new CoreSettingValueNotSetException("logTemplateExceptions");
-        }
-        return logTemplateExceptions;
-    }
-
-    @Override
-    public boolean isLogTemplateExceptionsSet() {
-        return logTemplateExceptions != null;
-    }
-
-    @Override
     public boolean getLazyImports() {
         if (!isLazyImportsSet()) {
             throw new CoreSettingValueNotSetException("lazyImports");
@@ -726,11 +711,6 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
         }
 
         @Override
-        protected boolean getDefaultLogTemplateExceptions() {
-            throw new CoreSettingValueNotSetException("logTemplateExceptions");
-        }
-
-        @Override
         protected boolean getDefaultLazyImports() {
             throw new CoreSettingValueNotSetException("lazyImports");
         }
@@ -809,9 +789,6 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
             if (tc.isLocaleSet()) {
                 setLocale(tc.getLocale());
             }
-            if (tc.isLogTemplateExceptionsSet()) {
-                setLogTemplateExceptions(tc.getLogTemplateExceptions());
-            }
             if (tc.isNamingConventionSet()) {
                 setNamingConvention(tc.getNamingConvention());
             }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateExceptionHandler.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateExceptionHandler.java
b/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateExceptionHandler.java
index 8270740..aea6c0b 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateExceptionHandler.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateExceptionHandler.java
@@ -40,9 +40,8 @@ public interface TemplateExceptionHandler {
      * 
      * <p>Note that {@link StopException}-s (raised by {@code #stop}) won't be captured.
      * 
-     * <p>Note that you shouldn't log the exception in this method unless you suppress
it. If there's a concern that the
-     * exception might won't be logged after it bubbles up from {@link Template#process(Object,
Writer)}, simply
-     * ensure that {@link Configuration#getLogTemplateExceptions()} is {@code true}. 
+     * <p>Note that you shouldn't log the exception in this method unless you suppress
the exception. After
+     * all, eventually the exception is catched somewhere and is (hopefully) logged.
      * 
      * @param te The exception that occurred; don't forget to re-throw it unless you want
to suppress it
      * @param env The runtime environment of the template

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/GettingStartedExample.java
----------------------------------------------------------------------
diff --git a/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/GettingStartedExample.java
b/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/GettingStartedExample.java
index 7a0a906..a2809a4 100644
--- a/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/GettingStartedExample.java
+++ b/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/GettingStartedExample.java
@@ -20,7 +20,6 @@ package org.apache.freemarker.manual.examples;
 
 import java.io.OutputStreamWriter;
 import java.io.Writer;
-import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -40,9 +39,7 @@ public class GettingStartedExample {
         /* Create the configuration singleton (using builder pattern) */
         Configuration cfg = new Configuration.Builder(Configuration.VERSION_3_0_0)
                 .templateLoader(new ClassTemplateLoader(GettingStartedExample.class, ""))
-                .sourceEncoding(StandardCharsets.UTF_8)
                 .templateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER)
-                .logTemplateExceptions(false)
                 .build();
 
         /* ------------------------------------------------------------------------ */  
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServletConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServletConfigurationBuilder.java
b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServletConfigurationBuilder.java
index c3eee4d..ecc1dff 100644
--- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServletConfigurationBuilder.java
+++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServletConfigurationBuilder.java
@@ -49,12 +49,6 @@ public class FreemarkerServletConfigurationBuilder<SelfT extends FreemarkerServl
         return TemplateExceptionHandler.HTML_DEBUG_HANDLER;
     }
 
-    // TODO [FM3] Remove when this will be the ExtendableBuilder default too.
-    @Override
-    protected boolean getDefaultLogTemplateExceptions() {
-        return false;
-    }
-
     @Override
     public void setTemplateLoader(TemplateLoader templateLoader) {
         super.setTemplateLoader(templateLoader);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/53c2fbac/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/RealServletContainertTest.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/RealServletContainertTest.java
b/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/RealServletContainertTest.java
index 32412a9..d881fe8 100644
--- a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/RealServletContainertTest.java
+++ b/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/RealServletContainertTest.java
@@ -385,9 +385,7 @@ public class RealServletContainertTest extends WebAppTestCase {
             assertEquals(Configuration.VERSION_3_0_0, cfg.getIncompatibleImprovements());
             
             assertSame(cfg.getTemplateExceptionHandler(), TemplateExceptionHandler.HTML_DEBUG_HANDLER);
-            
-            assertFalse(cfg.getLogTemplateExceptions());
-            
+
             {
                 ObjectWrapper ow = cfg.getObjectWrapper();
                 assertTrue(ow instanceof DefaultObjectWrapper);
@@ -410,14 +408,15 @@ public class RealServletContainertTest extends WebAppTestCase {
         protected Configuration.ExtendableBuilder createConfigurationBuilder() {
             return new FreemarkerServletConfigurationBuilder(
                     AssertCustomizedDefaultsFreemarkerServlet.this, Configuration.VERSION_3_0_0)
{
+
                 @Override
                 protected TemplateExceptionHandler getDefaultTemplateExceptionHandler() {
                     return TemplateExceptionHandler.RETHROW_HANDLER;
                 }
 
                 @Override
-                protected boolean getDefaultLogTemplateExceptions() {
-                    return true;
+                protected String getDefaultBooleanFormat() {
+                    return "Y,N";
                 }
 
                 @Override
@@ -440,7 +439,7 @@ public class RealServletContainertTest extends WebAppTestCase {
             
             assertSame(cfg.getTemplateExceptionHandler(), TemplateExceptionHandler.RETHROW_HANDLER);
             
-            assertTrue(cfg.getLogTemplateExceptions());
+            assertEquals("Y,N", cfg.getBooleanFormat());
             
             {
                 ObjectWrapper ow = cfg.getObjectWrapper();


Mime
View raw message