You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2017/06/03 15:19:29 UTC
incubator-freemarker git commit: Changed SettingValueNotSetException
exception hierarchy so that CustomSettingValueNotSetException has no
redundant name property.
Repository: incubator-freemarker
Updated Branches:
refs/heads/3 658aec12f -> 2f1f291dd
Changed SettingValueNotSetException exception hierarchy so that CustomSettingValueNotSetException has no redundant name property.
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/2f1f291d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/2f1f291d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/2f1f291d
Branch: refs/heads/3
Commit: 2f1f291dd163fbe47c0ebc8f0666908843b5d01c
Parents: 658aec1
Author: ddekany <dd...@apache.org>
Authored: Sat Jun 3 17:18:51 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Jun 3 17:18:51 2017 +0200
----------------------------------------------------------------------
.../freemarker/core/CustomSettingTest.java | 2 +-
.../apache/freemarker/core/Configuration.java | 6 +-
.../core/CoreSettingValueNotSetException.java | 47 ++++++
.../core/CustomSettingNotSetException.java | 49 -------
.../core/CustomSettingValueNotSetException.java | 57 ++++++++
.../org/apache/freemarker/core/Environment.java | 2 +-
...utableParsingAndProcessingConfiguration.java | 18 +--
.../core/MutableProcessingConfiguration.java | 52 +++----
.../freemarker/core/ParsingConfiguration.java | 18 +--
.../core/ProcessingConfiguration.java | 56 +++----
.../core/SettingValueNotSetException.java | 29 ++--
.../org/apache/freemarker/core/Template.java | 2 +-
.../freemarker/core/TemplateConfiguration.java | 146 +++++++++----------
13 files changed, 266 insertions(+), 218 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/freemarker-core-test/src/test/java/org/apache/freemarker/core/CustomSettingTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/CustomSettingTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/CustomSettingTest.java
index 9a56566..d1b8521 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/CustomSettingTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/CustomSettingTest.java
@@ -131,7 +131,7 @@ public class CustomSettingTest {
try {
pc.getCustomSetting(key);
fail();
- } catch (CustomSettingNotSetException e) {
+ } catch (CustomSettingValueNotSetException e) {
assertSame(key, e.getKey());
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/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 ef764c4..574fa82 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
@@ -134,7 +134,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
*
* <p>{@link Configuration} is thread-safe and (as of 3.0.0) immutable (apart from internal caches).
*
- * <p>The setting reader methods of this class don't throw {@link SettingValueNotSetException}, because all settings
+ * <p>The setting reader methods of this class don't throw {@link CoreSettingValueNotSetException}, because all settings
* are set on the {@link Configuration} level (even if they were just initialized to a default value).
*/
public final class Configuration
@@ -1215,7 +1215,7 @@ public final class Configuration
if (useDefaultValue) {
return defaultValue;
}
- throw new CustomSettingNotSetException(key);
+ throw new CustomSettingValueNotSetException(key);
}
@Override
@@ -2630,7 +2630,7 @@ public final class Configuration
if (useDefaultValue) {
return defaultValue;
}
- throw new CustomSettingNotSetException(key);
+ throw new CustomSettingValueNotSetException(key);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/freemarker-core/src/main/java/org/apache/freemarker/core/CoreSettingValueNotSetException.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/CoreSettingValueNotSetException.java b/freemarker-core/src/main/java/org/apache/freemarker/core/CoreSettingValueNotSetException.java
new file mode 100644
index 0000000..ee7a3bc
--- /dev/null
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/CoreSettingValueNotSetException.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.freemarker.core;
+
+import org.apache.freemarker.core.util._StringUtil;
+
+/**
+ * Thrown when you try to read a core (that is, non-custom) configuration setting which wasn't set and isn't inherited
+ * from a parent object and has no default either. Because {@link Configuration} specifies a default value for all
+ * core settings, objects that has a {@link Configuration} in their inheritance chain (like {@link Environment},
+ * {@link Template}) won't throw this.
+ */
+public class CoreSettingValueNotSetException extends SettingValueNotSetException {
+
+ private final String settingName;
+
+ /**
+ * Same as {@link #CoreSettingValueNotSetException(String, Throwable)} with {@code null} cause.
+ */
+ public CoreSettingValueNotSetException(String settingName) {
+ this(settingName, null);
+ }
+
+ public CoreSettingValueNotSetException(String settingName, Throwable cause) {
+ super("The " + _StringUtil.jQuote(settingName) + " setting is not set in this layer and has no default here "
+ + "either.", cause);
+ this.settingName = settingName;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/freemarker-core/src/main/java/org/apache/freemarker/core/CustomSettingNotSetException.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/CustomSettingNotSetException.java b/freemarker-core/src/main/java/org/apache/freemarker/core/CustomSettingNotSetException.java
deleted file mode 100644
index 743ec36..0000000
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/CustomSettingNotSetException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.freemarker.core;
-
-import java.io.Serializable;
-
-import org.apache.freemarker.core.util._StringUtil;
-
-/**
- * Thrown by {@link ProcessingConfiguration#getCustomSetting(Serializable)} if the custom setting is not set.
- */
-public class CustomSettingNotSetException extends SettingValueNotSetException {
-
- private final Serializable key;
-
- /**
- * @param key {@link ProcessingConfiguration#getCustomSetting(Serializable)}
- */
- public CustomSettingNotSetException(Serializable key) {
- super("custom[" + key instanceof String ? _StringUtil.jQuote(key)
- : key.getClass().getName() + " " + _StringUtil.tryToString(key) + "]",
- false);
- this.key = key;
- }
-
- /**
- * The argument to {@link ProcessingConfiguration#getCustomSetting(Serializable)}.
- */
- public Serializable getKey() {
- return key;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/freemarker-core/src/main/java/org/apache/freemarker/core/CustomSettingValueNotSetException.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/CustomSettingValueNotSetException.java b/freemarker-core/src/main/java/org/apache/freemarker/core/CustomSettingValueNotSetException.java
new file mode 100644
index 0000000..7f427f6
--- /dev/null
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/CustomSettingValueNotSetException.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.freemarker.core;
+
+import java.io.Serializable;
+
+import org.apache.freemarker.core.util._StringUtil;
+
+/**
+ * Thrown by {@link ProcessingConfiguration#getCustomSetting(Serializable)} if the custom setting is not set.
+ */
+public class CustomSettingValueNotSetException extends SettingValueNotSetException {
+
+ private final Serializable key;
+
+ /**
+ * Same as {@link #CustomSettingValueNotSetException(Serializable, Throwable)} with {@code null} cause.
+ */
+ public CustomSettingValueNotSetException(Serializable key) {
+ this(key, null);
+ }
+
+ /**
+ * @param key {@link ProcessingConfiguration#getCustomSetting(Serializable)}
+ */
+ public CustomSettingValueNotSetException(Serializable key, Throwable cause) {
+ super("The " + _StringUtil.jQuote(key)
+ + (key instanceof String ? "" : " (key class " + key.getClass().getName() + ")")
+ + " setting is not set in this layer and has no default here either.",
+ cause);
+ this.key = key;
+ }
+
+ /**
+ * The argument to {@link ProcessingConfiguration#getCustomSetting(Serializable)}.
+ */
+ public Serializable getKey() {
+ return key;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/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 d4211b6..b3c4150 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
@@ -99,7 +99,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
* If you need to modify or read this object before or after the <tt>process</tt> call, use
* {@link Template#createProcessingEnvironment(Object rootMap, Writer out, ObjectWrapper wrapper)}
* <p>
- * The {@link ProcessingConfiguration} reader methods of this class don't throw {@link SettingValueNotSetException}
+ * The {@link ProcessingConfiguration} reader methods of this class don't throw {@link CoreSettingValueNotSetException}
* because unset settings are ultimately inherited from {@link Configuration}.
*/
public final class Environment extends MutableProcessingConfiguration<Environment> implements CustomStateScope {
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/freemarker-core/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java
index 1805b54..49cc921 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java
@@ -80,7 +80,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
/**
* Returns the value the getter method returns when the setting is not set, possibly by inheriting the setting value
- * from another {@link ParsingConfiguration}, or throws {@link SettingValueNotSetException}.
+ * from another {@link ParsingConfiguration}, or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract TagSyntax getDefaultTagSyntax();
@@ -96,7 +96,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
/**
* Returns the value the getter method returns when the setting is not set, possibly by inheriting the setting value
- * from another {@link ParsingConfiguration}, or throws {@link SettingValueNotSetException}.
+ * from another {@link ParsingConfiguration}, or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract TemplateLanguage getDefaultTemplateLanguage();
@@ -167,7 +167,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
/**
* Returns the value the getter method returns when the setting is not set, possibly by inheriting the setting value
- * from another {@link ParsingConfiguration}, or throws {@link SettingValueNotSetException}.
+ * from another {@link ParsingConfiguration}, or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract NamingConvention getDefaultNamingConvention();
@@ -212,7 +212,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
/**
* Returns the value the getter method returns when the setting is not set, possibly by inheriting the setting value
- * from another {@link ParsingConfiguration}, or throws {@link SettingValueNotSetException}.
+ * from another {@link ParsingConfiguration}, or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract boolean getDefaultWhitespaceStripping();
@@ -258,7 +258,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
/**
* Returns the value the getter method returns when the setting is not set, possibly by inheriting the setting value
- * from another {@link ParsingConfiguration}, or throws {@link SettingValueNotSetException}.
+ * from another {@link ParsingConfiguration}, or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract AutoEscapingPolicy getDefaultAutoEscapingPolicy();
@@ -304,7 +304,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
/**
* Returns the value the getter method returns when the setting is not set, possibly by inheriting the setting value
- * from another {@link ParsingConfiguration}, or throws {@link SettingValueNotSetException}.
+ * from another {@link ParsingConfiguration}, or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract OutputFormat getDefaultOutputFormat();
@@ -349,7 +349,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
/**
* Returns the value the getter method returns when the setting is not set, possibly by inheriting the setting value
- * from another {@link ParsingConfiguration}, or throws {@link SettingValueNotSetException}.
+ * from another {@link ParsingConfiguration}, or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract boolean getDefaultRecognizeStandardFileExtensions();
@@ -368,7 +368,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
/**
* Returns the value the getter method returns when the setting is not set, possibly by inheriting the setting value
- * from another {@link ParsingConfiguration}, or throws {@link SettingValueNotSetException}.
+ * from another {@link ParsingConfiguration}, or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract Charset getDefaultSourceEncoding();
@@ -439,7 +439,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
/**
* Returns the value the getter method returns when the setting is not set, possibly by inheriting the setting value
- * from another {@link ParsingConfiguration}, or throws {@link SettingValueNotSetException}.
+ * from another {@link ParsingConfiguration}, or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract int getDefaultTabSize();
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/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 ff50bd8..441a8e6 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
@@ -353,7 +353,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract Locale getDefaultLocale();
@@ -416,7 +416,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract TimeZone getDefaultTimeZone();
@@ -459,7 +459,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract TimeZone getDefaultSQLDateAndTimeTimeZone();
@@ -499,7 +499,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract String getDefaultNumberFormat();
@@ -648,7 +648,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract String getDefaultBooleanFormat();
@@ -688,7 +688,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract String getDefaultTimeFormat();
@@ -728,7 +728,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract String getDefaultDateFormat();
@@ -768,7 +768,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract String getDefaultDateTimeFormat();
@@ -888,7 +888,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract TemplateExceptionHandler getDefaultTemplateExceptionHandler();
@@ -928,7 +928,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract ArithmeticEngine getDefaultArithmeticEngine();
@@ -969,7 +969,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract ObjectWrapper getDefaultObjectWrapper();
@@ -1012,7 +1012,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract Charset getDefaultOutputEncoding();
@@ -1053,7 +1053,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract Charset getDefaultURLEscapingCharset();
@@ -1094,7 +1094,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract TemplateClassResolver getDefaultNewBuiltinClassResolver();
@@ -1133,7 +1133,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract boolean getDefaultAutoFlush();
@@ -1172,7 +1172,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract boolean getDefaultShowErrorTips();
@@ -1211,7 +1211,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract boolean getDefaultAPIBuiltinEnabled();
@@ -1227,7 +1227,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract boolean getDefaultLogTemplateExceptions();
@@ -1266,7 +1266,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract boolean getDefaultLazyImports();
@@ -1305,7 +1305,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract Boolean getDefaultLazyAutoImports();
@@ -1392,7 +1392,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract Map<String,String> getDefaultAutoImports();
@@ -1459,7 +1459,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
/**
* 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 SettingValueNotSetException}.
+ * from another {@link ProcessingConfiguration}), or throws {@link CoreSettingValueNotSetException}.
*/
protected abstract List<String> getDefaultAutoIncludes();
@@ -2181,7 +2181,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
}
@Override
- public Object getCustomSetting(Serializable key) throws CustomSettingNotSetException {
+ public Object getCustomSetting(Serializable key) throws CustomSettingValueNotSetException {
return getCustomSetting(key, null, false);
}
@@ -2235,14 +2235,14 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
*
* @param useDefaultValue
* If {@code true}, and the attribute is missing, then return {@code defaultValue}, otherwise throw {@link
- * CustomSettingNotSetException}.
+ * CustomSettingValueNotSetException}.
*
- * @throws CustomSettingNotSetException
+ * @throws CustomSettingValueNotSetException
* if the attribute wasn't set in the parents, or has no default otherwise, and {@code useDefaultValue} was
* {@code false}.
*/
protected abstract Object getDefaultCustomSetting(
- Serializable key, Object defaultValue, boolean useDefaultValue) throws CustomSettingNotSetException;
+ Serializable key, Object defaultValue, boolean useDefaultValue) throws CustomSettingValueNotSetException;
/**
* Convenience method for calling {@link #setCustomSetting(Serializable, Object)} for each {@link Map} entry.
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/freemarker-core/src/main/java/org/apache/freemarker/core/ParsingConfiguration.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ParsingConfiguration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ParsingConfiguration.java
index 6b40359..60a99ab 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ParsingConfiguration.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ParsingConfiguration.java
@@ -72,7 +72,7 @@ public interface ParsingConfiguration {
/**
* Tells if this setting is set directly in this object. If not, then depending on the implementing class, reading
* the setting might returns a default value, or returns the value of the setting from a parent parsing
- * configuration or throws a {@link SettingValueNotSetException}.
+ * configuration or throws a {@link CoreSettingValueNotSetException}.
*/
boolean isTagSyntaxSet();
@@ -122,7 +122,7 @@ public interface ParsingConfiguration {
/**
* Tells if this setting is set directly in this object. If not, then depending on the implementing class, reading
* the setting might returns a default value, or returns the value of the setting from a parent parsing
- * configuration or throws a {@link SettingValueNotSetException}.
+ * configuration or throws a {@link CoreSettingValueNotSetException}.
*/
boolean isNamingConventionSet();
@@ -134,7 +134,7 @@ public interface ParsingConfiguration {
/**
* Tells if this setting is set directly in this object. If not, then depending on the implementing class, reading
* the setting might returns a default value, or returns the value of the setting from a parent parsing
- * configuration or throws a {@link SettingValueNotSetException}.
+ * configuration or throws a {@link CoreSettingValueNotSetException}.
*/
boolean isWhitespaceStrippingSet();
@@ -147,7 +147,7 @@ public interface ParsingConfiguration {
/**
* Tells if this setting is set directly in this object. If not, then depending on the implementing class, reading
* the setting might returns a default value, or returns the value of the setting from a parent parsing
- * configuration or throws a {@link SettingValueNotSetException}.
+ * configuration or throws a {@link CoreSettingValueNotSetException}.
*/
boolean isArithmeticEngineSet();
@@ -159,7 +159,7 @@ public interface ParsingConfiguration {
/**
* Tells if this setting is set directly in this object. If not, then depending on the implementing class, reading
* the setting might returns a default value, or returns the value of the setting from a parent parsing
- * configuration or throws a {@link SettingValueNotSetException}.
+ * configuration or throws a {@link CoreSettingValueNotSetException}.
*/
boolean isAutoEscapingPolicySet();
@@ -189,7 +189,7 @@ public interface ParsingConfiguration {
/**
* Tells if this setting is set directly in this object. If not, then depending on the implementing class, reading
* the setting might returns a default value, or returns the value of the setting from a parent parsing
- * configuration or throws a {@link SettingValueNotSetException}.
+ * configuration or throws a {@link CoreSettingValueNotSetException}.
*/
boolean isOutputFormatSet();
@@ -223,7 +223,7 @@ public interface ParsingConfiguration {
/**
* Tells if this setting is set directly in this object. If not, then depending on the implementing class, reading
* the setting might returns a default value, or returns the value of the setting from a parent parsing
- * configuration or throws a {@link SettingValueNotSetException}.
+ * configuration or throws a {@link CoreSettingValueNotSetException}.
*/
boolean isRecognizeStandardFileExtensionsSet();
@@ -246,7 +246,7 @@ public interface ParsingConfiguration {
/**
* Tells if this setting is set directly in this object. If not, then depending on the implementing class, reading
* the setting might returns a default value, or returns the value of the setting from a parent parsing
- * configuration or throws a {@link SettingValueNotSetException}.
+ * configuration or throws a {@link CoreSettingValueNotSetException}.
*/
boolean isTabSizeSet();
@@ -271,7 +271,7 @@ public interface ParsingConfiguration {
/**
* Tells if this setting is set directly in this object. If not, then depending on the implementing class, reading
* the setting might returns a default value, or returns the value of the setting from a parent parsing
- * configuration or throws a {@link SettingValueNotSetException}.
+ * configuration or throws a {@link CoreSettingValueNotSetException}.
*/
boolean isSourceEncodingSet();
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/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 a9c4584..e04075b 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
@@ -66,7 +66,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isLocaleSet();
@@ -86,7 +86,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isTimeZoneSet();
@@ -149,7 +149,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isSQLDateAndTimeTimeZoneSet();
@@ -180,7 +180,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isNumberFormatSet();
@@ -214,7 +214,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isCustomNumberFormatsSet();
@@ -232,7 +232,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isBooleanFormatSet();
@@ -249,7 +249,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isTimeFormatSet();
@@ -266,7 +266,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isDateFormatSet();
@@ -361,7 +361,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isDateTimeFormatSet();
@@ -396,7 +396,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isCustomDateFormatsSet();
@@ -426,7 +426,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isTemplateExceptionHandlerSet();
@@ -440,7 +440,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isArithmeticEngineSet();
@@ -454,7 +454,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isObjectWrapperSet();
@@ -471,7 +471,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isOutputEncodingSet();
@@ -484,7 +484,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isURLEscapingCharsetSet();
@@ -500,7 +500,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isNewBuiltinClassResolverSet();
@@ -513,7 +513,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isAPIBuiltinEnabledSet();
@@ -532,7 +532,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isAutoFlushSet();
@@ -545,7 +545,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isShowErrorTipsSet();
@@ -563,7 +563,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isLogTemplateExceptionsSet();
@@ -590,7 +590,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isLazyImportsSet();
@@ -605,7 +605,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isLazyAutoImportsSet();
@@ -641,7 +641,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isAutoImportsSet();
@@ -669,7 +669,7 @@ public interface ProcessingConfiguration {
/**
* 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 SettingValueNotSetException}.
+ * an {@link CoreSettingValueNotSetException}.
*/
boolean isAutoIncludesSet();
@@ -712,14 +712,14 @@ public interface ProcessingConfiguration {
* this value is already unwrapped (i.e. it's a <code>String</code>, or a <code>List</code>, or a <code>Map</code>,
* ...etc., not a FreeMarker specific class).
*
- * @throws CustomSettingNotSetException if the custom setting was not set (not even to {@code null}), nor in
+ * @throws CustomSettingValueNotSetException if the custom setting was not set (not even to {@code null}), nor in
* this {@link ProcessingConfiguration}, nor in another where we inherit settings from. Use
* {@link #getCustomSetting(Serializable, Object)} to avoid this exception.
*/
- Object getCustomSetting(Serializable key) throws CustomSettingNotSetException;
+ Object getCustomSetting(Serializable key) throws CustomSettingValueNotSetException;
/**
- * Same as {@link #getCustomSetting(Serializable)}, but instead of throwing {@link CustomSettingNotSetException}
+ * Same as {@link #getCustomSetting(Serializable)}, but instead of throwing {@link CustomSettingValueNotSetException}
* it returns the default value specified as the 2nd argument.
*
* @param defaultValue
@@ -734,7 +734,7 @@ public interface ProcessingConfiguration {
* Tells if this custom setting is set directly in this object (not in its parent
* {@link ProcessingConfiguration}). If not, then depending on the implementing class, reading the custom
* attribute might returns the value of the setting from a parent object, or returns {@code null}, or throws a
- * {@link SettingValueNotSetException}. Note that if an attribute was set to {@code
+ * {@link CoreSettingValueNotSetException}. Note that if an attribute was set to {@code
* null} (as opposed to not set at all) then this method will return {@code true}.
*/
boolean isCustomSettingSet(Serializable key);
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/freemarker-core/src/main/java/org/apache/freemarker/core/SettingValueNotSetException.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/SettingValueNotSetException.java b/freemarker-core/src/main/java/org/apache/freemarker/core/SettingValueNotSetException.java
index c9817cf..766669e 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/SettingValueNotSetException.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/SettingValueNotSetException.java
@@ -1,43 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.freemarker.core;
-import org.apache.freemarker.core.util._StringUtil;
-
/**
* Thrown when you try to read a configuration setting which wasn't set and isn't inherited from a parent object and has
- * no default either. Because {@link Configuration} specifies a default value for all settings, objects that has a
- * {@link Configuration} in their inheritance chain (like {@link Environment}, {@link Template}) won't throw this.
+ * no default either.
*/
-public class SettingValueNotSetException extends IllegalStateException {
-
- private final String settingName;
+public abstract class SettingValueNotSetException extends RuntimeException {
- public SettingValueNotSetException(String settingName) {
- this(settingName, true);
+ public SettingValueNotSetException(String message) {
+ super(message);
}
- public SettingValueNotSetException(String settingName, boolean quoteSettingName) {
- super("The " + (quoteSettingName ? _StringUtil.jQuote(settingName) : settingName)
- + " setting is not set in this layer and has no default here either.");
- this.settingName = settingName;
+ public SettingValueNotSetException(String message, Throwable cause) {
+ super(message, cause);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/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 ab9cc71..3b99ddf 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
@@ -74,7 +74,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
* {@link Template} objects if possible. {@link Configuration#getTemplate(String)} (and its overloads) does that
* (caching {@link Template}-s) for you, but the constructor of course doesn't, so it's up to you to solve then.
* <p>
- * The {@link ProcessingConfiguration} reader methods of this class don't throw {@link SettingValueNotSetException}
+ * The {@link ProcessingConfiguration} reader methods of this class don't throw {@link CoreSettingValueNotSetException}
* because unset settings are ultimately inherited from {@link Configuration}.
* <p>
* Objects of this class are immutable and thus thread-safe.
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2f1f291d/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 6c837e4..2b9b0ab 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
@@ -40,7 +40,7 @@ import org.apache.freemarker.core.valueformat.TemplateNumberFormatFactory;
* A partial set of configuration settings used for customizing the {@link Configuration}-level settings for individual
* {@link Template}-s (or rather, for a group of templates). That it's partial means that you should call the
* corresponding {@code isXxxSet()} before getting a settings, or else you may cause
- * {@link SettingValueNotSetException}. (There's no fallback to the {@link Configuration}-level settings to keep the
+ * {@link CoreSettingValueNotSetException}. (There's no fallback to the {@link Configuration}-level settings to keep the
* dependency graph of configuration related beans non-cyclic. As user code seldom reads settings directly from
* {@link TemplateConfiguration}-s anyway, this compromise was chosen.)
* <p>
@@ -177,7 +177,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public TagSyntax getTagSyntax() {
if (!isTagSyntaxSet()) {
- throw new SettingValueNotSetException("tagSyntax");
+ throw new CoreSettingValueNotSetException("tagSyntax");
}
return tagSyntax;
}
@@ -190,7 +190,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public TemplateLanguage getTemplateLanguage() {
if (!isTemplateLanguageSet()) {
- throw new SettingValueNotSetException("templateLanguage");
+ throw new CoreSettingValueNotSetException("templateLanguage");
}
return templateLanguage;
}
@@ -203,7 +203,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public NamingConvention getNamingConvention() {
if (!isNamingConventionSet()) {
- throw new SettingValueNotSetException("namingConvention");
+ throw new CoreSettingValueNotSetException("namingConvention");
}
return namingConvention;
}
@@ -216,7 +216,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public boolean getWhitespaceStripping() {
if (!isWhitespaceStrippingSet()) {
- throw new SettingValueNotSetException("whitespaceStripping");
+ throw new CoreSettingValueNotSetException("whitespaceStripping");
}
return whitespaceStripping;
}
@@ -229,7 +229,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public AutoEscapingPolicy getAutoEscapingPolicy() {
if (!isAutoEscapingPolicySet()) {
- throw new SettingValueNotSetException("autoEscapingPolicy");
+ throw new CoreSettingValueNotSetException("autoEscapingPolicy");
}
return autoEscapingPolicy;
}
@@ -242,7 +242,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public OutputFormat getOutputFormat() {
if (!isOutputFormatSet()) {
- throw new SettingValueNotSetException("outputFormat");
+ throw new CoreSettingValueNotSetException("outputFormat");
}
return outputFormat;
}
@@ -250,7 +250,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public ArithmeticEngine getArithmeticEngine() {
if (!isArithmeticEngineSet()) {
- throw new SettingValueNotSetException("arithmeticEngine");
+ throw new CoreSettingValueNotSetException("arithmeticEngine");
}
return arithmeticEngine;
}
@@ -268,7 +268,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public boolean getRecognizeStandardFileExtensions() {
if (!isRecognizeStandardFileExtensionsSet()) {
- throw new SettingValueNotSetException("recognizeStandardFileExtensions");
+ throw new CoreSettingValueNotSetException("recognizeStandardFileExtensions");
}
return recognizeStandardFileExtensions;
}
@@ -281,7 +281,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public Charset getSourceEncoding() {
if (!isSourceEncodingSet()) {
- throw new SettingValueNotSetException("sourceEncoding");
+ throw new CoreSettingValueNotSetException("sourceEncoding");
}
return sourceEncoding;
}
@@ -294,7 +294,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public int getTabSize() {
if (!isTabSizeSet()) {
- throw new SettingValueNotSetException("tabSize");
+ throw new CoreSettingValueNotSetException("tabSize");
}
return tabSize;
}
@@ -305,18 +305,18 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
}
/**
- * Always throws {@link SettingValueNotSetException}, as this can't be set on the {@link TemplateConfiguration}
+ * Always throws {@link CoreSettingValueNotSetException}, as this can't be set on the {@link TemplateConfiguration}
* level.
*/
@Override
public Version getIncompatibleImprovements() {
- throw new SettingValueNotSetException("incompatibleImprovements");
+ throw new CoreSettingValueNotSetException("incompatibleImprovements");
}
@Override
public Locale getLocale() {
if (!isLocaleSet()) {
- throw new SettingValueNotSetException("locale");
+ throw new CoreSettingValueNotSetException("locale");
}
return locale;
}
@@ -329,7 +329,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public TimeZone getTimeZone() {
if (!isTimeZoneSet()) {
- throw new SettingValueNotSetException("timeZone");
+ throw new CoreSettingValueNotSetException("timeZone");
}
return timeZone;
}
@@ -342,7 +342,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public TimeZone getSQLDateAndTimeTimeZone() {
if (!isSQLDateAndTimeTimeZoneSet()) {
- throw new SettingValueNotSetException("sqlDateAndTimeTimeZone");
+ throw new CoreSettingValueNotSetException("sqlDateAndTimeTimeZone");
}
return sqlDateAndTimeTimeZone;
}
@@ -355,7 +355,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public String getNumberFormat() {
if (!isNumberFormatSet()) {
- throw new SettingValueNotSetException("numberFormat");
+ throw new CoreSettingValueNotSetException("numberFormat");
}
return numberFormat;
}
@@ -368,7 +368,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public Map<String, TemplateNumberFormatFactory> getCustomNumberFormats() {
if (!isCustomNumberFormatsSet()) {
- throw new SettingValueNotSetException("customNumberFormats");
+ throw new CoreSettingValueNotSetException("customNumberFormats");
}
return customNumberFormats;
}
@@ -386,7 +386,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public String getBooleanFormat() {
if (!isBooleanFormatSet()) {
- throw new SettingValueNotSetException("booleanFormat");
+ throw new CoreSettingValueNotSetException("booleanFormat");
}
return booleanFormat;
}
@@ -399,7 +399,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public String getTimeFormat() {
if (!isTimeFormatSet()) {
- throw new SettingValueNotSetException("timeFormat");
+ throw new CoreSettingValueNotSetException("timeFormat");
}
return timeFormat;
}
@@ -412,7 +412,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public String getDateFormat() {
if (!isDateFormatSet()) {
- throw new SettingValueNotSetException("dateFormat");
+ throw new CoreSettingValueNotSetException("dateFormat");
}
return dateFormat;
}
@@ -425,7 +425,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public String getDateTimeFormat() {
if (!isDateTimeFormatSet()) {
- throw new SettingValueNotSetException("dateTimeFormat");
+ throw new CoreSettingValueNotSetException("dateTimeFormat");
}
return dateTimeFormat;
}
@@ -438,7 +438,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public Map<String, TemplateDateFormatFactory> getCustomDateFormats() {
if (!isCustomDateFormatsSet()) {
- throw new SettingValueNotSetException("customDateFormats");
+ throw new CoreSettingValueNotSetException("customDateFormats");
}
return customDateFormats;
}
@@ -462,7 +462,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public TemplateExceptionHandler getTemplateExceptionHandler() {
if (!isTemplateExceptionHandlerSet()) {
- throw new SettingValueNotSetException("templateExceptionHandler");
+ throw new CoreSettingValueNotSetException("templateExceptionHandler");
}
return templateExceptionHandler;
}
@@ -475,7 +475,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public ObjectWrapper getObjectWrapper() {
if (!isObjectWrapperSet()) {
- throw new SettingValueNotSetException("objectWrapper");
+ throw new CoreSettingValueNotSetException("objectWrapper");
}
return objectWrapper;
}
@@ -488,7 +488,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public Charset getOutputEncoding() {
if (!isOutputEncodingSet()) {
- throw new SettingValueNotSetException("");
+ throw new CoreSettingValueNotSetException("");
}
return outputEncoding;
}
@@ -501,7 +501,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public Charset getURLEscapingCharset() {
if (!isURLEscapingCharsetSet()) {
- throw new SettingValueNotSetException("urlEscapingCharset");
+ throw new CoreSettingValueNotSetException("urlEscapingCharset");
}
return urlEscapingCharset;
}
@@ -514,7 +514,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public TemplateClassResolver getNewBuiltinClassResolver() {
if (!isNewBuiltinClassResolverSet()) {
- throw new SettingValueNotSetException("newBuiltinClassResolver");
+ throw new CoreSettingValueNotSetException("newBuiltinClassResolver");
}
return newBuiltinClassResolver;
}
@@ -527,7 +527,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public boolean getAPIBuiltinEnabled() {
if (!isAPIBuiltinEnabledSet()) {
- throw new SettingValueNotSetException("apiBuiltinEnabled");
+ throw new CoreSettingValueNotSetException("apiBuiltinEnabled");
}
return apiBuiltinEnabled;
}
@@ -540,7 +540,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public boolean getAutoFlush() {
if (!isAutoFlushSet()) {
- throw new SettingValueNotSetException("autoFlush");
+ throw new CoreSettingValueNotSetException("autoFlush");
}
return autoFlush;
}
@@ -553,7 +553,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public boolean getShowErrorTips() {
if (!isShowErrorTipsSet()) {
- throw new SettingValueNotSetException("showErrorTips");
+ throw new CoreSettingValueNotSetException("showErrorTips");
}
return showErrorTips;
}
@@ -566,7 +566,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public boolean getLogTemplateExceptions() {
if (!isLogTemplateExceptionsSet()) {
- throw new SettingValueNotSetException("logTemplateExceptions");
+ throw new CoreSettingValueNotSetException("logTemplateExceptions");
}
return logTemplateExceptions;
}
@@ -579,7 +579,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public boolean getLazyImports() {
if (!isLazyImportsSet()) {
- throw new SettingValueNotSetException("lazyImports");
+ throw new CoreSettingValueNotSetException("lazyImports");
}
return lazyImports;
}
@@ -592,7 +592,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public Boolean getLazyAutoImports() {
if (!isLazyAutoImportsSet()) {
- throw new SettingValueNotSetException("lazyAutoImports");
+ throw new CoreSettingValueNotSetException("lazyAutoImports");
}
return lazyAutoImports;
}
@@ -605,7 +605,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public Map<String, String> getAutoImports() {
if (!isAutoImportsSet()) {
- throw new SettingValueNotSetException("");
+ throw new CoreSettingValueNotSetException("");
}
return autoImports;
}
@@ -618,7 +618,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public List<String> getAutoIncludes() {
if (!isAutoIncludesSet()) {
- throw new SettingValueNotSetException("autoIncludes");
+ throw new CoreSettingValueNotSetException("autoIncludes");
}
return autoIncludes;
}
@@ -647,7 +647,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
public Object getCustomSetting(Serializable key) {
Object result = getCustomSetting(key, MISSING_VALUE_MARKER);
if (result == MISSING_VALUE_MARKER) {
- throw new CustomSettingNotSetException(key);
+ throw new CustomSettingValueNotSetException(key);
}
return result;
}
@@ -675,27 +675,27 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
protected Locale getDefaultLocale() {
- throw new SettingValueNotSetException("locale");
+ throw new CoreSettingValueNotSetException("locale");
}
@Override
protected TimeZone getDefaultTimeZone() {
- throw new SettingValueNotSetException("timeZone");
+ throw new CoreSettingValueNotSetException("timeZone");
}
@Override
protected TimeZone getDefaultSQLDateAndTimeTimeZone() {
- throw new SettingValueNotSetException("SQLDateAndTimeTimeZone");
+ throw new CoreSettingValueNotSetException("SQLDateAndTimeTimeZone");
}
@Override
protected String getDefaultNumberFormat() {
- throw new SettingValueNotSetException("numberFormat");
+ throw new CoreSettingValueNotSetException("numberFormat");
}
@Override
protected Map<String, TemplateNumberFormatFactory> getDefaultCustomNumberFormats() {
- throw new SettingValueNotSetException("customNumberFormats");
+ throw new CoreSettingValueNotSetException("customNumberFormats");
}
@Override
@@ -705,102 +705,102 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
protected String getDefaultBooleanFormat() {
- throw new SettingValueNotSetException("booleanFormat");
+ throw new CoreSettingValueNotSetException("booleanFormat");
}
@Override
protected String getDefaultTimeFormat() {
- throw new SettingValueNotSetException("timeFormat");
+ throw new CoreSettingValueNotSetException("timeFormat");
}
@Override
protected String getDefaultDateFormat() {
- throw new SettingValueNotSetException("dateFormat");
+ throw new CoreSettingValueNotSetException("dateFormat");
}
@Override
protected String getDefaultDateTimeFormat() {
- throw new SettingValueNotSetException("dateTimeFormat");
+ throw new CoreSettingValueNotSetException("dateTimeFormat");
}
@Override
protected Map<String, TemplateDateFormatFactory> getDefaultCustomDateFormats() {
- throw new SettingValueNotSetException("customDateFormats");
+ throw new CoreSettingValueNotSetException("customDateFormats");
}
@Override
protected TemplateDateFormatFactory getDefaultCustomDateFormat(String name) {
- throw new SettingValueNotSetException("customDateFormat");
+ throw new CoreSettingValueNotSetException("customDateFormat");
}
@Override
protected TemplateExceptionHandler getDefaultTemplateExceptionHandler() {
- throw new SettingValueNotSetException("templateExceptionHandler");
+ throw new CoreSettingValueNotSetException("templateExceptionHandler");
}
@Override
protected ArithmeticEngine getDefaultArithmeticEngine() {
- throw new SettingValueNotSetException("arithmeticEngine");
+ throw new CoreSettingValueNotSetException("arithmeticEngine");
}
@Override
protected ObjectWrapper getDefaultObjectWrapper() {
- throw new SettingValueNotSetException("objectWrapper");
+ throw new CoreSettingValueNotSetException("objectWrapper");
}
@Override
protected Charset getDefaultOutputEncoding() {
- throw new SettingValueNotSetException("outputEncoding");
+ throw new CoreSettingValueNotSetException("outputEncoding");
}
@Override
protected Charset getDefaultURLEscapingCharset() {
- throw new SettingValueNotSetException("URLEscapingCharset");
+ throw new CoreSettingValueNotSetException("URLEscapingCharset");
}
@Override
protected TemplateClassResolver getDefaultNewBuiltinClassResolver() {
- throw new SettingValueNotSetException("newBuiltinClassResolver");
+ throw new CoreSettingValueNotSetException("newBuiltinClassResolver");
}
@Override
protected boolean getDefaultAutoFlush() {
- throw new SettingValueNotSetException("autoFlush");
+ throw new CoreSettingValueNotSetException("autoFlush");
}
@Override
protected boolean getDefaultShowErrorTips() {
- throw new SettingValueNotSetException("showErrorTips");
+ throw new CoreSettingValueNotSetException("showErrorTips");
}
@Override
protected boolean getDefaultAPIBuiltinEnabled() {
- throw new SettingValueNotSetException("APIBuiltinEnabled");
+ throw new CoreSettingValueNotSetException("APIBuiltinEnabled");
}
@Override
protected boolean getDefaultLogTemplateExceptions() {
- throw new SettingValueNotSetException("logTemplateExceptions");
+ throw new CoreSettingValueNotSetException("logTemplateExceptions");
}
@Override
protected boolean getDefaultLazyImports() {
- throw new SettingValueNotSetException("lazyImports");
+ throw new CoreSettingValueNotSetException("lazyImports");
}
@Override
protected Boolean getDefaultLazyAutoImports() {
- throw new SettingValueNotSetException("lazyAutoImports");
+ throw new CoreSettingValueNotSetException("lazyAutoImports");
}
@Override
protected Map<String, String> getDefaultAutoImports() {
- throw new SettingValueNotSetException("autoImports");
+ throw new CoreSettingValueNotSetException("autoImports");
}
@Override
protected List<String> getDefaultAutoIncludes() {
- throw new SettingValueNotSetException("autoIncludes");
+ throw new CoreSettingValueNotSetException("autoIncludes");
}
@Override
@@ -809,7 +809,7 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
if (useDefaultValue) {
return defaultValue;
}
- throw new CustomSettingNotSetException(key);
+ throw new CustomSettingValueNotSetException(key);
}
@Override
@@ -942,52 +942,52 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
@Override
public Version getIncompatibleImprovements() {
- throw new SettingValueNotSetException("incompatibleImprovements");
+ throw new CoreSettingValueNotSetException("incompatibleImprovements");
}
@Override
protected TagSyntax getDefaultTagSyntax() {
- throw new SettingValueNotSetException("tagSyntax");
+ throw new CoreSettingValueNotSetException("tagSyntax");
}
@Override
protected TemplateLanguage getDefaultTemplateLanguage() {
- throw new SettingValueNotSetException("templateLanguage");
+ throw new CoreSettingValueNotSetException("templateLanguage");
}
@Override
protected NamingConvention getDefaultNamingConvention() {
- throw new SettingValueNotSetException("namingConvention");
+ throw new CoreSettingValueNotSetException("namingConvention");
}
@Override
protected boolean getDefaultWhitespaceStripping() {
- throw new SettingValueNotSetException("whitespaceStripping");
+ throw new CoreSettingValueNotSetException("whitespaceStripping");
}
@Override
protected AutoEscapingPolicy getDefaultAutoEscapingPolicy() {
- throw new SettingValueNotSetException("autoEscapingPolicy");
+ throw new CoreSettingValueNotSetException("autoEscapingPolicy");
}
@Override
protected OutputFormat getDefaultOutputFormat() {
- throw new SettingValueNotSetException("outputFormat");
+ throw new CoreSettingValueNotSetException("outputFormat");
}
@Override
protected boolean getDefaultRecognizeStandardFileExtensions() {
- throw new SettingValueNotSetException("recognizeStandardFileExtensions");
+ throw new CoreSettingValueNotSetException("recognizeStandardFileExtensions");
}
@Override
protected Charset getDefaultSourceEncoding() {
- throw new SettingValueNotSetException("sourceEncoding");
+ throw new CoreSettingValueNotSetException("sourceEncoding");
}
@Override
protected int getDefaultTabSize() {
- throw new SettingValueNotSetException("tabSize");
+ throw new CoreSettingValueNotSetException("tabSize");
}
}