freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [3/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:37 GMT
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/CollectionAndSequence.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/CollectionAndSequence.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/CollectionAndSequence.java
index 7979981..8a7970a 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/CollectionAndSequence.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/CollectionAndSequence.java
@@ -21,10 +21,10 @@ package org.apache.freemarker.core.model.impl;
 
 import java.util.ArrayList;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 import org.apache.freemarker.core.model.TemplateCollectionModelEx;
 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.TemplateSequenceModel;
 
@@ -47,7 +47,7 @@ final public class CollectionAndSequence implements TemplateCollectionModel, Tem
     }
 
     @Override
-    public TemplateModelIterator iterator() throws TemplateModelException {
+    public TemplateModelIterator iterator() throws TemplateException {
         if (collection != null) {
             return collection.iterator();
         } else {
@@ -56,7 +56,7 @@ final public class CollectionAndSequence implements TemplateCollectionModel, Tem
     }
 
     @Override
-    public TemplateModel get(int i) throws TemplateModelException {
+    public TemplateModel get(int i) throws TemplateException {
         if (sequence != null) {
             return sequence.get(i);
         } else {
@@ -66,7 +66,7 @@ final public class CollectionAndSequence implements TemplateCollectionModel, Tem
     }
 
     @Override
-    public int size() throws TemplateModelException {
+    public int size() throws TemplateException {
         if (sequence != null) {
             return sequence.size();
         } else if (collection instanceof TemplateCollectionModelEx) {
@@ -77,7 +77,7 @@ final public class CollectionAndSequence implements TemplateCollectionModel, Tem
         }
     }
 
-    private void initSequence() throws TemplateModelException {
+    private void initSequence() throws TemplateException {
         if (data == null) {
             data = new ArrayList();
             TemplateModelIterator it = collection.iterator();
@@ -93,13 +93,13 @@ final public class CollectionAndSequence implements TemplateCollectionModel, Tem
         private final int size;
         private int index = 0;
 
-        SequenceIterator(TemplateSequenceModel sequence) throws TemplateModelException {
+        SequenceIterator(TemplateSequenceModel sequence) throws TemplateException {
             this.sequence = sequence;
             size = sequence.size();
             
         }
         @Override
-        public TemplateModel next() throws TemplateModelException {
+        public TemplateModel next() throws TemplateException {
             return sequence.get(index++);
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultArrayAdapter.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultArrayAdapter.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultArrayAdapter.java
index b661fcc..0e15194 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultArrayAdapter.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultArrayAdapter.java
@@ -21,12 +21,12 @@ package org.apache.freemarker.core.model.impl;
 
 import java.lang.reflect.Array;
 
+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.ObjectWrapperAndUnwrapper;
 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.WrapperTemplateModel;
 import org.apache.freemarker.core.model.WrappingTemplateModel;
@@ -117,12 +117,12 @@ public abstract class DefaultArrayAdapter extends WrappingTemplateModel implemen
         }
 
         @Override
-        public TemplateModel get(int index) throws TemplateModelException {
+        public TemplateModel get(int index) throws TemplateException {
             return index >= 0 && index < array.length ? wrap(array[index]) : null;
         }
 
         @Override
-        public int size() throws TemplateModelException {
+        public int size() throws TemplateException {
             return array.length;
         }
 
@@ -143,12 +143,12 @@ public abstract class DefaultArrayAdapter extends WrappingTemplateModel implemen
         }
 
         @Override
-        public TemplateModel get(int index) throws TemplateModelException {
+        public TemplateModel get(int index) throws TemplateException {
             return index >= 0 && index < array.length ? wrap(Byte.valueOf(array[index])) : null;
         }
 
         @Override
-        public int size() throws TemplateModelException {
+        public int size() throws TemplateException {
             return array.length;
         }
 
@@ -169,12 +169,12 @@ public abstract class DefaultArrayAdapter extends WrappingTemplateModel implemen
         }
 
         @Override
-        public TemplateModel get(int index) throws TemplateModelException {
+        public TemplateModel get(int index) throws TemplateException {
             return index >= 0 && index < array.length ? wrap(Short.valueOf(array[index])) : null;
         }
 
         @Override
-        public int size() throws TemplateModelException {
+        public int size() throws TemplateException {
             return array.length;
         }
 
@@ -195,12 +195,12 @@ public abstract class DefaultArrayAdapter extends WrappingTemplateModel implemen
         }
 
         @Override
-        public TemplateModel get(int index) throws TemplateModelException {
+        public TemplateModel get(int index) throws TemplateException {
             return index >= 0 && index < array.length ? wrap(Integer.valueOf(array[index])) : null;
         }
 
         @Override
-        public int size() throws TemplateModelException {
+        public int size() throws TemplateException {
             return array.length;
         }
 
@@ -221,12 +221,12 @@ public abstract class DefaultArrayAdapter extends WrappingTemplateModel implemen
         }
 
         @Override
-        public TemplateModel get(int index) throws TemplateModelException {
+        public TemplateModel get(int index) throws TemplateException {
             return index >= 0 && index < array.length ? wrap(Long.valueOf(array[index])) : null;
         }
 
         @Override
-        public int size() throws TemplateModelException {
+        public int size() throws TemplateException {
             return array.length;
         }
 
@@ -247,12 +247,12 @@ public abstract class DefaultArrayAdapter extends WrappingTemplateModel implemen
         }
 
         @Override
-        public TemplateModel get(int index) throws TemplateModelException {
+        public TemplateModel get(int index) throws TemplateException {
             return index >= 0 && index < array.length ? wrap(Float.valueOf(array[index])) : null;
         }
 
         @Override
-        public int size() throws TemplateModelException {
+        public int size() throws TemplateException {
             return array.length;
         }
 
@@ -273,12 +273,12 @@ public abstract class DefaultArrayAdapter extends WrappingTemplateModel implemen
         }
 
         @Override
-        public TemplateModel get(int index) throws TemplateModelException {
+        public TemplateModel get(int index) throws TemplateException {
             return index >= 0 && index < array.length ? wrap(Double.valueOf(array[index])) : null;
         }
 
         @Override
-        public int size() throws TemplateModelException {
+        public int size() throws TemplateException {
             return array.length;
         }
 
@@ -299,12 +299,12 @@ public abstract class DefaultArrayAdapter extends WrappingTemplateModel implemen
         }
 
         @Override
-        public TemplateModel get(int index) throws TemplateModelException {
+        public TemplateModel get(int index) throws TemplateException {
             return index >= 0 && index < array.length ? wrap(Character.valueOf(array[index])) : null;
         }
 
         @Override
-        public int size() throws TemplateModelException {
+        public int size() throws TemplateException {
             return array.length;
         }
 
@@ -325,12 +325,12 @@ public abstract class DefaultArrayAdapter extends WrappingTemplateModel implemen
         }
 
         @Override
-        public TemplateModel get(int index) throws TemplateModelException {
+        public TemplateModel get(int index) throws TemplateException {
             return index >= 0 && index < array.length ? wrap(Boolean.valueOf(array[index])) : null;
         }
 
         @Override
-        public int size() throws TemplateModelException {
+        public int size() throws TemplateException {
             return array.length;
         }
 
@@ -356,12 +356,12 @@ public abstract class DefaultArrayAdapter extends WrappingTemplateModel implemen
         }
 
         @Override
-        public TemplateModel get(int index) throws TemplateModelException {
+        public TemplateModel get(int index) throws TemplateException {
             return index >= 0 && index < length ? wrap(Array.get(array, index)) : null;
         }
 
         @Override
-        public int size() throws TemplateModelException {
+        public int size() throws TemplateException {
             return length;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultEnumerationAdapter.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultEnumerationAdapter.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultEnumerationAdapter.java
index 2149f8c..af61102 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultEnumerationAdapter.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultEnumerationAdapter.java
@@ -22,12 +22,12 @@ package org.apache.freemarker.core.model.impl;
 import java.util.Enumeration;
 import java.util.Iterator;
 
+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.ObjectWrapperWithAPISupport;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 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.TemplateModelWithAPISupport;
 import org.apache.freemarker.core.model.WrapperTemplateModel;
@@ -74,12 +74,12 @@ public class DefaultEnumerationAdapter extends WrappingTemplateModel implements
     }
 
     @Override
-    public TemplateModelIterator iterator() throws TemplateModelException {
+    public TemplateModelIterator iterator() throws TemplateException {
         return new SimpleTemplateModelIterator();
     }
 
     @Override
-    public TemplateModel getAPI() throws TemplateModelException {
+    public TemplateModel getAPI() throws TemplateException {
         return ((ObjectWrapperWithAPISupport) getObjectWrapper()).wrapAsAPI(enumeration);
     }
 
@@ -91,7 +91,7 @@ public class DefaultEnumerationAdapter extends WrappingTemplateModel implements
         private boolean enumerationOwnedByMe;
 
         @Override
-        public TemplateModel next() throws TemplateModelException {
+        public TemplateModel next() throws TemplateException {
             if (!enumerationOwnedByMe) {
                 checkNotOwner();
                 enumerationOwnedBySomeone = true;
@@ -99,7 +99,7 @@ public class DefaultEnumerationAdapter extends WrappingTemplateModel implements
             }
 
             if (!enumeration.hasMoreElements()) {
-                throw new TemplateModelException("The collection has no more items.");
+                throw new TemplateException("The collection has no more items.");
             }
 
             Object value = enumeration.nextElement();
@@ -107,7 +107,7 @@ public class DefaultEnumerationAdapter extends WrappingTemplateModel implements
         }
 
         @Override
-        public boolean hasNext() throws TemplateModelException {
+        public boolean hasNext() throws TemplateException {
             // Calling hasNext may looks safe, but I have met sync. problems.
             if (!enumerationOwnedByMe) {
                 checkNotOwner();
@@ -116,9 +116,9 @@ public class DefaultEnumerationAdapter extends WrappingTemplateModel implements
             return enumeration.hasMoreElements();
         }
 
-        private void checkNotOwner() throws TemplateModelException {
+        private void checkNotOwner() throws TemplateException {
             if (enumerationOwnedBySomeone) {
-                throw new TemplateModelException(
+                throw new TemplateException(
                         "This collection value wraps a java.util.Enumeration, thus it can be listed only once.");
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultIterableAdapter.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultIterableAdapter.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultIterableAdapter.java
index 1033a5f..e60a090 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultIterableAdapter.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultIterableAdapter.java
@@ -22,13 +22,13 @@ package org.apache.freemarker.core.model.impl;
 import java.util.Collection;
 import java.util.Iterator;
 
+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.ObjectWrapperAndUnwrapper;
 import org.apache.freemarker.core.model.ObjectWrapperWithAPISupport;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 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.TemplateModelWithAPISupport;
 import org.apache.freemarker.core.model.WrapperTemplateModel;
@@ -69,7 +69,7 @@ public class DefaultIterableAdapter extends WrappingTemplateModel implements Tem
     }
 
     @Override
-    public TemplateModelIterator iterator() throws TemplateModelException {
+    public TemplateModelIterator iterator() throws TemplateException {
         return new DefaultUnassignableIteratorAdapter(iterable.iterator(), getObjectWrapper());
     }
 
@@ -84,7 +84,7 @@ public class DefaultIterableAdapter extends WrappingTemplateModel implements Tem
     }
 
     @Override
-    public TemplateModel getAPI() throws TemplateModelException {
+    public TemplateModel getAPI() throws TemplateException {
         return ((ObjectWrapperWithAPISupport) getObjectWrapper()).wrapAsAPI(iterable);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultIteratorAdapter.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultIteratorAdapter.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultIteratorAdapter.java
index 8159f14..ea9af3f 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultIteratorAdapter.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultIteratorAdapter.java
@@ -21,12 +21,12 @@ package org.apache.freemarker.core.model.impl;
 
 import java.util.Iterator;
 
+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.ObjectWrapperWithAPISupport;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 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.TemplateModelWithAPISupport;
 import org.apache.freemarker.core.model.WrapperTemplateModel;
@@ -82,12 +82,12 @@ public class DefaultIteratorAdapter extends WrappingTemplateModel implements Tem
     }
 
     @Override
-    public TemplateModelIterator iterator() throws TemplateModelException {
+    public TemplateModelIterator iterator() throws TemplateException {
         return new SimpleTemplateModelIterator();
     }
 
     @Override
-    public TemplateModel getAPI() throws TemplateModelException {
+    public TemplateModel getAPI() throws TemplateException {
         return ((ObjectWrapperWithAPISupport) getObjectWrapper()).wrapAsAPI(iterator);
     }
 
@@ -99,7 +99,7 @@ public class DefaultIteratorAdapter extends WrappingTemplateModel implements Tem
         private boolean iteratorOwnedByMe;
 
         @Override
-        public TemplateModel next() throws TemplateModelException {
+        public TemplateModel next() throws TemplateException {
             if (!iteratorOwnedByMe) {
                 checkNotOwner();
                 iteratorOwnedBySomeone = true;
@@ -107,7 +107,7 @@ public class DefaultIteratorAdapter extends WrappingTemplateModel implements Tem
             }
 
             if (!iterator.hasNext()) {
-                throw new TemplateModelException("The collection has no more items.");
+                throw new TemplateException("The collection has no more items.");
             }
 
             Object value = iterator.next();
@@ -115,7 +115,7 @@ public class DefaultIteratorAdapter extends WrappingTemplateModel implements Tem
         }
 
         @Override
-        public boolean hasNext() throws TemplateModelException {
+        public boolean hasNext() throws TemplateException {
             // Calling hasNext may looks safe, but I have met sync. problems.
             if (!iteratorOwnedByMe) {
                 checkNotOwner();
@@ -124,9 +124,9 @@ public class DefaultIteratorAdapter extends WrappingTemplateModel implements Tem
             return iterator.hasNext();
         }
 
-        private void checkNotOwner() throws TemplateModelException {
+        private void checkNotOwner() throws TemplateException {
             if (iteratorOwnedBySomeone) {
-                throw new TemplateModelException(
+                throw new TemplateException(
                         "This collection value wraps a java.util.Iterator, thus it can be listed only once.");
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultListAdapter.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultListAdapter.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultListAdapter.java
index b90a343..80e76d8 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultListAdapter.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultListAdapter.java
@@ -22,13 +22,13 @@ package org.apache.freemarker.core.model.impl;
 import java.util.AbstractSequentialList;
 import java.util.List;
 
+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.ObjectWrapperWithAPISupport;
 import org.apache.freemarker.core.model.RichObjectWrapper;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 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.TemplateModelWithAPISupport;
 import org.apache.freemarker.core.model.TemplateSequenceModel;
@@ -79,12 +79,12 @@ public class DefaultListAdapter extends WrappingTemplateModel implements Templat
     }
 
     @Override
-    public TemplateModel get(int index) throws TemplateModelException {
+    public TemplateModel get(int index) throws TemplateException {
         return index >= 0 && index < list.size() ? wrap(list.get(index)) : null;
     }
 
     @Override
-    public int size() throws TemplateModelException {
+    public int size() throws TemplateException {
         return list.size();
     }
 
@@ -106,14 +106,14 @@ public class DefaultListAdapter extends WrappingTemplateModel implements Templat
         }
 
         @Override
-        public TemplateModelIterator iterator() throws TemplateModelException {
+        public TemplateModelIterator iterator() throws TemplateException {
             return new DefaultUnassignableIteratorAdapter(list.iterator(), getObjectWrapper());
         }
 
     }
 
     @Override
-    public TemplateModel getAPI() throws TemplateModelException {
+    public TemplateModel getAPI() throws TemplateException {
         return ((ObjectWrapperWithAPISupport) getObjectWrapper()).wrapAsAPI(list);
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultMapAdapter.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultMapAdapter.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultMapAdapter.java
index 65f7cb4..832c675 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultMapAdapter.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultMapAdapter.java
@@ -22,8 +22,8 @@ package org.apache.freemarker.core.model.impl;
 import java.util.Map;
 import java.util.SortedMap;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core._DelayedJQuote;
-import org.apache.freemarker.core._TemplateModelException;
 import org.apache.freemarker.core.model.AdapterTemplateModel;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.ObjectWrapperWithAPISupport;
@@ -31,7 +31,6 @@ 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.TemplateModelWithAPISupport;
 import org.apache.freemarker.core.model.WrapperTemplateModel;
 import org.apache.freemarker.core.model.WrappingTemplateModel;
@@ -73,16 +72,16 @@ public class DefaultMapAdapter extends WrappingTemplateModel
     }
 
     @Override
-    public TemplateModel get(String key) throws TemplateModelException {
+    public TemplateModel get(String key) throws TemplateException {
         Object val;
         try {
             val = map.get(key);
         } catch (ClassCastException e) {
-            throw new _TemplateModelException(e,
+            throw new TemplateException(e,
                     "ClassCastException while getting Map entry with String key ",
                     new _DelayedJQuote(key));
         } catch (NullPointerException e) {
-            throw new _TemplateModelException(e,
+            throw new TemplateException(e,
                     "NullPointerException while getting Map entry with String key ",
                     new _DelayedJQuote(key));
         }
@@ -103,11 +102,11 @@ public class DefaultMapAdapter extends WrappingTemplateModel
                         }
                     } 
                 } catch (ClassCastException e) {
-                    throw new _TemplateModelException(e,
+                    throw new TemplateException(e,
                                     "Class casting exception while getting Map entry with Character key ",
                                     new _DelayedJQuote(charKey));
                 } catch (NullPointerException e) {
-                    throw new _TemplateModelException(e,
+                    throw new TemplateException(e,
                                     "NullPointerException while getting Map entry with Character key ",
                                     new _DelayedJQuote(charKey));
                 }
@@ -160,7 +159,7 @@ public class DefaultMapAdapter extends WrappingTemplateModel
     }
 
     @Override
-    public TemplateModel getAPI() throws TemplateModelException {
+    public TemplateModel getAPI() throws TemplateException {
         return ((ObjectWrapperWithAPISupport) getObjectWrapper()).wrapAsAPI(map);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
index 60b41f1..6f8a5f9 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
@@ -22,13 +22,13 @@ package org.apache.freemarker.core.model.impl;
 import java.util.Collection;
 import java.util.List;
 
+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.ObjectWrapperAndUnwrapper;
 import org.apache.freemarker.core.model.ObjectWrapperWithAPISupport;
 import org.apache.freemarker.core.model.TemplateCollectionModelEx;
 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.TemplateModelWithAPISupport;
 import org.apache.freemarker.core.model.WrapperTemplateModel;
@@ -68,7 +68,7 @@ public class DefaultNonListCollectionAdapter extends WrappingTemplateModel imple
     }
 
     @Override
-    public TemplateModelIterator iterator() throws TemplateModelException {
+    public TemplateModelIterator iterator() throws TemplateException {
         return new DefaultUnassignableIteratorAdapter(collection.iterator(), getObjectWrapper());
     }
 
@@ -93,7 +93,7 @@ public class DefaultNonListCollectionAdapter extends WrappingTemplateModel imple
     }
 
     @Override
-    public TemplateModel getAPI() throws TemplateModelException {
+    public TemplateModel getAPI() throws TemplateException {
         return ((ObjectWrapperWithAPISupport) getObjectWrapper()).wrapAsAPI(collection);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
index 64b85a3..42e9e1a 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
@@ -45,14 +45,15 @@ import java.util.WeakHashMap;
 import org.apache.freemarker.core.CallPlace;
 import org.apache.freemarker.core.Configuration;
 import org.apache.freemarker.core.NonTemplateCallPlace;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.Version;
 import org.apache.freemarker.core._CoreAPI;
-import org.apache.freemarker.core._DelayedTemplateLanguageTypeDescription;
 import org.apache.freemarker.core._DelayedShortClassName;
-import org.apache.freemarker.core._TemplateModelException;
+import org.apache.freemarker.core._DelayedTemplateLanguageTypeDescription;
 import org.apache.freemarker.core.model.AdapterTemplateModel;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.ObjectWrapperAndUnwrapper;
+import org.apache.freemarker.core.model.ObjectWrappingException;
 import org.apache.freemarker.core.model.RichObjectWrapper;
 import org.apache.freemarker.core.model.TemplateBooleanModel;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
@@ -61,7 +62,6 @@ import org.apache.freemarker.core.model.TemplateFunctionModel;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelAdapter;
-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;
@@ -374,7 +374,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
      * </ol>
      */
     @Override
-    public TemplateModel wrap(Object obj) throws TemplateModelException {
+    public TemplateModel wrap(Object obj) throws ObjectWrappingException {
         if (obj == null) {
             return null;
         }
@@ -475,7 +475,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
      * override {@link #wrapSpecialObject(Object)}}, or don't subclass the {@link ObjectWrapper} at all, and
      * just set the {@link ExtendableBuilder#getExtensions() extensions} configuration setting of it.
      */
-    protected TemplateModel wrapGenericObject(Object obj) throws TemplateModelException {
+    protected TemplateModel wrapGenericObject(Object obj) throws ObjectWrappingException {
         return new BeanAndStringModel(obj, this);
     }
 
@@ -498,7 +498,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
     /**
      */
     @Override
-    public TemplateHashModel wrapAsAPI(Object obj) throws TemplateModelException {
+    public TemplateHashModel wrapAsAPI(Object obj) throws ObjectWrappingException {
         return new APIModel(obj, this);
     }
 
@@ -513,10 +513,10 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
      * {@link TemplateSequenceModel} into a List, and arbitrary
      * {@link TemplateCollectionModel} into a Set. All other objects are
      * returned unchanged.
-     * @throws TemplateModelException if an attempted unwrapping fails.
+     * @throws TemplateException if an attempted unwrapping fails.
      */
     @Override
-    public Object unwrap(TemplateModel model) throws TemplateModelException {
+    public Object unwrap(TemplateModel model) throws TemplateException {
         return unwrap(model, Object.class);
     }
 
@@ -529,15 +529,15 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
      * @param model the model to unwrap
      * @param targetClass the class of the unwrapped result; {@code Object.class} of we don't know what the expected type is.
      * @return the unwrapped result of the desired class
-     * @throws TemplateModelException if an attempted unwrapping fails.
+     * @throws TemplateException if an attempted unwrapping fails.
      *
      * @see #tryUnwrapTo(TemplateModel, Class)
      */
     public Object unwrap(TemplateModel model, Class<?> targetClass)
-            throws TemplateModelException {
+            throws TemplateException {
         final Object obj = tryUnwrapTo(model, targetClass);
         if (obj == ObjectWrapperAndUnwrapper.CANT_UNWRAP_TO_TARGET_CLASS) {
-            throw new TemplateModelException("Can not unwrap model of type " +
+            throw new TemplateException("Can not unwrap model of type " +
                     model.getClass().getName() + " to type " + targetClass.getName());
         }
         return obj;
@@ -546,7 +546,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
     /**
      */
     @Override
-    public Object tryUnwrapTo(TemplateModel model, Class<?> targetClass) throws TemplateModelException {
+    public Object tryUnwrapTo(TemplateModel model, Class<?> targetClass) throws TemplateException {
         return tryUnwrapTo(model, targetClass, 0);
     }
 
@@ -557,7 +557,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
      *            non-overloaded methods.
      * @return {@link ObjectWrapperAndUnwrapper#CANT_UNWRAP_TO_TARGET_CLASS} or the unwrapped object.
      */
-    Object tryUnwrapTo(TemplateModel model, Class<?> targetClass, int typeFlags) throws TemplateModelException {
+    Object tryUnwrapTo(TemplateModel model, Class<?> targetClass, int typeFlags) throws TemplateException {
         Object res = tryUnwrapTo(model, targetClass, typeFlags, null);
         if ((typeFlags & TypeFlags.WIDENED_NUMERICAL_UNWRAPPING_HINT) != 0
                 && res instanceof Number) {
@@ -572,7 +572,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
      */
     private Object tryUnwrapTo(final TemplateModel model, Class<?> targetClass, final int typeFlags,
                                final Map<Object, Object> recursionStops)
-            throws TemplateModelException {
+            throws TemplateException {
         if (model == null) {
             return null;
         }
@@ -791,11 +791,11 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
      * @param tryOnly
      *            If {@code true}, if the conversion of an item to the component type isn't possible, the method returns
      *            {@link ObjectWrapperAndUnwrapper#CANT_UNWRAP_TO_TARGET_CLASS} instead of throwing a
-     *            {@link TemplateModelException}.
+     *            {@link TemplateException}.
      */
     Object unwrapSequenceToArray(
             TemplateSequenceModel seq, Class<?> arrayClass, boolean tryOnly, Map<Object, Object> recursionStops)
-            throws TemplateModelException {
+            throws TemplateException {
         if (recursionStops != null) {
             Object retval = recursionStops.get(seq);
             if (retval != null) {
@@ -816,7 +816,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
                     if (tryOnly) {
                         return ObjectWrapperAndUnwrapper.CANT_UNWRAP_TO_TARGET_CLASS;
                     } else {
-                        throw new _TemplateModelException(
+                        throw new TemplateException(
                                 "Failed to convert ",  new _DelayedTemplateLanguageTypeDescription(seq),
                                 " object to ", new _DelayedShortClassName(array.getClass()),
                                 ": Problematic sequence item at index ", Integer.valueOf(i) ," with value type: ",
@@ -833,7 +833,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
     }
 
     Object listToArray(List<?> list, Class<?> arrayClass, Map<Object, Object> recursionStops)
-            throws TemplateModelException {
+            throws TemplateException {
         if (list instanceof SequenceAdapter) {
             return unwrapSequenceToArray(
                     ((SequenceAdapter) list).getTemplateSequenceModel(),
@@ -888,7 +888,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
                 try {
                     Array.set(array, i, listItem);
                 } catch (IllegalArgumentException e) {
-                    throw new TemplateModelException(
+                    throw new TemplateException(
                             "Failed to convert " + _ClassUtils.getShortClassNameOfObject(list)
                                     + " object to " + _ClassUtils.getShortClassNameOfObject(array)
                                     + ": Problematic List item at index " + i + " with value type: "
@@ -905,7 +905,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
     /**
      * @param array Must be an array (of either a reference or primitive type)
      */
-    List<?> arrayToList(Object array) throws TemplateModelException {
+    List<?> arrayToList(Object array) throws TemplateException {
         if (array instanceof Object[]) {
             // Array of any non-primitive type.
             // Note that an array of non-primitive type is always instanceof Object[].
@@ -985,15 +985,13 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
      * @throws InvocationTargetException if the invoked method threw an exception
      * @throws IllegalAccessException if the method can't be invoked due to an
      * access restriction.
-     * @throws TemplateModelException if the return value couldn't be wrapped
+     * @throws TemplateException if the return value couldn't be wrapped
      * (this can happen if the wrapper has an outer identity or is subclassed,
      * and the outer identity or the subclass throws an exception. Plain
-     * DefaultObjectWrapper never throws TemplateModelException).
+     * DefaultObjectWrapper never throws TemplateException).
      */
     TemplateModel invokeMethod(Object object, Method method, Object[] args)
-            throws InvocationTargetException,
-            IllegalAccessException,
-            TemplateModelException {
+            throws InvocationTargetException, IllegalAccessException, TemplateException {
         // [2.4]: Java's Method.invoke truncates numbers if the target type has not enough bits to hold the value.
         // There should at least be an option to check this.
         Object retval = method.invoke(object, args);
@@ -1049,12 +1047,11 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
      * @return The instance created; it's not wrapped into {@link TemplateModel}.
      */
     public Object newInstance(Class<?> clazz, TemplateModel[] args, CallPlace callPlace)
-            throws TemplateModelException {
+            throws TemplateException {
         try {
             Object ctors = classIntrospector.get(clazz).get(ClassIntrospector.CONSTRUCTORS_KEY);
             if (ctors == null) {
-                throw new TemplateModelException("Class " + clazz.getName() +
-                        " has no public constructors.");
+                throw new TemplateException("Class " + clazz.getName() + " has no public constructors.");
             }
             Constructor<?> ctor = null;
             Object[] pojoArgs;
@@ -1065,7 +1062,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
                 try {
                     return ctor.newInstance(pojoArgs);
                 } catch (Exception e) {
-                    throw _MethodUtils.newInvocationTemplateModelException(null, ctor, e);
+                    throw _MethodUtils.newInvocationTemplateException(null, ctor, e);
                 }
             } else if (ctors instanceof OverloadedMethods) {
                 // TODO [FM3] Utilize optional java type info in callPlace for overloaded method selection
@@ -1073,18 +1070,18 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
                 try {
                     return mma.invokeConstructor(this);
                 } catch (Exception e) {
-                    if (e instanceof TemplateModelException) throw (TemplateModelException) e;
+                    if (e instanceof TemplateException) throw (TemplateException) e;
 
-                    throw _MethodUtils.newInvocationTemplateModelException(null, mma.getCallableMemberDescriptor(), e);
+                    throw _MethodUtils.newInvocationTemplateException(null, mma.getCallableMemberDescriptor(), e);
                 }
             } else {
                 // Cannot happen
                 throw new BugException();
             }
-        } catch (TemplateModelException e) {
+        } catch (TemplateException e) {
             throw e;
         } catch (Exception e) {
-            throw new TemplateModelException(
+            throw new TemplateException(
                     "Error while creating new instance of class " + clazz.getName() + "; see cause exception", e);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultUnassignableIteratorAdapter.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultUnassignableIteratorAdapter.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultUnassignableIteratorAdapter.java
index c87c21f..c87f3f7 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultUnassignableIteratorAdapter.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultUnassignableIteratorAdapter.java
@@ -21,9 +21,9 @@ package org.apache.freemarker.core.model.impl;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateModelIterator;
 
 /**
@@ -43,16 +43,16 @@ class DefaultUnassignableIteratorAdapter implements TemplateModelIterator {
     }
 
     @Override
-    public TemplateModel next() throws TemplateModelException {
+    public TemplateModel next() throws TemplateException {
         try {
             return wrapper.wrap(it.next());
         } catch (NoSuchElementException e) {
-            throw new TemplateModelException("The collection has no more items.", e);
+            throw new TemplateException("The collection has no more items.", e);
         }
     }
 
     @Override
-    public boolean hasNext() throws TemplateModelException {
+    public boolean hasNext() throws TemplateException {
         return it.hasNext();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/HashAdapter.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/HashAdapter.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/HashAdapter.java
index add437a..d829f6b 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/HashAdapter.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/HashAdapter.java
@@ -25,11 +25,11 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateHashModelEx;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelAdapter;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateModelIterator;
 import org.apache.freemarker.core.util.UndeclaredThrowableException;
 
@@ -55,7 +55,7 @@ class HashAdapter extends AbstractMap implements TemplateModelAdapter {
     public boolean isEmpty() {
         try {
             return model.isEmpty();
-        } catch (TemplateModelException e) {
+        } catch (TemplateException e) {
             throw new UndeclaredThrowableException(e);
         }
     }
@@ -64,7 +64,7 @@ class HashAdapter extends AbstractMap implements TemplateModelAdapter {
     public Object get(Object key) {
         try {
             return wrapper.unwrap(model.get(String.valueOf(key)));
-        } catch (TemplateModelException e) {
+        } catch (TemplateException e) {
             throw new UndeclaredThrowableException(e);
         }
     }
@@ -89,7 +89,7 @@ class HashAdapter extends AbstractMap implements TemplateModelAdapter {
                 final TemplateModelIterator i;
                 try {
                      i = getModelEx().keys().iterator();
-                } catch (TemplateModelException e) {
+                } catch (TemplateException e) {
                     throw new UndeclaredThrowableException(e);
                 }
                 return new Iterator() {
@@ -97,7 +97,7 @@ class HashAdapter extends AbstractMap implements TemplateModelAdapter {
                     public boolean hasNext() {
                         try {
                             return i.hasNext();
-                        } catch (TemplateModelException e) {
+                        } catch (TemplateException e) {
                             throw new UndeclaredThrowableException(e);
                         }
                     }
@@ -107,7 +107,7 @@ class HashAdapter extends AbstractMap implements TemplateModelAdapter {
                         final Object key;
                         try {
                             key = wrapper.unwrap(i.next());
-                        } catch (TemplateModelException e) {
+                        } catch (TemplateException e) {
                             throw new UndeclaredThrowableException(e);
                         }
                         return new Map.Entry() {
@@ -162,7 +162,7 @@ class HashAdapter extends AbstractMap implements TemplateModelAdapter {
             public int size() {
                 try {
                     return getModelEx().size();
-                } catch (TemplateModelException e) {
+                } catch (TemplateException e) {
                     throw new UndeclaredThrowableException(e);
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/InvalidPropertyException.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/InvalidPropertyException.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/InvalidPropertyException.java
index ff73a05..b14c6b9 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/InvalidPropertyException.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/InvalidPropertyException.java
@@ -19,14 +19,14 @@
 
 package org.apache.freemarker.core.model.impl;
 
-import org.apache.freemarker.core.model.TemplateModelException;
+import org.apache.freemarker.core.TemplateException;
 
 /**
  * An exception thrown when there is an attempt to access
  * an invalid bean property when we are in a "strict bean" mode
  */
 
-public class InvalidPropertyException extends TemplateModelException {
+public class InvalidPropertyException extends TemplateException {
 	
     public InvalidPropertyException(String description) {
         super(description);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MapKeyValuePairIterator.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MapKeyValuePairIterator.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MapKeyValuePairIterator.java
index 00e6608..80b6aa5 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MapKeyValuePairIterator.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MapKeyValuePairIterator.java
@@ -22,12 +22,13 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Map.Entry;
 
+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.TemplateHashModelEx2;
 import org.apache.freemarker.core.model.TemplateHashModelEx2.KeyValuePair;
 import org.apache.freemarker.core.model.TemplateHashModelEx2.KeyValuePairIterator;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 
 /**
  *  Implementation of {@link KeyValuePairIterator} for a {@link TemplateHashModelEx2} that wraps or otherwise uses a
@@ -56,19 +57,19 @@ public class MapKeyValuePairIterator implements KeyValuePairIterator {
         return new KeyValuePair() {
 
             @Override
-            public TemplateModel getKey() throws TemplateModelException {
+            public TemplateModel getKey() throws TemplateException {
                 return wrap(entry.getKey());
             }
 
             @Override
-            public TemplateModel getValue() throws TemplateModelException {
+            public TemplateModel getValue() throws TemplateException {
                 return wrap(entry.getValue());
             }
             
         };
     }
     
-    private TemplateModel wrap(Object obj) throws TemplateModelException {
+    private TemplateModel wrap(Object obj) throws ObjectWrappingException {
         return (obj instanceof TemplateModel) ? (TemplateModel) obj : objectWrapper.wrap(obj);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MemberAndArguments.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MemberAndArguments.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MemberAndArguments.java
index 3a37d9d..ac96d67 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MemberAndArguments.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MemberAndArguments.java
@@ -21,8 +21,8 @@ package org.apache.freemarker.core.model.impl;
 
 import java.lang.reflect.InvocationTargetException;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 
 /**
  */
@@ -47,13 +47,13 @@ class MemberAndArguments extends MaybeEmptyMemberAndArguments {
     }
     
     TemplateModel invokeMethod(DefaultObjectWrapper ow, Object obj)
-            throws TemplateModelException, InvocationTargetException, IllegalAccessException {
+            throws TemplateException, InvocationTargetException, IllegalAccessException {
         return callableMemberDesc.invokeMethod(ow, obj, args);
     }
 
     Object invokeConstructor(DefaultObjectWrapper ow)
             throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException,
-            TemplateModelException {
+            TemplateException {
         return callableMemberDesc.invokeConstructor(ow, args);
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedFixArgsMethods.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedFixArgsMethods.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedFixArgsMethods.java
index 7f57c68..c0d53c2 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedFixArgsMethods.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedFixArgsMethods.java
@@ -18,10 +18,10 @@
  */
 package org.apache.freemarker.core.model.impl;
 
-import org.apache.freemarker.core.util.CallableUtils;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.ObjectWrapperAndUnwrapper;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
+import org.apache.freemarker.core.util.CallableUtils;
 
 /**
  * Stores the non-varargs methods for a {@link OverloadedMethods} object.
@@ -44,7 +44,7 @@ class OverloadedFixArgsMethods extends OverloadedMethodsSubset {
 
     @Override
     MaybeEmptyMemberAndArguments getMemberAndArguments(TemplateModel[] tmArgs, DefaultObjectWrapper unwrapper)
-    throws TemplateModelException {
+    throws TemplateException {
         if (tmArgs == null) {
             // null is treated as empty args
             tmArgs = CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedJavaMethodModel.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedJavaMethodModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedJavaMethodModel.java
index 17d82a8..a1451e8 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedJavaMethodModel.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedJavaMethodModel.java
@@ -26,7 +26,6 @@ import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.ArgumentArrayLayout;
 import org.apache.freemarker.core.model.TemplateFunctionModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 
 /**
  * Wraps a set of same-name overloaded methods behind {@link TemplateFunctionModel} interface,
@@ -57,20 +56,20 @@ class OverloadedJavaMethodModel implements JavaMethodModel {
      * implementation. The actual method to call from several overloaded methods will be chosen based on the classes of
      * the arguments.
      *
-     * @throws TemplateModelException
+     * @throws TemplateException
      *         if the method cannot be chosen unambiguously.
      */
     @Override
     public TemplateModel execute(TemplateModel[] args, CallPlace callPlace, Environment envUnused)
-            throws TemplateModelException {
+            throws TemplateException {
         // TODO [FM3] Utilize optional java type info in callPlace for overloaded method selection
         MemberAndArguments maa = overloadedMethods.getMemberAndArguments(args, wrapper);
         try {
             return maa.invokeMethod(wrapper, object);
         } catch (Exception e) {
-            if (e instanceof TemplateModelException) throw (TemplateModelException) e;
+            if (e instanceof TemplateException) throw (TemplateException) e;
             
-            throw _MethodUtils.newInvocationTemplateModelException(
+            throw _MethodUtils.newInvocationTemplateException(
                     object,
                     maa.getCallableMemberDescriptor(),
                     e);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedMethods.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedMethods.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedMethods.java
index fc1c344..8fe7558 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedMethods.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedMethods.java
@@ -24,12 +24,11 @@ import java.lang.reflect.Method;
 import java.util.HashSet;
 import java.util.Iterator;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core._DelayedConversionToString;
 import org.apache.freemarker.core._ErrorDescriptionBuilder;
-import org.apache.freemarker.core._TemplateModelException;
 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.util.TemplateLanguageUtils;
 import org.apache.freemarker.core.util._ClassUtils;
 
@@ -87,7 +86,7 @@ final class OverloadedMethods {
     }
     
     MemberAndArguments getMemberAndArguments(TemplateModel[] tmArgs, DefaultObjectWrapper unwrapper)
-    throws TemplateModelException {
+    throws TemplateException {
         // Try to find a fixed args match:
         MaybeEmptyMemberAndArguments fixArgsRes = fixArgMethods.getMemberAndArguments(tmArgs, unwrapper);
         if (fixArgsRes instanceof MemberAndArguments) {
@@ -113,7 +112,7 @@ final class OverloadedMethods {
                 "\nThe matching overload was searched among these members:\n",
                 memberListToString());
         addMarkupBITipAfterNoNoMarchIfApplicable(edb, tmArgs);
-        throw new _TemplateModelException(edb);
+        throw new TemplateException(edb);
     }
 
     String getMethodName() {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedMethodsSubset.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedMethodsSubset.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedMethodsSubset.java
index b91f9a6..e7f5a81 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedMethodsSubset.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedMethodsSubset.java
@@ -27,8 +27,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.util._ClassUtils;
 import org.apache.freemarker.core.util._NullArgumentException;
 
@@ -154,7 +154,7 @@ abstract class OverloadedMethodsSubset {
     abstract void afterWideningUnwrappingHints(Class<?>[] paramTypes, int[] paramNumericalTypes);
     
     abstract MaybeEmptyMemberAndArguments getMemberAndArguments(TemplateModel[] tmArgs,
-            DefaultObjectWrapper unwrapper) throws TemplateModelException;
+            DefaultObjectWrapper unwrapper) throws TemplateException;
 
     /**
      * Returns the most specific common class (or interface) of two parameter types for the purpose of unwrapping.

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedVarArgsMethods.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedVarArgsMethods.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedVarArgsMethods.java
index fd5c5ee..7e87909 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedVarArgsMethods.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedVarArgsMethods.java
@@ -20,11 +20,11 @@ package org.apache.freemarker.core.model.impl;
 
 import java.lang.reflect.Array;
 
-import org.apache.freemarker.core.util.CallableUtils;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.ObjectWrapperAndUnwrapper;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.util.BugException;
+import org.apache.freemarker.core.util.CallableUtils;
 
 /**
  * Stores the varargs methods for a {@link OverloadedMethods} object.
@@ -136,7 +136,7 @@ class OverloadedVarArgsMethods extends OverloadedMethodsSubset {
     
     @Override
     MaybeEmptyMemberAndArguments getMemberAndArguments(TemplateModel[] tmArgs, DefaultObjectWrapper unwrapper)
-    throws TemplateModelException {
+    throws TemplateException {
         if (tmArgs == null) {
             // null is treated as empty args
             tmArgs = CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY;
@@ -208,7 +208,7 @@ class OverloadedVarArgsMethods extends OverloadedMethodsSubset {
      */
     private Object replaceVarargsSectionWithArray(
             Object[] args, TemplateModel[] tmArgs, CallableMemberDescriptor memberDesc, DefaultObjectWrapper unwrapper)
-            throws TemplateModelException {
+            throws TemplateException {
         final Class<?>[] paramTypes = memberDesc.getParamTypes();
         final int paramCount = paramTypes.length;
         final Class<?> varArgsCompType = paramTypes[paramCount - 1].getComponentType();

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ReflectionCallableMemberDescriptor.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ReflectionCallableMemberDescriptor.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ReflectionCallableMemberDescriptor.java
index afa1cb1..5ae537f 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ReflectionCallableMemberDescriptor.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ReflectionCallableMemberDescriptor.java
@@ -25,8 +25,8 @@ import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 
 /**
  * The most commonly used {@link CallableMemberDescriptor} implementation. 
@@ -52,7 +52,7 @@ final class ReflectionCallableMemberDescriptor extends CallableMemberDescriptor
 
     @Override
     TemplateModel invokeMethod(DefaultObjectWrapper ow, Object obj, Object[] args)
-            throws TemplateModelException, InvocationTargetException, IllegalAccessException {
+            throws TemplateException, InvocationTargetException, IllegalAccessException {
         return ow.invokeMethod(obj, (Method) member, args);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ResourceBundleModel.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ResourceBundleModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ResourceBundleModel.java
index b5fb41c..aaf3702 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ResourceBundleModel.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ResourceBundleModel.java
@@ -30,13 +30,11 @@ import java.util.Set;
 import org.apache.freemarker.core.CallPlace;
 import org.apache.freemarker.core.Environment;
 import org.apache.freemarker.core.TemplateException;
-import org.apache.freemarker.core.util.CallableUtils;
 import org.apache.freemarker.core._DelayedJQuote;
-import org.apache.freemarker.core._TemplateModelException;
 import org.apache.freemarker.core.model.ArgumentArrayLayout;
 import org.apache.freemarker.core.model.TemplateFunctionModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
+import org.apache.freemarker.core.util.CallableUtils;
 
 /**
  * <p>A hash model that wraps a resource bundle. Makes it convenient to store
@@ -66,11 +64,11 @@ public class ResourceBundleModel extends BeanModel implements TemplateFunctionMo
      */
     @Override
     protected TemplateModel invokeGenericGet(Map keyMap, Class clazz, String key)
-    throws TemplateModelException {
+    throws TemplateException {
         try {
             return wrap(((ResourceBundle) object).getObject(key));
         } catch (MissingResourceException e) {
-            throw new _TemplateModelException(e,
+            throw new TemplateException(e,
                     "No ", new _DelayedJQuote(key), " key in the ResourceBundle. "
                     + "Note that conforming to the ResourceBundle Java API, this is an error and not just "
                     + "a missing sub-variable (a null).");
@@ -127,9 +125,10 @@ public class ResourceBundleModel extends BeanModel implements TemplateFunctionMo
             // Invoke format
             return new BeanAndStringModel(format(key, params), wrapper);
         } catch (MissingResourceException e) {
-            throw new TemplateModelException("No such key: " + key);
+            throw CallableUtils.newGenericExecuteException(this, "No such key: " + key,  e);
         } catch (Exception e) {
-            throw new TemplateModelException(e.getMessage());
+            throw CallableUtils.newGenericExecuteException(this,
+                    "Failed to get or format message; see cause exception",  e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/RestrictedObjectWrapper.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/RestrictedObjectWrapper.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/RestrictedObjectWrapper.java
index c655b93..46347c4 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/RestrictedObjectWrapper.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/RestrictedObjectWrapper.java
@@ -25,9 +25,9 @@ import java.util.Map;
 import java.util.WeakHashMap;
 
 import org.apache.freemarker.core.Version;
+import org.apache.freemarker.core.model.ObjectWrappingException;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 
 /**
  * A restricted version of {@link DefaultObjectWrapper} that doesn't expose arbitrary object, just those that directly
@@ -45,14 +45,15 @@ public class RestrictedObjectWrapper extends DefaultObjectWrapper {
      * In this implementation, this just throws an exception.
      */
     @Override
-    protected TemplateModel wrapGenericObject(Object obj) throws TemplateModelException {
-        throw new TemplateModelException("RestrictedObjectWrapper deliberately won't wrap this type: "
+    protected TemplateModel wrapGenericObject(Object obj) throws ObjectWrappingException {
+        throw new ObjectWrappingException("RestrictedObjectWrapper deliberately won't wrap this type: "
                 + obj.getClass().getName());
     }
 
     @Override
-    public TemplateHashModel wrapAsAPI(Object obj) throws TemplateModelException {
-        throw new TemplateModelException("RestrictedObjectWrapper deliberately doesn't allow ?api.");
+    public TemplateHashModel wrapAsAPI(Object obj) throws ObjectWrappingException {
+        throw new ObjectWrappingException(
+                RestrictedObjectWrapper.class.getName() + " doesn't allow ?api.");
     }
 
     protected static abstract class ExtendableBuilder<

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SequenceAdapter.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SequenceAdapter.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SequenceAdapter.java
index e9b6156..b7a9136 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SequenceAdapter.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SequenceAdapter.java
@@ -21,9 +21,9 @@ package org.apache.freemarker.core.model.impl;
 
 import java.util.AbstractList;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelAdapter;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateSequenceModel;
 import org.apache.freemarker.core.util.UndeclaredThrowableException;
 
@@ -47,7 +47,7 @@ class SequenceAdapter extends AbstractList implements TemplateModelAdapter {
     public int size() {
         try {
             return model.size();
-        } catch (TemplateModelException e) {
+        } catch (TemplateException e) {
             throw new UndeclaredThrowableException(e);
         }
     }
@@ -56,7 +56,7 @@ class SequenceAdapter extends AbstractList implements TemplateModelAdapter {
     public Object get(int index) {
         try {
             return wrapper.unwrap(model.get(index));
-        } catch (TemplateModelException e) {
+        } catch (TemplateException e) {
             throw new UndeclaredThrowableException(e);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleCollection.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleCollection.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleCollection.java
index cf399ab..012beb6 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleCollection.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleCollection.java
@@ -23,10 +23,10 @@ import java.io.Serializable;
 import java.util.Collection;
 import java.util.Iterator;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 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.WrappingTemplateModel;
 
@@ -70,7 +70,7 @@ implements TemplateCollectionModel, Serializable {
      * <p>When you wrap an <tt>Iterator</tt> and you get <tt>TemplateModelIterator</tt> for multiple times,
      * only one of the returned <tt>TemplateModelIterator</tt> instances can be really used. When you have called a
      * method of a <tt>TemplateModelIterator</tt> instance, all other instance will throw a
-     * <tt>TemplateModelException</tt> when you try to call their methods, since the wrapped <tt>Iterator</tt>
+     * {@link TemplateException} when you try to call their methods, since the wrapped <tt>Iterator</tt>
      * can't return the first element anymore.
      */
     @Override
@@ -97,7 +97,7 @@ implements TemplateCollectionModel, Serializable {
         }
 
         @Override
-        public TemplateModel next() throws TemplateModelException {
+        public TemplateModel next() throws TemplateException {
             if (!iteratorOwnedByMe) { 
                 synchronized (SimpleCollection.this) {
                     checkIteratorNotOwned();
@@ -107,7 +107,7 @@ implements TemplateCollectionModel, Serializable {
             }
             
             if (!iterator.hasNext()) {
-                throw new TemplateModelException("The collection has no more items.");
+                throw new TemplateException("The collection has no more items.");
             }
             
             Object value  = iterator.next();
@@ -115,7 +115,7 @@ implements TemplateCollectionModel, Serializable {
         }
 
         @Override
-        public boolean hasNext() throws TemplateModelException {
+        public boolean hasNext() throws TemplateException {
             // Calling hasNext may looks safe, but I have met sync. problems.
             if (!iteratorOwnedByMe) {
                 synchronized (SimpleCollection.this) {
@@ -126,9 +126,9 @@ implements TemplateCollectionModel, Serializable {
             return iterator.hasNext();
         }
         
-        private void checkIteratorNotOwned() throws TemplateModelException {
+        private void checkIteratorNotOwned() throws TemplateException {
             if (iteratorOwned) {
-                throw new TemplateModelException(
+                throw new TemplateException(
                         "This collection value wraps a java.util.Iterator, thus it can be listed only once.");
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java
index ba61df4..df2f6ae 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java
@@ -26,15 +26,14 @@ import java.util.Map;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core._DelayedJQuote;
-import org.apache.freemarker.core._TemplateModelException;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.TemplateBooleanModel;
 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;
 
 /**
@@ -165,16 +164,16 @@ public class SimpleHash extends WrappingTemplateModel implements TemplateHashMod
     }
 
     @Override
-    public TemplateModel get(String key) throws TemplateModelException {
+    public TemplateModel get(String key) throws TemplateException {
         Object result;
         try {
             result = map.get(key);
         } catch (ClassCastException e) {
-            throw new _TemplateModelException(e,
+            throw new TemplateException(e,
                     "ClassCastException while getting Map entry with String key ",
                     new _DelayedJQuote(key));
         } catch (NullPointerException e) {
-            throw new _TemplateModelException(e,
+            throw new TemplateException(e,
                     "NullPointerException while getting Map entry with String key ",
                     new _DelayedJQuote(key));
         }
@@ -195,11 +194,11 @@ public class SimpleHash extends WrappingTemplateModel implements TemplateHashMod
                         putKey = charKey;
                     }
                 } catch (ClassCastException e) {
-                    throw new _TemplateModelException(e,
+                    throw new TemplateException(e,
                             "ClassCastException while getting Map entry with Character key ",
                             new _DelayedJQuote(key));
                 } catch (NullPointerException e) {
-                    throw new _TemplateModelException(e,
+                    throw new TemplateException(e,
                             "NullPointerException while getting Map entry with Character key ",
                             new _DelayedJQuote(key));
                 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleJavaMethodModel.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleJavaMethodModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleJavaMethodModel.java
index 727c9e3..1862ba5 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleJavaMethodModel.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleJavaMethodModel.java
@@ -29,7 +29,6 @@ import org.apache.freemarker.core._UnexpectedTypeErrorExplainerTemplateModel;
 import org.apache.freemarker.core.model.ArgumentArrayLayout;
 import org.apache.freemarker.core.model.TemplateFunctionModel;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 
 /**
  * Wraps a {@link Method} into the {@link TemplateFunctionModel} interface. It is used by {@link BeanModel} to wrap
@@ -69,10 +68,10 @@ public final class SimpleJavaMethodModel extends SimpleMethod implements JavaMet
             TemplateException {
         try {
             return wrapper.invokeMethod(object, (Method) getMember(), unwrapArguments(args, wrapper));
-        } catch (TemplateModelException e) {
+        } catch (TemplateException e) {
             throw e;
         } catch (Exception e) {
-            throw _MethodUtils.newInvocationTemplateModelException(object, getMember(), e);
+            throw _MethodUtils.newInvocationTemplateException(object, getMember(), e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java
index 78c624c..afe19c0 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java
@@ -21,15 +21,14 @@ package org.apache.freemarker.core.model.impl;
 import java.lang.reflect.Array;
 import java.lang.reflect.Member;
 
-import org.apache.freemarker.core.util.CallableUtils;
-import org.apache.freemarker.core._DelayedTemplateLanguageTypeDescription;
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core._DelayedOrdinal;
+import org.apache.freemarker.core._DelayedTemplateLanguageTypeDescription;
 import org.apache.freemarker.core._ErrorDescriptionBuilder;
-import org.apache.freemarker.core._TemplateModelException;
 import org.apache.freemarker.core.model.ObjectWrapperAndUnwrapper;
 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.util.CallableUtils;
 import org.apache.freemarker.core.util._ClassUtils;
 
 /**
@@ -50,7 +49,7 @@ class SimpleMethod {
         this.argTypes = argTypes;
     }
     
-    Object[] unwrapArguments(TemplateModel[] args, DefaultObjectWrapper wrapper) throws TemplateModelException {
+    Object[] unwrapArguments(TemplateModel[] args, DefaultObjectWrapper wrapper) throws TemplateException {
         if (args == null) {
             args = CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY;
         }
@@ -58,14 +57,14 @@ class SimpleMethod {
         int typesLen = argTypes.length;
         if (isVarArg) {
             if (typesLen - 1 > args.length) {
-                throw new _TemplateModelException(
+                throw new TemplateException(
                         _MethodUtils.invocationErrorMessageStart(member),
                         " takes at least ", typesLen - 1,
                         typesLen - 1 == 1 ? " argument" : " arguments", ", but ",
                         args.length, " was given.");
             }
         } else if (typesLen != args.length) {
-            throw new _TemplateModelException(
+            throw new TemplateException(
                     _MethodUtils.invocationErrorMessageStart(member),
                     " takes ", typesLen, typesLen == 1 ? " argument" : " arguments", ", but ",
                     args.length, " was given.");
@@ -76,7 +75,7 @@ class SimpleMethod {
 
     private Object[] unwrapArguments(TemplateModel[] args, Class<?>[] argTypes, boolean isVarargs,
             DefaultObjectWrapper w)
-    throws TemplateModelException {
+    throws TemplateException {
         if (args == null) return null;
         
         int typesLen = argTypes.length;
@@ -145,7 +144,7 @@ class SimpleMethod {
         return unwrappedArgs;
     }
 
-    private TemplateModelException createArgumentTypeMismatchException(
+    private TemplateException createArgumentTypeMismatchException(
             int argIdx, TemplateModel argVal, Class<?> targetType) {
         _ErrorDescriptionBuilder desc = new _ErrorDescriptionBuilder(
                 _MethodUtils.invocationErrorMessageStart(member), " couldn't be called: Can't convert the ",
@@ -155,11 +154,11 @@ class SimpleMethod {
         if (argVal instanceof TemplateMarkupOutputModel && (targetType.isAssignableFrom(String.class))) {
             desc.tip(MARKUP_OUTPUT_TO_STRING_TIP);
         }
-        return new _TemplateModelException(desc);
+        return new TemplateException(desc);
     }
 
-    private TemplateModelException createNullToPrimitiveArgumentException(int argIdx, Class<?> targetType) {
-        return new _TemplateModelException(
+    private TemplateException createNullToPrimitiveArgumentException(int argIdx, Class<?> targetType) {
+        return new TemplateException(
                 _MethodUtils.invocationErrorMessageStart(member), " couldn't be called: The value of the ",
                 new _DelayedOrdinal(argIdx + 1),
                 " argument was null, but the target Java parameter type (", _ClassUtils.getShortClassName(targetType),

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleSequence.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleSequence.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleSequence.java
index be48318..e0e0397 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleSequence.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleSequence.java
@@ -23,9 +23,9 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.ObjectWrapper;
 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.WrappingTemplateModel;
 
@@ -132,7 +132,7 @@ public class SimpleSequence extends WrappingTemplateModel implements TemplateSeq
      * it to one now, and writes it back into the backing list.
      */
     @Override
-    public TemplateModel get(int index) throws TemplateModelException {
+    public TemplateModel get(int index) throws TemplateException {
         try {
             Object value = list.get(index);
             if (value instanceof TemplateModel) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d73da6da/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java
index fc32348..12ecbc3 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java
@@ -26,11 +26,11 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 import org.apache.freemarker.core.model.TemplateFunctionModel;
 import org.apache.freemarker.core.model.TemplateHashModelEx;
 import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -48,7 +48,7 @@ final class StaticModel implements TemplateHashModelEx {
     private final DefaultObjectWrapper wrapper;
     private final Map map = new HashMap();
 
-    StaticModel(Class clazz, DefaultObjectWrapper wrapper) throws TemplateModelException {
+    StaticModel(Class clazz, DefaultObjectWrapper wrapper) throws TemplateException {
         this.clazz = clazz;
         this.wrapper = wrapper;
         populate();
@@ -59,7 +59,7 @@ final class StaticModel implements TemplateHashModelEx {
      * parameter.
      */
     @Override
-    public TemplateModel get(String key) throws TemplateModelException {
+    public TemplateModel get(String key) throws TemplateException {
         Object model = map.get(key);
         // Simple method, overloaded method or final field -- these have cached 
         // template models
@@ -70,12 +70,12 @@ final class StaticModel implements TemplateHashModelEx {
             try {
                 return wrapper.getOuterIdentity().wrap(((Field) model).get(null));
             } catch (IllegalAccessException e) {
-                throw new TemplateModelException(
+                throw new TemplateException(
                     "Illegal access for field " + key + " of class " + clazz.getName());
             }
         }
 
-        throw new TemplateModelException(
+        throw new TemplateException(
             "No such key: " + key + " in class " + clazz.getName());
     }
 
@@ -94,18 +94,18 @@ final class StaticModel implements TemplateHashModelEx {
     }
     
     @Override
-    public TemplateCollectionModel keys() throws TemplateModelException {
+    public TemplateCollectionModel keys() throws TemplateException {
         return (TemplateCollectionModel) wrapper.getOuterIdentity().wrap(map.keySet());
     }
     
     @Override
-    public TemplateCollectionModel values() throws TemplateModelException {
+    public TemplateCollectionModel values() throws TemplateException {
         return (TemplateCollectionModel) wrapper.getOuterIdentity().wrap(map.values());
     }
 
-    private void populate() throws TemplateModelException {
+    private void populate() throws TemplateException {
         if (!Modifier.isPublic(clazz.getModifiers())) {
-            throw new TemplateModelException(
+            throw new TemplateException(
                 "Can't wrap the non-public class " + clazz.getName());
         }
         



Mime
View raw message