freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [6/7] incubator-freemarker git commit: `TemplateModelException` was removed, replaced with `TemplateException` on all places, except for `ObjectWrapper.wrap(Object)` and `wrapAsAPI(Object)`, which now throws `ObjectWrappingException` instead (that extend
Date Sat, 19 Aug 2017 23:36:40 GMT
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/HashAndScalarModel.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/HashAndScalarModel.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/HashAndScalarModel.java
index a5869a2..37f93a5 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/HashAndScalarModel.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/HashAndScalarModel.java
@@ -19,10 +19,10 @@
 
 package org.apache.freemarker.core.templatesuite.models;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 import org.apache.freemarker.core.model.TemplateHashModelEx;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateModelIterator;
 import org.apache.freemarker.core.model.TemplateScalarModel;
 import org.apache.freemarker.core.model.impl.SimpleScalar;
@@ -34,16 +34,16 @@ public class HashAndScalarModel implements TemplateHashModelEx, TemplateScalarMo
     private final TemplateCollectionModel EMPTY_COLLECTION = new TemplateCollectionModel() {
 
         @Override
-        public TemplateModelIterator iterator() throws TemplateModelException {
+        public TemplateModelIterator iterator() throws TemplateException {
             return new TemplateModelIterator() {
 
                 @Override
-                public TemplateModel next() throws TemplateModelException {
+                public TemplateModel next() throws TemplateException {
                     return null;
                 }
 
                 @Override
-                public boolean hasNext() throws TemplateModelException {
+                public boolean hasNext() throws TemplateException {
                     return false;
                 }
                 
@@ -52,32 +52,32 @@ public class HashAndScalarModel implements TemplateHashModelEx, TemplateScalarMo
     };
 
     @Override
-    public String getAsString() throws TemplateModelException {
+    public String getAsString() throws TemplateException {
         return "scalarValue";
     }
 
     @Override
-    public TemplateModel get(String key) throws TemplateModelException {
+    public TemplateModel get(String key) throws TemplateException {
         return new SimpleScalar("mapValue for " + key);
     }
 
     @Override
-    public boolean isEmpty() throws TemplateModelException {
+    public boolean isEmpty() throws TemplateException {
         return true;
     }
 
     @Override
-    public int size() throws TemplateModelException {
+    public int size() throws TemplateException {
         return 0;
     }
 
     @Override
-    public TemplateCollectionModel keys() throws TemplateModelException {
+    public TemplateCollectionModel keys() throws TemplateException {
         return EMPTY_COLLECTION;
     }
 
     @Override
-    public TemplateCollectionModel values() throws TemplateModelException {
+    public TemplateCollectionModel values() throws TemplateException {
         return EMPTY_COLLECTION;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/Listables.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/Listables.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/Listables.java
index 55d06d5..700af44 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/Listables.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/Listables.java
@@ -29,12 +29,13 @@ import java.util.Set;
 import java.util.TreeSet;
 
 import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.ObjectWrapper;
+import org.apache.freemarker.core.model.ObjectWrappingException;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 import org.apache.freemarker.core.model.TemplateHashModelEx;
 import org.apache.freemarker.core.model.TemplateHashModelEx2;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.WrappingTemplateModel;
 import org.apache.freemarker.core.model.impl.DefaultMapAdapter;
 import org.apache.freemarker.core.model.impl.DefaultObjectWrapper;
@@ -107,7 +108,7 @@ public class Listables {
         return Collections.<Integer>emptySet().iterator();
     }
     
-    public List<TemplateHashModelEx2> getHashEx2s() throws TemplateModelException {
+    public List<TemplateHashModelEx2> getHashEx2s() throws TemplateException {
         Map<Object, Object> map;
         map = new LinkedHashMap<>();
         map.put("k1", "v1");
@@ -120,7 +121,7 @@ public class Listables {
         return getMapsWrappedAsEx2(map);
     }
 
-    public List<? extends TemplateHashModelEx> getEmptyHashes() throws TemplateModelException {
+    public List<? extends TemplateHashModelEx> getEmptyHashes() throws ObjectWrappingException {
         List<TemplateHashModelEx> emptyMaps = new ArrayList<>();
         emptyMaps.addAll(getMapsWrappedAsEx2(Collections.emptyMap()));
         emptyMaps.add((TemplateHashModelEx) new DefaultObjectWrapper.Builder(Configuration.VERSION_3_0_0).build()
@@ -131,7 +132,7 @@ public class Listables {
     /**
      * Returns the map wrapped on various ways.
      */
-    private List<TemplateHashModelEx2> getMapsWrappedAsEx2(Map<?, ?> map) throws TemplateModelException {
+    private List<TemplateHashModelEx2> getMapsWrappedAsEx2(Map<?, ?> map) throws ObjectWrappingException {
         List<TemplateHashModelEx2> maps = new ArrayList<>();
         
         DefaultObjectWrapper ow = new DefaultObjectWrapper.Builder(Configuration.VERSION_3_0_0).build();
@@ -156,7 +157,7 @@ public class Listables {
         }
         
         @Override
-        public TemplateModel get(String key) throws TemplateModelException {
+        public TemplateModel get(String key) throws TemplateException {
             return wrap(map.get(key));
         }
         

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel1.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel1.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel1.java
index ce04928..4a0ac53 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel1.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel1.java
@@ -20,10 +20,10 @@
 package org.apache.freemarker.core.templatesuite.models;
 
 import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateScalarModel;
 import org.apache.freemarker.core.model.TemplateSequenceModel;
 import org.apache.freemarker.core.model.impl.DefaultObjectWrapper;
@@ -95,7 +95,7 @@ public class MultiModel1 implements TemplateHashModel,
      * @return the specified index in the list
      */
     @Override
-    public TemplateModel get(int i) throws TemplateModelException {
+    public TemplateModel get(int i) throws TemplateException {
         return m_cListModel.get( i );
     }
 
@@ -110,7 +110,7 @@ public class MultiModel1 implements TemplateHashModel,
     }
 
     @Override
-    public int size() throws TemplateModelException {
+    public int size() throws TemplateException {
         return m_cListModel.size();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel4.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel4.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel4.java
index a5fb8e5..30118d0 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel4.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel4.java
@@ -19,10 +19,10 @@
 
 package org.apache.freemarker.core.templatesuite.models;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateSequenceModel;
 import org.apache.freemarker.core.model.impl.SimpleScalar;
 import org.apache.freemarker.core.model.impl.SimpleSequence;
@@ -42,7 +42,7 @@ public class MultiModel4 implements TemplateSequenceModel, TemplateHashModel {
      * @return the specified index in the list
      */
     @Override
-    public TemplateModel get(int i) throws TemplateModelException {
+    public TemplateModel get(int i) throws TemplateException {
         return m_cList.get( i );
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel5.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel5.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel5.java
index f08fb8c..e7f0a94 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel5.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel5.java
@@ -19,10 +19,10 @@
 
 package org.apache.freemarker.core.templatesuite.models;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateSequenceModel;
 import org.apache.freemarker.core.model.impl.SimpleScalar;
 import org.apache.freemarker.core.model.impl.SimpleSequence;
@@ -44,7 +44,7 @@ public class MultiModel5 implements TemplateSequenceModel, TemplateHashModel {
      * @return the specified index in the list
      */
     @Override
-    public TemplateModel get(int i) throws TemplateModelException {
+    public TemplateModel get(int i) throws TemplateException {
         return m_cList.get( i );
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/NumberAndStringModel.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/NumberAndStringModel.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/NumberAndStringModel.java
index cc4eec1..aae9abd 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/NumberAndStringModel.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/NumberAndStringModel.java
@@ -19,7 +19,6 @@
 
 package org.apache.freemarker.core.templatesuite.models;
 
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateNumberModel;
 import org.apache.freemarker.core.model.TemplateScalarModel;
 
@@ -34,13 +33,13 @@ public class NumberAndStringModel implements TemplateNumberModel,
 	}
 
 	@Override
-    public String getAsString() throws TemplateModelException {
+    public String getAsString() {
 		return s;
 	}
 
 	@Override
     @SuppressWarnings("boxing")
-    public Number getAsNumber() throws TemplateModelException {
+    public Number getAsNumber() {
 		return s.length();
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/OverloadedConstructor.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/OverloadedConstructor.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/OverloadedConstructor.java
index f8da268..c442cfb 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/OverloadedConstructor.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/OverloadedConstructor.java
@@ -19,7 +19,6 @@
 
 package org.apache.freemarker.core.templatesuite.models;
 
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateScalarModel;
 
 public class OverloadedConstructor implements TemplateScalarModel {
@@ -39,7 +38,7 @@ public class OverloadedConstructor implements TemplateScalarModel {
     }
     
     @Override
-    public String getAsString() throws TemplateModelException {
+    public String getAsString() {
         return value;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/OverloadedMethods2.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/OverloadedMethods2.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/OverloadedMethods2.java
index 495a72e..4e12135 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/OverloadedMethods2.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/OverloadedMethods2.java
@@ -30,11 +30,12 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.freemarker.core.Environment;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.AdapterTemplateModel;
 import org.apache.freemarker.core.model.ObjectWrapper;
+import org.apache.freemarker.core.model.ObjectWrappingException;
 import org.apache.freemarker.core.model.TemplateBooleanModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateNumberModel;
 import org.apache.freemarker.core.model.WrapperTemplateModel;
 import org.apache.freemarker.core.model.impl.RationalNumber;
@@ -873,7 +874,7 @@ public class OverloadedMethods2 {
         return listList;
     }
 
-    public List getJavaStringSequenceList() throws TemplateModelException {
+    public List getJavaStringSequenceList() throws ObjectWrappingException {
         ObjectWrapper ow = Environment.getCurrentEnvironment().getObjectWrapper();
         
         List listList = new ArrayList();
@@ -1027,7 +1028,7 @@ public class OverloadedMethods2 {
         }
 
         @Override
-        public Number getAsNumber() throws TemplateModelException {
+        public Number getAsNumber() throws TemplateException {
             return Integer.valueOf(122);
         }
         
@@ -1036,7 +1037,7 @@ public class OverloadedMethods2 {
     private static class MyWrapperNumberModel implements TemplateNumberModel, WrapperTemplateModel {
 
         @Override
-        public Number getAsNumber() throws TemplateModelException {
+        public Number getAsNumber() throws TemplateException {
             return Integer.valueOf(122);
         }
 
@@ -1055,7 +1056,7 @@ public class OverloadedMethods2 {
         }
 
         @Override
-        public boolean getAsBoolean() throws TemplateModelException {
+        public boolean getAsBoolean() throws TemplateException {
             return true;
         }
         
@@ -1069,7 +1070,7 @@ public class OverloadedMethods2 {
         }
 
         @Override
-        public boolean getAsBoolean() throws TemplateModelException {
+        public boolean getAsBoolean() throws TemplateException {
             return false;
         }
         
@@ -1087,7 +1088,7 @@ public class OverloadedMethods2 {
         }
 
         @Override
-        public boolean getAsBoolean() throws TemplateModelException {
+        public boolean getAsBoolean() throws TemplateException {
             return false;
         }
         
@@ -1101,7 +1102,7 @@ public class OverloadedMethods2 {
         }
 
         @Override
-        public boolean getAsBoolean() throws TemplateModelException {
+        public boolean getAsBoolean() throws TemplateException {
             return true;
         }
         

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleMapAndCollectionObjectWrapper.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleMapAndCollectionObjectWrapper.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleMapAndCollectionObjectWrapper.java
index 7992b1e..8c8dd76 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleMapAndCollectionObjectWrapper.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleMapAndCollectionObjectWrapper.java
@@ -23,8 +23,8 @@ import java.util.Collection;
 import java.util.Map;
 
 import org.apache.freemarker.core.Version;
+import org.apache.freemarker.core.model.ObjectWrappingException;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.impl.DefaultObjectWrapper;
 import org.apache.freemarker.core.model.impl.SimpleHash;
 import org.apache.freemarker.core.model.impl.SimpleSequence;
@@ -40,7 +40,7 @@ public class SimpleMapAndCollectionObjectWrapper extends DefaultObjectWrapper {
     }
 
     @Override
-    public TemplateModel wrap(Object obj) throws TemplateModelException {
+    public TemplateModel wrap(Object obj) throws ObjectWrappingException {
         if (obj == null) {
             return super.wrap(null);
         }        

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AppMetaTemplateDateFormatFactory.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AppMetaTemplateDateFormatFactory.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AppMetaTemplateDateFormatFactory.java
index 1d69dd8..02fb904 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AppMetaTemplateDateFormatFactory.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AppMetaTemplateDateFormatFactory.java
@@ -23,8 +23,8 @@ import java.util.Locale;
 import java.util.TimeZone;
 
 import org.apache.freemarker.core.Environment;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateDateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.valueformat.InvalidFormatParametersException;
 import org.apache.freemarker.core.valueformat.TemplateDateFormat;
 import org.apache.freemarker.core.valueformat.TemplateDateFormatFactory;
@@ -56,7 +56,7 @@ public class AppMetaTemplateDateFormatFactory extends TemplateDateFormatFactory
         
         @Override
         public String formatToPlainText(TemplateDateModel dateModel)
-                throws UnformattableValueException, TemplateModelException {
+                throws UnformattableValueException, TemplateException {
             String result = String.valueOf(TemplateFormatUtil.getNonNullDate(dateModel).getTime());
             if (dateModel instanceof AppMetaTemplateDateModel) {
                 result += "/" + ((AppMetaTemplateDateModel) dateModel).getAppMeta(); 
@@ -111,7 +111,7 @@ public class AppMetaTemplateDateFormatFactory extends TemplateDateFormatFactory
         }
 
         @Override
-        public Date getAsDate() throws TemplateModelException {
+        public Date getAsDate() throws TemplateException {
             return date;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/BaseNTemplateNumberFormatFactory.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/BaseNTemplateNumberFormatFactory.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/BaseNTemplateNumberFormatFactory.java
index aa5d4db..e1a8a78 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/BaseNTemplateNumberFormatFactory.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/BaseNTemplateNumberFormatFactory.java
@@ -21,7 +21,7 @@ package org.apache.freemarker.core.userpkg;
 import java.util.Locale;
 
 import org.apache.freemarker.core.Environment;
-import org.apache.freemarker.core.model.TemplateModelException;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateNumberModel;
 import org.apache.freemarker.core.util._NumberUtils;
 import org.apache.freemarker.core.util._StringUtils;
@@ -98,7 +98,7 @@ public class BaseNTemplateNumberFormatFactory extends TemplateNumberFormatFactor
         
         @Override
         public String formatToPlainText(TemplateNumberModel numberModel)
-                throws TemplateModelException, TemplateValueFormatException {
+                throws TemplateException, TemplateValueFormatException {
             Number n = TemplateFormatUtil.getNonNullNumber(numberModel);
             try {
                 return Integer.toString(_NumberUtils.toIntExact(n), base);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/CustomHTMLOutputFormat.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/CustomHTMLOutputFormat.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/CustomHTMLOutputFormat.java
index a8576bd..a2396f6 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/CustomHTMLOutputFormat.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/CustomHTMLOutputFormat.java
@@ -21,7 +21,6 @@ package org.apache.freemarker.core.userpkg;
 import java.io.IOException;
 import java.io.Writer;
 
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.outputformat.CommonMarkupOutputFormat;
 import org.apache.freemarker.core.util._StringUtils;
 
@@ -47,7 +46,7 @@ public final class CustomHTMLOutputFormat extends CommonMarkupOutputFormat<Custo
     }
 
     @Override
-    public void output(String textToEsc, Writer out) throws IOException, TemplateModelException {
+    public void output(String textToEsc, Writer out) throws IOException {
         // This is lazy - don't do it in reality.
         out.write(escapePlainText(textToEsc));
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/DummyOutputFormat.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/DummyOutputFormat.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/DummyOutputFormat.java
index f368969..edafa0e 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/DummyOutputFormat.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/DummyOutputFormat.java
@@ -21,7 +21,6 @@ package org.apache.freemarker.core.userpkg;
 import java.io.IOException;
 import java.io.Writer;
 
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.outputformat.CommonMarkupOutputFormat;
 
 public class DummyOutputFormat extends CommonMarkupOutputFormat<TemplateDummyOutputModel> {
@@ -43,7 +42,7 @@ public class DummyOutputFormat extends CommonMarkupOutputFormat<TemplateDummyOut
     }
 
     @Override
-    public void output(String textToEsc, Writer out) throws IOException, TemplateModelException {
+    public void output(String textToEsc, Writer out) throws IOException {
         out.write(escapePlainText(textToEsc));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/EpochMillisDivTemplateDateFormatFactory.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/EpochMillisDivTemplateDateFormatFactory.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/EpochMillisDivTemplateDateFormatFactory.java
index be06442..9a84d1f 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/EpochMillisDivTemplateDateFormatFactory.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/EpochMillisDivTemplateDateFormatFactory.java
@@ -23,8 +23,8 @@ import java.util.Locale;
 import java.util.TimeZone;
 
 import org.apache.freemarker.core.Environment;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateDateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.util._StringUtils;
 import org.apache.freemarker.core.valueformat.InvalidFormatParametersException;
 import org.apache.freemarker.core.valueformat.TemplateDateFormat;
@@ -69,7 +69,7 @@ public class EpochMillisDivTemplateDateFormatFactory extends TemplateDateFormatF
         
         @Override
         public String formatToPlainText(TemplateDateModel dateModel)
-                throws UnformattableValueException, TemplateModelException {
+                throws UnformattableValueException, TemplateException {
             return String.valueOf(TemplateFormatUtil.getNonNullDate(dateModel).getTime() / divisor);
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/EpochMillisTemplateDateFormatFactory.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/EpochMillisTemplateDateFormatFactory.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/EpochMillisTemplateDateFormatFactory.java
index 9f27095..c2fefef 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/EpochMillisTemplateDateFormatFactory.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/EpochMillisTemplateDateFormatFactory.java
@@ -23,8 +23,8 @@ import java.util.Locale;
 import java.util.TimeZone;
 
 import org.apache.freemarker.core.Environment;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateDateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.valueformat.InvalidFormatParametersException;
 import org.apache.freemarker.core.valueformat.TemplateDateFormat;
 import org.apache.freemarker.core.valueformat.TemplateDateFormatFactory;
@@ -59,7 +59,7 @@ public class EpochMillisTemplateDateFormatFactory extends TemplateDateFormatFact
         
         @Override
         public String formatToPlainText(TemplateDateModel dateModel)
-                throws UnformattableValueException, TemplateModelException {
+                throws UnformattableValueException, TemplateException {
             return String.valueOf(TemplateFormatUtil.getNonNullDate(dateModel).getTime());
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/HTMLISOTemplateDateFormatFactory.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/HTMLISOTemplateDateFormatFactory.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/HTMLISOTemplateDateFormatFactory.java
index 83e349f..7431526 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/HTMLISOTemplateDateFormatFactory.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/HTMLISOTemplateDateFormatFactory.java
@@ -23,8 +23,8 @@ import java.util.Locale;
 import java.util.TimeZone;
 
 import org.apache.freemarker.core.Environment;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateDateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.outputformat.impl.HTMLOutputFormat;
 import org.apache.freemarker.core.util._DateUtils;
 import org.apache.freemarker.core.util._DateUtils.CalendarFieldsToDateConverter;
@@ -65,7 +65,7 @@ public class HTMLISOTemplateDateFormatFactory extends TemplateDateFormatFactory
         
         @Override
         public String formatToPlainText(TemplateDateModel dateModel)
-                throws UnformattableValueException, TemplateModelException {
+                throws UnformattableValueException, TemplateException {
             if (calendarFactory == null) {
                 calendarFactory = new _DateUtils.TrivialDateToISO8601CalendarFactory();
             }
@@ -98,7 +98,7 @@ public class HTMLISOTemplateDateFormatFactory extends TemplateDateFormatFactory
         }
 
         @Override
-        public Object format(TemplateDateModel dateModel) throws TemplateValueFormatException, TemplateModelException {
+        public Object format(TemplateDateModel dateModel) throws TemplateValueFormatException, TemplateException {
             return HTMLOutputFormat.INSTANCE.fromMarkup(
                     formatToPlainText(dateModel).replace("T", "<span class='T'>T</span>"));
         }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/HexTemplateNumberFormatFactory.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/HexTemplateNumberFormatFactory.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/HexTemplateNumberFormatFactory.java
index c1f34b4..6627b18 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/HexTemplateNumberFormatFactory.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/HexTemplateNumberFormatFactory.java
@@ -21,7 +21,7 @@ package org.apache.freemarker.core.userpkg;
 import java.util.Locale;
 
 import org.apache.freemarker.core.Environment;
-import org.apache.freemarker.core.model.TemplateModelException;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateNumberModel;
 import org.apache.freemarker.core.util._NumberUtils;
 import org.apache.freemarker.core.valueformat.InvalidFormatParametersException;
@@ -53,7 +53,7 @@ public class HexTemplateNumberFormatFactory extends TemplateNumberFormatFactory
         
         @Override
         public String formatToPlainText(TemplateNumberModel numberModel)
-                throws UnformattableValueException, TemplateModelException {
+                throws UnformattableValueException, TemplateException {
             Number n = TemplateFormatUtil.getNonNullNumber(numberModel);
             try {
                 return Integer.toHexString(_NumberUtils.toIntExact(n));

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/LocAndTZSensitiveTemplateDateFormatFactory.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/LocAndTZSensitiveTemplateDateFormatFactory.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/LocAndTZSensitiveTemplateDateFormatFactory.java
index 42b0401..378c3b0 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/LocAndTZSensitiveTemplateDateFormatFactory.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/LocAndTZSensitiveTemplateDateFormatFactory.java
@@ -23,8 +23,8 @@ import java.util.Locale;
 import java.util.TimeZone;
 
 import org.apache.freemarker.core.Environment;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateDateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.valueformat.InvalidFormatParametersException;
 import org.apache.freemarker.core.valueformat.TemplateDateFormat;
 import org.apache.freemarker.core.valueformat.TemplateDateFormatFactory;
@@ -60,8 +60,9 @@ public class LocAndTZSensitiveTemplateDateFormatFactory extends TemplateDateForm
 
         @Override
         public String formatToPlainText(TemplateDateModel dateModel)
-                throws UnformattableValueException, TemplateModelException {
-            return String.valueOf(TemplateFormatUtil.getNonNullDate(dateModel).getTime() + "@" + locale + ":" + timeZone.getID());
+                throws UnformattableValueException, TemplateException {
+            return String.valueOf(
+                    TemplateFormatUtil.getNonNullDate(dateModel).getTime() + "@" + locale + ":" + timeZone.getID());
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/LocaleSensitiveTemplateNumberFormatFactory.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/LocaleSensitiveTemplateNumberFormatFactory.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/LocaleSensitiveTemplateNumberFormatFactory.java
index dc3dae0..f8ee607 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/LocaleSensitiveTemplateNumberFormatFactory.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/LocaleSensitiveTemplateNumberFormatFactory.java
@@ -21,7 +21,7 @@ package org.apache.freemarker.core.userpkg;
 import java.util.Locale;
 
 import org.apache.freemarker.core.Environment;
-import org.apache.freemarker.core.model.TemplateModelException;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateNumberModel;
 import org.apache.freemarker.core.valueformat.InvalidFormatParametersException;
 import org.apache.freemarker.core.valueformat.TemplateFormatUtil;
@@ -54,7 +54,7 @@ public class LocaleSensitiveTemplateNumberFormatFactory extends TemplateNumberFo
         
         @Override
         public String formatToPlainText(TemplateNumberModel numberModel)
-                throws UnformattableValueException, TemplateModelException {
+                throws UnformattableValueException, TemplateException {
             Number n = numberModel.getAsNumber();
             try {
                 return n + "_" + locale;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/NameClashingDummyOutputFormat.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/NameClashingDummyOutputFormat.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/NameClashingDummyOutputFormat.java
index dd26156..33d466e 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/NameClashingDummyOutputFormat.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/NameClashingDummyOutputFormat.java
@@ -21,7 +21,7 @@ package org.apache.freemarker.core.userpkg;
 import java.io.IOException;
 import java.io.Writer;
 
-import org.apache.freemarker.core.model.TemplateModelException;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.outputformat.CommonMarkupOutputFormat;
 
 public class NameClashingDummyOutputFormat extends CommonMarkupOutputFormat<TemplateDummyOutputModel> {
@@ -43,7 +43,7 @@ public class NameClashingDummyOutputFormat extends CommonMarkupOutputFormat<Temp
     }
 
     @Override
-    public void output(String textToEsc, Writer out) throws IOException, TemplateModelException {
+    public void output(String textToEsc, Writer out) throws IOException, TemplateException {
         out.write(escapePlainText(textToEsc));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PrintfGTemplateNumberFormatFactory.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PrintfGTemplateNumberFormatFactory.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PrintfGTemplateNumberFormatFactory.java
index 7be09f7..c0fe6be 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PrintfGTemplateNumberFormatFactory.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PrintfGTemplateNumberFormatFactory.java
@@ -23,7 +23,7 @@ import java.math.BigInteger;
 import java.util.Locale;
 
 import org.apache.freemarker.core.Environment;
-import org.apache.freemarker.core.model.TemplateModelException;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateNumberModel;
 import org.apache.freemarker.core.outputformat.impl.HTMLOutputFormat;
 import org.apache.freemarker.core.util._StringUtils;
@@ -76,7 +76,7 @@ public class PrintfGTemplateNumberFormatFactory extends TemplateNumberFormatFact
         
         @Override
         public String formatToPlainText(TemplateNumberModel numberModel)
-                throws UnformattableValueException, TemplateModelException {
+                throws UnformattableValueException, TemplateException {
             final Number n = TemplateFormatUtil.getNonNullNumber(numberModel);
             
             // printf %G only accepts Double, BigDecimal and Float 
@@ -98,7 +98,7 @@ public class PrintfGTemplateNumberFormatFactory extends TemplateNumberFormatFact
 
         @Override
         public Object format(TemplateNumberModel numberModel)
-                throws UnformattableValueException, TemplateModelException {
+                throws UnformattableValueException, TemplateException {
             String strResult = formatToPlainText(numberModel);
             
             int expIdx = strResult.indexOf('E');

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/SeldomEscapedOutputFormat.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/SeldomEscapedOutputFormat.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/SeldomEscapedOutputFormat.java
index b8cab13..ccb63e4 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/SeldomEscapedOutputFormat.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/SeldomEscapedOutputFormat.java
@@ -21,7 +21,6 @@ package org.apache.freemarker.core.userpkg;
 import java.io.IOException;
 import java.io.Writer;
 
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.outputformat.CommonMarkupOutputFormat;
 
 public class SeldomEscapedOutputFormat extends CommonMarkupOutputFormat<TemplateSeldomEscapedOutputModel> {
@@ -43,7 +42,7 @@ public class SeldomEscapedOutputFormat extends CommonMarkupOutputFormat<Template
     }
 
     @Override
-    public void output(String textToEsc, Writer out) throws IOException, TemplateModelException {
+    public void output(String textToEsc, Writer out) throws IOException {
         out.write(escapePlainText(textToEsc));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TestTemplateCallableModel.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TestTemplateCallableModel.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TestTemplateCallableModel.java
index 6b36cf8..b6bf7e5 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TestTemplateCallableModel.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TestTemplateCallableModel.java
@@ -22,9 +22,9 @@ package org.apache.freemarker.core.userpkg;
 import java.io.IOException;
 import java.io.Writer;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateCallableModel;
 import org.apache.freemarker.core.model.TemplateHashModelEx2;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateNumberModel;
 import org.apache.freemarker.core.model.TemplateScalarModel;
 import org.apache.freemarker.core.model.TemplateSequenceModel;
@@ -33,12 +33,12 @@ import org.apache.freemarker.core.util._StringUtils;
 
 public abstract class TestTemplateCallableModel implements TemplateCallableModel {
 
-    protected void printParam(String name, Object value, StringBuilder sb) throws TemplateModelException {
+    protected void printParam(String name, Object value, StringBuilder sb) throws TemplateException {
         printParam(name, value, sb, false);
     }
 
     protected void printParam(String name, Object value, StringBuilder sb, boolean first)
-            throws TemplateModelException {
+            throws TemplateException {
         if (!first) {
             sb.append(", ");
         }
@@ -47,18 +47,18 @@ public abstract class TestTemplateCallableModel implements TemplateCallableModel
         printValue(value, sb);
     }
 
-    protected void printParam(String name, Object value, Writer out) throws IOException, TemplateModelException {
+    protected void printParam(String name, Object value, Writer out) throws IOException, TemplateException {
         printParam(name, value, out, false);
     }
 
     protected void printParam(String name, Object value, Writer out, boolean first)
-            throws IOException, TemplateModelException {
+            throws IOException, TemplateException {
         StringBuilder sb = new StringBuilder();
         printParam(name, value, sb, first);
         out.write(sb.toString());
     }
 
-    private void printValue(Object value, StringBuilder sb) throws TemplateModelException {
+    private void printValue(Object value, StringBuilder sb) throws TemplateException {
         if (value == null) {
             sb.append("null");
         } else if (value instanceof TemplateNumberModel) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/java/org/apache/freemarker/core/valueformat/NumberFormatTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/valueformat/NumberFormatTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/valueformat/NumberFormatTest.java
index 685ce5a..3868493 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/valueformat/NumberFormatTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/valueformat/NumberFormatTest.java
@@ -29,16 +29,15 @@ import java.util.Collections;
 import java.util.Locale;
 import java.util.Map;
 
+import org.apache.freemarker.core.CallPlace;
 import org.apache.freemarker.core.Configuration;
 import org.apache.freemarker.core.Environment;
 import org.apache.freemarker.core.Template;
 import org.apache.freemarker.core.TemplateConfiguration;
 import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.ArgumentArrayLayout;
-import org.apache.freemarker.core.CallPlace;
 import org.apache.freemarker.core.model.TemplateDirectiveModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateNumberModel;
 import org.apache.freemarker.core.model.impl.SimpleNumber;
 import org.apache.freemarker.core.templateresolver.ConditionalTemplateConfigurationFactory;
@@ -367,7 +366,7 @@ public class NumberFormatTest extends TemplateTest {
         }
 
         @Override
-        public Number getAsNumber() throws TemplateModelException {
+        public Number getAsNumber() throws TemplateException {
             return number;
         }
         

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/exception.txt
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/exception.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/exception.txt
index 0ea4395..e9a834f 100644
--- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/exception.txt
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/exception.txt
@@ -25,7 +25,7 @@
 <p>A simple test follows:</p>
 
 <p>Hello, world! <br />
-freemarker.template.TemplateModelException: Throwing from ExceptionModel!
+freemarker.template.TemplateException: Throwing from ExceptionModel!
 	at freemarker.test.templatesuite.models.ExceptionModel.getAsString(ExceptionModel.java:57)
 	at freemarker.template.compiler.Expression.getStringValue(Expression.java:65)
 	at freemarker.template.compiler.DollarVariable.process(DollarVariable.java:62)

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/exception2.txt
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/exception2.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/exception2.txt
index bf441d3..664ce56 100644
--- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/exception2.txt
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/exception2.txt
@@ -25,7 +25,7 @@
 <p>A simple test follows:</p>
 
 <p>Hello, world! <br />
-<!-- Template Error: Couldn't get value of variable test: Couldn't read string value of test: freemarker.template.TemplateModelException: Throwing from ExceptionModel!
+<!-- Template Error: Couldn't get value of variable test: Couldn't read string value of test: freemarker.template.TemplateException: Throwing from ExceptionModel!
 	at freemarker.test.templatesuite.models.ExceptionModel.getAsString(ExceptionModel.java:42)
 	at freemarker.template.expression.Variable.getValue(Variable.java:69)
 	at freemarker.template.instruction.VariableInstruction.process(VariableInstruction.java:55)

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirCapturingAssignment.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirCapturingAssignment.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirCapturingAssignment.java
index 77fc8fa..d99a71d 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirCapturingAssignment.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirCapturingAssignment.java
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.io.StringWriter;
 
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.impl.SimpleScalar;
 import org.apache.freemarker.core.outputformat.MarkupOutputFormat;
 import org.apache.freemarker.core.util.BugException;
@@ -75,7 +74,7 @@ final class ASTDirCapturingAssignment extends ASTDirective {
         return null;
     }
 
-    private TemplateModel capturedStringToModel(String s) throws TemplateModelException {
+    private TemplateModel capturedStringToModel(String s) throws TemplateException {
         return markupOutputFormat == null ? new SimpleScalar(s) : markupOutputFormat.fromMarkup(s);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirMacroOrFunction.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirMacroOrFunction.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirMacroOrFunction.java
index 344f86f..645aff4 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirMacroOrFunction.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirMacroOrFunction.java
@@ -25,7 +25,6 @@ import java.util.List;
 
 import org.apache.freemarker.core.model.ArgumentArrayLayout;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateModelIterator;
 import org.apache.freemarker.core.util.StringToIndexMap;
 import org.apache.freemarker.core.util._StringUtils;
@@ -272,7 +271,7 @@ final class ASTDirMacroOrFunction extends ASTDirective implements TemplateModel
          * or null if it doesn't exist.
          */ 
         @Override
-        public TemplateModel getLocalVariable(String name) throws TemplateModelException {
+        public TemplateModel getLocalVariable(String name) throws TemplateException {
              return localVars.get(name);
         }
 
@@ -288,7 +287,7 @@ final class ASTDirMacroOrFunction extends ASTDirective implements TemplateModel
         }
 
         @Override
-        public Collection<String> getLocalVariableNames() throws TemplateModelException {
+        public Collection<String> getLocalVariableNames() throws TemplateException {
             HashSet<String> result = new HashSet<>();
             for (TemplateModelIterator it = localVars.keys().iterator(); it.hasNext(); ) {
                 result.add(it.next().toString());

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDollarInterpolation.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDollarInterpolation.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDollarInterpolation.java
index 46a46d2..80d7f6a 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDollarInterpolation.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDollarInterpolation.java
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.io.Writer;
 
 import org.apache.freemarker.core.model.TemplateMarkupOutputModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.outputformat.MarkupOutputFormat;
 import org.apache.freemarker.core.outputformat.OutputFormat;
 import org.apache.freemarker.core.util.TemplateLanguageUtils;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpAddOrConcat.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpAddOrConcat.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpAddOrConcat.java
index 79081e8..6667dd3 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpAddOrConcat.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpAddOrConcat.java
@@ -28,7 +28,6 @@ import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateHashModelEx;
 import org.apache.freemarker.core.model.TemplateMarkupOutputModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateModelIterator;
 import org.apache.freemarker.core.model.TemplateNumberModel;
 import org.apache.freemarker.core.model.TemplateScalarModel;
@@ -119,7 +118,7 @@ final class ASTExpAddOrConcat extends ASTExpression {
     }
 
     private static TemplateModel _eval_concatenateHashes(TemplateModel leftModel, TemplateModel rightModel)
-            throws TemplateModelException {
+            throws TemplateException {
         if (leftModel instanceof TemplateHashModelEx && rightModel instanceof TemplateHashModelEx) {
             TemplateHashModelEx leftModelEx = (TemplateHashModelEx) leftModel;
             TemplateHashModelEx rightModelEx = (TemplateHashModelEx) rightModel;
@@ -193,13 +192,13 @@ final class ASTExpAddOrConcat extends ASTExpression {
 
         @Override
         public int size()
-        throws TemplateModelException {
+        throws TemplateException {
             return left.size() + right.size();
         }
 
         @Override
         public TemplateModel get(int i)
-        throws TemplateModelException {
+        throws TemplateException {
             int ls = left.size();
             return i < ls ? left.get(i) : right.get(i - ls);
         }
@@ -217,14 +216,14 @@ final class ASTExpAddOrConcat extends ASTExpression {
         
         @Override
         public TemplateModel get(String key)
-        throws TemplateModelException {
+        throws TemplateException {
             TemplateModel model = right.get(key);
             return (model != null) ? model : left.get(key);
         }
 
         @Override
         public boolean isEmpty()
-        throws TemplateModelException {
+        throws TemplateException {
             return left.isEmpty() && right.isEmpty();
         }
     }
@@ -241,27 +240,27 @@ final class ASTExpAddOrConcat extends ASTExpression {
         }
         
         @Override
-        public int size() throws TemplateModelException {
+        public int size() throws TemplateException {
             initKeys();
             return size;
         }
 
         @Override
         public TemplateCollectionModel keys()
-        throws TemplateModelException {
+        throws TemplateException {
             initKeys();
             return keys;
         }
 
         @Override
         public TemplateCollectionModel values()
-        throws TemplateModelException {
+        throws TemplateException {
             initValues();
             return values;
         }
 
         private void initKeys()
-        throws TemplateModelException {
+        throws TemplateException {
             if (keys == null) {
                 HashSet keySet = new HashSet();
                 NativeSequence keySeq = new NativeSequence(32);
@@ -273,7 +272,7 @@ final class ASTExpAddOrConcat extends ASTExpression {
         }
 
         private static void addKeys(Set set, NativeSequence keySeq, TemplateHashModelEx hash)
-        throws TemplateModelException {
+        throws TemplateException {
             TemplateModelIterator it = hash.keys().iterator();
             while (it.hasNext()) {
                 TemplateScalarModel tsm = (TemplateScalarModel) it.next();
@@ -286,7 +285,7 @@ final class ASTExpAddOrConcat extends ASTExpression {
         }        
 
         private void initValues()
-        throws TemplateModelException {
+        throws TemplateException {
             if (values == null) {
                 NativeSequence seq = new NativeSequence(size());
                 // Note: size() invokes initKeys() if needed.

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltInVariable.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltInVariable.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltInVariable.java
index b32fdb3..e8a115c 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltInVariable.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltInVariable.java
@@ -26,7 +26,6 @@ import java.util.Set;
 import org.apache.freemarker.core.model.TemplateDateModel;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.impl.SimpleDate;
 import org.apache.freemarker.core.model.impl.SimpleScalar;
 import org.apache.freemarker.core.util._SortedArraySet;
@@ -235,7 +234,7 @@ final class ASTExpBuiltInVariable extends ASTExpression {
         }
         
         @Override
-        public TemplateModel get(String key) throws TemplateModelException {
+        public TemplateModel get(String key) throws TemplateException {
             return env.getVariable(key);
         }
         

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpHashLiteral.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpHashLiteral.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpHashLiteral.java
index 463110e..f188631 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpHashLiteral.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpHashLiteral.java
@@ -27,7 +27,6 @@ import java.util.ListIterator;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 import org.apache.freemarker.core.model.TemplateHashModelEx2;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateModelIterator;
 import org.apache.freemarker.core.model.impl.CollectionAndSequence;
 
@@ -160,29 +159,29 @@ final class ASTExpHashLiteral extends ASTExpression {
         }
 
         @Override
-        public KeyValuePairIterator keyValuePairIterator() throws TemplateModelException {
+        public KeyValuePairIterator keyValuePairIterator() throws TemplateException {
             return new KeyValuePairIterator() {
                 private final TemplateModelIterator keyIterator = keys().iterator();
                 private final TemplateModelIterator valueIterator = values().iterator();
 
                 @Override
-                public boolean hasNext() throws TemplateModelException {
+                public boolean hasNext() throws TemplateException {
                     return keyIterator.hasNext();
                 }
 
                 @Override
-                public KeyValuePair next() throws TemplateModelException {
+                public KeyValuePair next() throws TemplateException {
                     return new KeyValuePair() {
                         private final TemplateModel key = keyIterator.next();
                         private final TemplateModel value = valueIterator.next();
 
                         @Override
-                        public TemplateModel getKey() throws TemplateModelException {
+                        public TemplateModel getKey() throws TemplateException {
                             return key;
                         }
 
                         @Override
-                        public TemplateModel getValue() throws TemplateModelException {
+                        public TemplateModel getValue() throws TemplateException {
                             return value;
                         }
                         

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpNumberLiteral.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpNumberLiteral.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpNumberLiteral.java
index eccb446..a61629d 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpNumberLiteral.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpNumberLiteral.java
@@ -41,7 +41,7 @@ final class ASTExpNumberLiteral extends ASTExpression implements TemplateNumberM
 
     @Override
     public String evalAndCoerceToPlainText(Environment env) throws TemplateException {
-        return env.formatNumberToPlainText(this, this, false);
+        return env.formatNumberToPlainText(this, this);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpression.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpression.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpression.java
index 0994685..fcd199c 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpression.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpression.java
@@ -25,7 +25,6 @@ import org.apache.freemarker.core.model.TemplateDateModel;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateMarkupOutputModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateNumberModel;
 import org.apache.freemarker.core.model.TemplateScalarModel;
 import org.apache.freemarker.core.model.TemplateSequenceModel;
@@ -175,7 +174,7 @@ abstract class ASTExpression extends ASTNode {
     protected abstract ASTExpression deepCloneWithIdentifierReplaced_inner(
             String replacedIdentifier, ASTExpression replacement, ReplacemenetState replacementState);
 
-    static boolean isEmpty(TemplateModel model) throws TemplateModelException {
+    static boolean isEmpty(TemplateModel model) throws TemplateException {
         if (model instanceof BeanModel) {
             return ((BeanModel) model).isEmpty();
         } else if (model instanceof TemplateSequenceModel) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForHashEx.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForHashEx.java b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForHashEx.java
index 1988f5e..b5efa95 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForHashEx.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForHashEx.java
@@ -21,7 +21,6 @@ package org.apache.freemarker.core;
 
 import org.apache.freemarker.core.model.TemplateHashModelEx;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 
 abstract class BuiltInForHashEx extends ASTExpBuiltIn {
 
@@ -35,7 +34,7 @@ abstract class BuiltInForHashEx extends ASTExpBuiltIn {
     }
     
     abstract TemplateModel calculateResult(TemplateHashModelEx hashExModel, Environment env)
-            throws TemplateModelException, InvalidReferenceException;
+            throws TemplateException, InvalidReferenceException;
     
     protected InvalidReferenceException newNullPropertyException(
             String propertyName, TemplateModel tm, Environment env) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForMarkupOutput.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForMarkupOutput.java b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForMarkupOutput.java
index 384e491..c6650dc 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForMarkupOutput.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForMarkupOutput.java
@@ -21,7 +21,6 @@ package org.apache.freemarker.core;
 
 import org.apache.freemarker.core.model.TemplateMarkupOutputModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 
 abstract class BuiltInForMarkupOutput extends ASTExpBuiltIn {
     
@@ -35,6 +34,6 @@ abstract class BuiltInForMarkupOutput extends ASTExpBuiltIn {
         return calculateResult((TemplateMarkupOutputModel) model);
     }
     
-    protected abstract TemplateModel calculateResult(TemplateMarkupOutputModel model) throws TemplateModelException;
+    protected abstract TemplateModel calculateResult(TemplateMarkupOutputModel model) throws TemplateException;
     
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNode.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNode.java b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNode.java
index afe7111..7ebdd1d 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNode.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNode.java
@@ -20,7 +20,6 @@
 package org.apache.freemarker.core;
 
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateNodeModel;
 
 abstract class BuiltInForNode extends ASTExpBuiltIn {
@@ -36,6 +35,6 @@ abstract class BuiltInForNode extends ASTExpBuiltIn {
         }
     }
 
-    abstract TemplateModel calculateResult(TemplateNodeModel nodeModel, Environment env) throws TemplateModelException;
+    abstract TemplateModel calculateResult(TemplateNodeModel nodeModel, Environment env) throws TemplateException;
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNodeEx.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNodeEx.java b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNodeEx.java
index 67d0383..f737fd9 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNodeEx.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNodeEx.java
@@ -19,7 +19,6 @@
 package org.apache.freemarker.core;
 
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateNodeModelEx;
 
 abstract class BuiltInForNodeEx extends ASTExpBuiltIn {
@@ -33,5 +32,5 @@ abstract class BuiltInForNodeEx extends ASTExpBuiltIn {
         }
     }
     abstract TemplateModel calculateResult(TemplateNodeModelEx nodeModel, Environment env)
-            throws TemplateModelException;
+            throws TemplateException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNumber.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNumber.java b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNumber.java
index 02954f0..f4d0701 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNumber.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInForNumber.java
@@ -20,7 +20,6 @@
 package org.apache.freemarker.core;
 
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 
 abstract class BuiltInForNumber extends ASTExpBuiltIn {
     @Override
@@ -31,5 +30,5 @@ abstract class BuiltInForNumber extends ASTExpBuiltIn {
     }
     
     abstract TemplateModel calculateResult(Number num, TemplateModel model)
-    throws TemplateModelException;
+    throws TemplateException;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForHashes.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForHashes.java b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForHashes.java
index 8baa9cc..e87bd77 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForHashes.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForHashes.java
@@ -22,7 +22,6 @@ package org.apache.freemarker.core;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 import org.apache.freemarker.core.model.TemplateHashModelEx;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateSequenceModel;
 import org.apache.freemarker.core.model.impl.CollectionAndSequence;
 
@@ -35,7 +34,7 @@ class BuiltInsForHashes {
 
         @Override
         TemplateModel calculateResult(TemplateHashModelEx hashExModel, Environment env)
-                throws TemplateModelException, InvalidReferenceException {
+                throws TemplateException, InvalidReferenceException {
             TemplateCollectionModel keys = hashExModel.keys();
             if (keys == null) throw newNullPropertyException("keys", hashExModel, env);
             return keys instanceof TemplateSequenceModel ? keys : new CollectionAndSequence(keys);
@@ -46,7 +45,7 @@ class BuiltInsForHashes {
     static class valuesBI extends BuiltInForHashEx {
         @Override
         TemplateModel calculateResult(TemplateHashModelEx hashExModel, Environment env)
-                throws TemplateModelException, InvalidReferenceException {
+                throws TemplateException, InvalidReferenceException {
             TemplateCollectionModel values = hashExModel.values();
             if (values == null) throw newNullPropertyException("values", hashExModel, env);
             return values instanceof TemplateSequenceModel ? values : new CollectionAndSequence(values);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForMarkupOutputs.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForMarkupOutputs.java b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForMarkupOutputs.java
index f895526..7d3c20e 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForMarkupOutputs.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForMarkupOutputs.java
@@ -21,7 +21,6 @@ package org.apache.freemarker.core;
 
 import org.apache.freemarker.core.model.TemplateMarkupOutputModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.impl.SimpleScalar;
 
 /**
@@ -32,7 +31,7 @@ class BuiltInsForMarkupOutputs {
     static class markup_stringBI extends BuiltInForMarkupOutput {
 
         @Override
-        protected TemplateModel calculateResult(TemplateMarkupOutputModel model) throws TemplateModelException {
+        protected TemplateModel calculateResult(TemplateMarkupOutputModel model) throws TemplateException {
             return new SimpleScalar(model.getOutputFormat().getMarkupString(model));
         }
         

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForMultipleTypes.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForMultipleTypes.java b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForMultipleTypes.java
index 048d633..6335777 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForMultipleTypes.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForMultipleTypes.java
@@ -19,7 +19,7 @@
 
 package org.apache.freemarker.core;
 
-import static org.apache.freemarker.core.util.CallableUtils.getOptionalStringArgument;
+import static org.apache.freemarker.core.util.CallableUtils.*;
 
 import java.util.Date;
 
@@ -34,7 +34,6 @@ import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateHashModelEx;
 import org.apache.freemarker.core.model.TemplateMarkupOutputModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateModelWithAPISupport;
 import org.apache.freemarker.core.model.TemplateNodeModel;
 import org.apache.freemarker.core.model.TemplateNumberModel;
@@ -73,7 +72,7 @@ class BuiltInsForMultipleTypes {
         }
 
         @Override
-        protected TemplateModel formatNumber(Environment env, TemplateModel model) throws TemplateModelException {
+        protected TemplateModel formatNumber(Environment env, TemplateModel model) throws TemplateException {
             Number num = _EvalUtils.modelToNumber((TemplateNumberModel) model, target);
             if (num instanceof Integer || num instanceof Long) {
                 // Accelerate these fairly common cases
@@ -120,7 +119,7 @@ class BuiltInsForMultipleTypes {
             DateParser(String text, Environment env) throws TemplateException {
                 this.text = text;
                 this.env = env;
-                defaultFormat = env.getTemplateDateFormat(dateType, Date.class, target, false);
+                defaultFormat = env.getTemplateDateFormat(dateType, Date.class, target);
             }
 
             @Override
@@ -136,30 +135,25 @@ class BuiltInsForMultipleTypes {
             }
 
             @Override
-            public TemplateModel get(String pattern) throws TemplateModelException {
-                TemplateDateFormat format;
-                try {
-                    format = env.getTemplateDateFormat(pattern, dateType, Date.class, target, dateBI.this, true);
-                } catch (TemplateException e) {
-                    // `e` should always be a TemplateModelException here, but to be sure: 
-                    throw _CoreAPI.ensureIsTemplateModelException("Failed to get format", e); 
-                }
+            public TemplateModel get(String pattern) throws TemplateException {
+                TemplateDateFormat format = env.getTemplateDateFormat(
+                        pattern, dateType, Date.class, target, dateBI.this);
                 return toTemplateDateModel(parse(format));
             }
 
-            private TemplateDateModel toTemplateDateModel(Object date) throws _TemplateModelException {
+            private TemplateDateModel toTemplateDateModel(Object date) throws TemplateException {
                 if (date instanceof Date) {
                     return new SimpleDate((Date) date, dateType);
                 } else {
                     TemplateDateModel tm = (TemplateDateModel) date;
                     if (tm.getDateType() != dateType) {
-                        throw new _TemplateModelException("The result of the parsing was of the wrong date type.");
+                        throw new TemplateException("The result of the parsing was of the wrong date type.");
                     }
                     return tm;
                 }
             }
 
-            private TemplateDateModel getAsDateModel() throws TemplateModelException {
+            private TemplateDateModel getAsDateModel() throws TemplateException {
                 if (cachedValue == null) {
                     cachedValue = toTemplateDateModel(parse(defaultFormat));
                 }
@@ -167,7 +161,7 @@ class BuiltInsForMultipleTypes {
             }
             
             @Override
-            public Date getAsDate() throws TemplateModelException {
+            public Date getAsDate() throws TemplateException {
                 return getAsDateModel().getAsDate();
             }
     
@@ -182,11 +176,11 @@ class BuiltInsForMultipleTypes {
             }
     
             private Object parse(TemplateDateFormat df)
-            throws TemplateModelException {
+            throws TemplateException {
                 try {
                     return df.parse(text, dateType);
                 } catch (TemplateValueFormatException e) {
-                    throw new _TemplateModelException(e,
+                    throw new TemplateException(e,
                             "The string doesn't match the expected date/time/date-time format. "
                             + "The string to parse was: ", new _DelayedJQuote(text), ". ",
                             "The expected format was: ", new _DelayedJQuote(df.getDescription()), ".",
@@ -492,16 +486,12 @@ class BuiltInsForMultipleTypes {
             }
 
             @Override
-            public String getAsString() throws TemplateModelException {
+            public String getAsString() throws TemplateException {
                 // Boolean should have come first... but that change would be non-BC. 
                 if (bool instanceof TemplateScalarModel) {
                     return ((TemplateScalarModel) bool).getAsString();
                 } else {
-                    try {
-                        return env.formatBoolean(bool.getAsBoolean(), true);
-                    } catch (TemplateException e) {
-                        throw new TemplateModelException(e);
-                    }
+                    return env.formatBoolean(bool.getAsBoolean(), true);
                 }
             }
         }
@@ -522,7 +512,7 @@ class BuiltInsForMultipleTypes {
                 defaultFormat = dateType == TemplateDateModel.UNKNOWN
                         ? null  // Lazy unknown type error in getAsString()
                         : env.getTemplateDateFormat(
-                                dateType, _EvalUtils.modelToDate(dateModel, target).getClass(), target, true);
+                                dateType, _EvalUtils.modelToDate(dateModel, target).getClass(), target);
             }
 
             @Override
@@ -537,24 +527,17 @@ class BuiltInsForMultipleTypes {
             }
 
             @Override
-            public TemplateModel get(String key)
-            throws TemplateModelException {
+            public TemplateModel get(String key) throws TemplateException {
                 return formatWith(key);
             }
 
-            private TemplateModel formatWith(String key)
-            throws TemplateModelException {
-                try {
-                    return new SimpleScalar(env.formatDateToPlainText(dateModel, key, target, stringBI.this, true));
-                } catch (TemplateException e) {
-                    // `e` should always be a TemplateModelException here, but to be sure: 
-                    throw _CoreAPI.ensureIsTemplateModelException("Failed to format value", e); 
-                }
+            private TemplateModel formatWith(String key) throws TemplateException {
+                return new SimpleScalar(env.formatDateToPlainText(dateModel, key, target, stringBI.this));
             }
             
             @Override
             public String getAsString()
-            throws TemplateModelException {
+            throws TemplateException {
                 if (cachedValue == null) {
                     if (defaultFormat == null) {
                         if (dateModel.getDateType() == TemplateDateModel.UNKNOWN) {
@@ -566,12 +549,7 @@ class BuiltInsForMultipleTypes {
                     try {
                         cachedValue = _EvalUtils.assertFormatResultNotNull(defaultFormat.formatToPlainText(dateModel));
                     } catch (TemplateValueFormatException e) {
-                        try {
-                            throw MessageUtils.newCantFormatDateException(defaultFormat, target, e, true);
-                        } catch (TemplateException e2) {
-                            // `e` should always be a TemplateModelException here, but to be sure: 
-                            throw _CoreAPI.ensureIsTemplateModelException("Failed to format date/time/dateTime", e2);
-                        }
+                        throw MessageUtils.newCantFormatDateException(defaultFormat, target, e);
                     }
                 }
                 return cachedValue;
@@ -597,12 +575,7 @@ class BuiltInsForMultipleTypes {
                 // As we format lazily, we need a snapshot of the format inputs:
                 this.numberModel = numberModel;
                 number = _EvalUtils.modelToNumber(numberModel, target);  // for BackwardCompatibleTemplateNumberFormat-s
-                try {
-                    defaultFormat = env.getTemplateNumberFormat(stringBI.this, true);
-                } catch (TemplateException e) {
-                    // `e` should always be a TemplateModelException here, but to be sure: 
-                    throw _CoreAPI.ensureIsTemplateModelException("Failed to get default number format", e); 
-                }
+                defaultFormat = env.getTemplateNumberFormat(stringBI.this);
             }
 
             @Override
@@ -617,35 +590,18 @@ class BuiltInsForMultipleTypes {
             }
 
             @Override
-            public TemplateModel get(String key) throws TemplateModelException {
-                TemplateNumberFormat format;
-                try {
-                    format = env.getTemplateNumberFormat(key, stringBI.this, true);
-                } catch (TemplateException e) {
-                    // `e` should always be a TemplateModelException here, but to be sure: 
-                    throw _CoreAPI.ensureIsTemplateModelException("Failed to get number format", e); 
-                }
-                
-                String result;
-                try {
-                    result = env.formatNumberToPlainText(numberModel, format, target, true);
-                } catch (TemplateException e) {
-                    // `e` should always be a TemplateModelException here, but to be sure: 
-                    throw _CoreAPI.ensureIsTemplateModelException("Failed to format number", e); 
-                }
-                
+            public TemplateModel get(String key) throws TemplateException {
+                TemplateNumberFormat format = env.getTemplateNumberFormat(key, stringBI.this);
+
+                String result = env.formatNumberToPlainText(numberModel, format, target);
+
                 return new SimpleScalar(result);
             }
             
             @Override
-            public String getAsString() throws TemplateModelException {
+            public String getAsString() throws TemplateException {
                 if (cachedValue == null) {
-                    try {
-                        cachedValue = env.formatNumberToPlainText(numberModel, defaultFormat, target, true);
-                    } catch (TemplateException e) {
-                        // `e` should always be a TemplateModelException here, but to be sure: 
-                        throw _CoreAPI.ensureIsTemplateModelException("Failed to format number", e); 
-                    }
+                    cachedValue = env.formatNumberToPlainText(numberModel, defaultFormat, target);
                 }
                 return cachedValue;
             }
@@ -660,9 +616,7 @@ class BuiltInsForMultipleTypes {
         TemplateModel _eval(Environment env) throws TemplateException {
             TemplateModel model = target.eval(env);
             if (model instanceof TemplateNumberModel) {
-                TemplateNumberModel numberModel = (TemplateNumberModel) model;
-                Number num = _EvalUtils.modelToNumber(numberModel, target);
-                return new NumberFormatter(numberModel, env);
+                return new NumberFormatter((TemplateNumberModel) model, env);
             } else if (model instanceof TemplateDateModel) {
                 TemplateDateModel dm = (TemplateDateModel) model;
                 return new DateFormatter(dm, env);
@@ -706,7 +660,7 @@ class BuiltInsForMultipleTypes {
             }
         }
     
-        protected abstract TemplateModel formatNumber(Environment env, TemplateModel model) throws TemplateModelException;
+        protected abstract TemplateModel formatNumber(Environment env, TemplateModel model) throws TemplateException;
         
     }
 



Mime
View raw message