You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2017/08/25 23:39:39 UTC

[13/19] incubator-freemarker git commit: Error message fix for ?chunk

Error message fix for ?chunk


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

Branch: refs/heads/2.3
Commit: 0213afa5f5d154db1bde5c1d74d2d206eff14877
Parents: 05dc385
Author: ddekany <dd...@apache.org>
Authored: Fri Aug 25 23:48:18 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Fri Aug 25 23:48:18 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/BuiltInsForSequences.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/0213afa5/src/main/java/freemarker/core/BuiltInsForSequences.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/BuiltInsForSequences.java b/src/main/java/freemarker/core/BuiltInsForSequences.java
index 609f53e..eca5fec 100644
--- a/src/main/java/freemarker/core/BuiltInsForSequences.java
+++ b/src/main/java/freemarker/core/BuiltInsForSequences.java
@@ -64,6 +64,9 @@ class BuiltInsForSequences {
             public Object exec(List args) throws TemplateModelException {
                 checkMethodArgCount(args, 1, 2);
                 int chunkSize = getNumberMethodArg(args, 0).intValue();
+                if (chunkSize < 1) {
+                    throw new _TemplateModelException("The 1st argument to ?", key, " (...) must be at least 1.");
+                }
                 
                 return new ChunkedSequence(
                         tsm,
@@ -85,9 +88,6 @@ class BuiltInsForSequences {
             private ChunkedSequence(
                     TemplateSequenceModel wrappedTsm, int chunkSize, TemplateModel fillerItem)
                     throws TemplateModelException {
-                if (chunkSize < 1) {
-                    throw new _TemplateModelException("The 1st argument to ?', key, ' (...) must be at least 1.");
-                }
                 this.wrappedTsm = wrappedTsm;
                 this.chunkSize = chunkSize;
                 this.fillerItem = fillerItem;