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:27 UTC
[01/19] incubator-freemarker git commit: Fix grammar in
InvalidReferenceException tip
Repository: incubator-freemarker
Updated Branches:
refs/heads/2.3 a5fb3511f -> b25782910
Fix grammar in InvalidReferenceException tip
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/732fe766
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/732fe766
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/732fe766
Branch: refs/heads/2.3
Commit: 732fe7660b5c7f4067c32ae823f70905086fa151
Parents: 16ff174
Author: Simon Lammer <la...@gmail.com>
Authored: Thu Aug 3 13:23:27 2017 +0200
Committer: GitHub <no...@github.com>
Committed: Thu Aug 3 13:23:27 2017 +0200
----------------------------------------------------------------------
src/main/java/freemarker/core/InvalidReferenceException.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/732fe766/src/main/java/freemarker/core/InvalidReferenceException.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/InvalidReferenceException.java b/src/main/java/freemarker/core/InvalidReferenceException.java
index 6f64942..791263b 100644
--- a/src/main/java/freemarker/core/InvalidReferenceException.java
+++ b/src/main/java/freemarker/core/InvalidReferenceException.java
@@ -42,7 +42,7 @@ public class InvalidReferenceException extends TemplateException {
}
private static final Object[] TIP = {
- "If the failing expression is known to be legally refer to something that's sometimes null or missing, "
+ "If the failing expression is known to legally refer to something that's sometimes null or missing, "
+ "either specify a default value like myOptionalVar!myDefault, or use ",
"<#if myOptionalVar??>", "when-present", "<#else>", "when-missing", "</#if>",
". (These only cover the last step of the expression; to cover the whole expression, "
[18/19] incubator-freemarker git commit: Bug fixed: BeansWrapper and
DefaultObjectWrapper, starting from Java 8,
when the same JavaBeans property has both non-indexed read method (like
String[] getFoo()) and indexed read method (like String getFoo(int in
Posted by dd...@apache.org.
Bug fixed: BeansWrapper and DefaultObjectWrapper, starting from Java 8, when the same JavaBeans property has both non-indexed read method (like String[] getFoo()) and indexed read method (like String getFoo(int index)), has mistakenly used the indexed read method to access the property. This is a problem because then the array size was unknown, and thus the property has suddenly become unlistable on Java 8. To enable the fix (where it will use the non-indexed read method), you have to increase the value of the incompatibleImprovements constructor argument of the used DefaultObjectWrapper or BeansWrapper to 2.3.27. Note that if you leave the object_wrapper setting of the Configuration on its default, it's enough to increase the incompatibleImprovements setting of the Configuration to 2.3.27, as that's inherited by the default object_wrapper. Note that this bug haven't surfaced before Java 8, as then java.beans.Inrospector has only exposed the non-indexed method when both kind of read
method was present.
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/a4a406a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/a4a406a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/a4a406a1
Branch: refs/heads/2.3
Commit: a4a406a1d2e7a994ea589a9e6efe5d7575f69da4
Parents: ce4b9e4
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 26 01:37:32 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 26 01:37:32 2017 +0200
----------------------------------------------------------------------
.../java/freemarker/ext/beans/BeanModel.java | 16 ++++--
.../java/freemarker/ext/beans/BeansWrapper.java | 14 ++++-
.../freemarker/ext/beans/SimpleMethodModel.java | 21 ++++---
.../java/freemarker/template/Configuration.java | 11 +++-
.../java/freemarker/template/_TemplateAPI.java | 1 +
src/manual/en_US/book.xml | 27 +++++++++
.../ext/beans/BeansWrapperMiscTest.java | 58 +++++++++++++++++++-
.../template/DefaultObjectWrapperTest.java | 2 +-
8 files changed, 134 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a4a406a1/src/main/java/freemarker/ext/beans/BeanModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/ext/beans/BeanModel.java b/src/main/java/freemarker/ext/beans/BeanModel.java
index 8ec19ea..312ec98 100644
--- a/src/main/java/freemarker/ext/beans/BeanModel.java
+++ b/src/main/java/freemarker/ext/beans/BeanModel.java
@@ -50,6 +50,7 @@ import freemarker.template.TemplateModelException;
import freemarker.template.TemplateModelIterator;
import freemarker.template.TemplateModelWithAPISupport;
import freemarker.template.TemplateScalarModel;
+import freemarker.template._TemplateAPI;
import freemarker.template.utility.StringUtil;
/**
@@ -219,10 +220,17 @@ implements
TemplateModel resultModel = UNKNOWN;
if (desc instanceof IndexedPropertyDescriptor) {
- Method readMethod = ((IndexedPropertyDescriptor) desc).getIndexedReadMethod();
- resultModel = cachedModel =
- new SimpleMethodModel(object, readMethod,
- ClassIntrospector.getArgTypes(classInfo, readMethod), wrapper);
+ IndexedPropertyDescriptor pd = (IndexedPropertyDescriptor) desc;
+ if (wrapper.getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_27
+ && pd.getReadMethod() != null) {
+ resultModel = wrapper.invokeMethod(object, pd.getReadMethod(), null);
+ // cachedModel remains null, as we don't cache these
+ } else {
+ Method readMethod = pd.getIndexedReadMethod();
+ resultModel = cachedModel =
+ new SimpleMethodModel(object, readMethod,
+ ClassIntrospector.getArgTypes(classInfo, readMethod), wrapper);
+ }
} else if (desc instanceof PropertyDescriptor) {
PropertyDescriptor pd = (PropertyDescriptor) desc;
resultModel = wrapper.invokeMethod(object, pd.getReadMethod(), null);
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a4a406a1/src/main/java/freemarker/ext/beans/BeansWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/ext/beans/BeansWrapper.java b/src/main/java/freemarker/ext/beans/BeansWrapper.java
index f108ad6..ea9158d 100644
--- a/src/main/java/freemarker/ext/beans/BeansWrapper.java
+++ b/src/main/java/freemarker/ext/beans/BeansWrapper.java
@@ -19,6 +19,7 @@
package freemarker.ext.beans;
+import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Array;
@@ -247,6 +248,16 @@ public class BeansWrapper implements RichObjectWrapper, WriteProtectable {
* {@code true}. Thus, Java 8 default methods (and the bean properties they define) are exposed, despite that
* {@link java.beans.Introspector} (the official JavaBeans introspector) ignores them, at least as of Java 8.
* </li>
+ * <li>
+ * <p>2.3.27 (or higher):
+ * If the same JavaBean property has both an indexed property reader (like {@code String getFoo(int)}) and
+ * a non-indexed property reader (like {@code String[] getFoo()}), and {@link Introspector} exposes both
+ * (which apparently only happens since Java 8), we will use the non-indexed property reader method, while
+ * before this improvement we have used the indexed property method. When using the indexed property reader,
+ * FreeMarker doesn't know the size of the array, so the value becomes unlistable. Before Java 8 this problem
+ * haven't surfaced, as {@link Introspector} has only exposed the non-indexed property reader method when both
+ * kind of read method was present. So this can be seen as a Java 8 compatibility fix.
+ * </li>
* </ul>
*
* <p>Note that the version will be normalized to the lowest version where the same incompatible
@@ -844,7 +855,8 @@ public class BeansWrapper implements RichObjectWrapper, WriteProtectable {
if (incompatibleImprovements.intValue() < _TemplateAPI.VERSION_INT_2_3_0) {
throw new IllegalArgumentException("Version must be at least 2.3.0.");
}
- return incompatibleImprovements.intValue() >= _TemplateAPI.VERSION_INT_2_3_26 ? Configuration.VERSION_2_3_26
+ return incompatibleImprovements.intValue() >= _TemplateAPI.VERSION_INT_2_3_27 ? Configuration.VERSION_2_3_27
+ : incompatibleImprovements.intValue() == _TemplateAPI.VERSION_INT_2_3_26 ? Configuration.VERSION_2_3_26
: is2324Bugfixed(incompatibleImprovements) ? Configuration.VERSION_2_3_24
: is2321Bugfixed(incompatibleImprovements) ? Configuration.VERSION_2_3_21
: Configuration.VERSION_2_3_0;
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a4a406a1/src/main/java/freemarker/ext/beans/SimpleMethodModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/ext/beans/SimpleMethodModel.java b/src/main/java/freemarker/ext/beans/SimpleMethodModel.java
index e7e1ae1..9b8150b 100644
--- a/src/main/java/freemarker/ext/beans/SimpleMethodModel.java
+++ b/src/main/java/freemarker/ext/beans/SimpleMethodModel.java
@@ -24,13 +24,16 @@ import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;
+import freemarker.core._DelayedFTLTypeDescription;
+import freemarker.core._DelayedToString;
+import freemarker.core._ErrorDescriptionBuilder;
+import freemarker.core._TemplateModelException;
import freemarker.core._UnexpectedTypeErrorExplainerTemplateModel;
import freemarker.template.SimpleNumber;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import freemarker.template.TemplateSequenceModel;
-import freemarker.template.utility.ClassUtil;
/**
* A class that will wrap a reflected method call into a
@@ -81,13 +84,15 @@ public final class SimpleMethodModel extends SimpleMethod
}
public int size() throws TemplateModelException {
- throw new TemplateModelException(
- "Getting the number of items or enumerating the items is not supported on this "
- + ClassUtil.getFTLTypeDescription(this) + " value.\n"
- + "("
- + "Hint 1: Maybe you wanted to call this method first and then do something with its return value. "
- + "Hint 2: Getting items by intex possibly works, hence it's a \"+sequence\"."
- + ")");
+ throw new _TemplateModelException(
+ new _ErrorDescriptionBuilder(
+ "Getting the number of items or listing the items is not supported on this ",
+ new _DelayedFTLTypeDescription(this), " value, because this value wraps the following Java method, "
+ + "not a real listable value: ", new _DelayedToString(getMember()))
+ .tips(
+ "Maybe you should to call this method first and then do something with its return value.",
+ "obj.someMethod(i) and obj.someMethod[i] does the same for this method, hence it's a "
+ + "\"+sequence\"."));
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a4a406a1/src/main/java/freemarker/template/Configuration.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/Configuration.java b/src/main/java/freemarker/template/Configuration.java
index efa14ee..8b14da6 100644
--- a/src/main/java/freemarker/template/Configuration.java
+++ b/src/main/java/freemarker/template/Configuration.java
@@ -414,7 +414,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
/** FreeMarker version 2.3.26 (an {@link #Configuration(Version) incompatible improvements break-point}) */
public static final Version VERSION_2_3_26 = new Version(2, 3, 26);
- /** FreeMarker version 2.3.26 (an {@link #Configuration(Version) incompatible improvements break-point}) */
+ /** FreeMarker version 2.3.27 (an {@link #Configuration(Version) incompatible improvements break-point}) */
public static final Version VERSION_2_3_27 = new Version(2, 3, 27);
/** The default of {@link #getIncompatibleImprovements()}, currently {@link #VERSION_2_3_0}. */
@@ -833,6 +833,15 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
* properties they define); see {@link BeansWrapper#BeansWrapper(Version)}.
* </ul>
* </li>
+ * <li><p>
+ * 2.3.27 (or higher):
+ * <ul>
+ * <li><p>
+ * {@link BeansWrapper} and {@link DefaultObjectWrapper} now prefers the non-indexed JavaBean property
+ * read method over the indexed read method when Java 8 exposes both;
+ * see {@link BeansWrapper#BeansWrapper(Version)}.
+ * </ul>
+ * </li>
* </ul>
*
* @throws IllegalArgumentException
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a4a406a1/src/main/java/freemarker/template/_TemplateAPI.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/_TemplateAPI.java b/src/main/java/freemarker/template/_TemplateAPI.java
index 22cbc21..62960c8 100644
--- a/src/main/java/freemarker/template/_TemplateAPI.java
+++ b/src/main/java/freemarker/template/_TemplateAPI.java
@@ -48,6 +48,7 @@ public class _TemplateAPI {
public static final int VERSION_INT_2_3_24 = Configuration.VERSION_2_3_24.intValue();
public static final int VERSION_INT_2_3_25 = Configuration.VERSION_2_3_25.intValue();
public static final int VERSION_INT_2_3_26 = Configuration.VERSION_2_3_26.intValue();
+ public static final int VERSION_INT_2_3_27 = Configuration.VERSION_2_3_27.intValue();
public static final int VERSION_INT_2_4_0 = Version.intValueFor(2, 4, 0);
public static void checkVersionNotNullAndSupported(Version incompatibleImprovements) {
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a4a406a1/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 4961955..809822b 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -26965,6 +26965,33 @@ TemplateModel x = env.getVariable("x"); // get variable x</programlisting>
</listitem>
<listitem>
+ <para>Bug fixed: <literal>BeansWrapper</literal> and
+ <literal>DefaultObjectWrapper</literal>, starting from Java 8,
+ when the same JavaBeans property has both non-indexed read
+ method (like <literal>String[] getFoo()</literal>) and indexed
+ read method (like <literal>String getFoo(int index)</literal>),
+ has mistakenly used the indexed read method to access the
+ property. This is a problem because then the array size was
+ unknown, and thus the property has suddenly become unlistable on
+ Java 8. To enable the fix (where it will use the non-indexed
+ read method), you have to increase the value of the
+ <literal>incompatibleImprovements</literal> constructor argument
+ of the used <literal>DefaultObjectWrapper</literal> or
+ <literal>BeansWrapper</literal> to 2.3.27. Note that if you
+ leave the <literal>object_wrapper</literal> setting of the
+ <literal>Configuration</literal> on its default, it's enough to
+ increase the <link
+ linkend="pgui_config_incompatible_improvements_how_to_set"><literal>incompatibleImprovements</literal>
+ setting</link> of the <literal>Configuration</literal> to
+ 2.3.27, as that's inherited by the default
+ <literal>object_wrapper</literal>. Note that this bug haven't
+ surfaced before Java 8, as then
+ <literal>java.beans.Inrospector</literal> has only exposed the
+ non-indexed method when both kind of read method was
+ present.</para>
+ </listitem>
+
+ <listitem>
<para>Bug fixed: When the
<literal>TemplateExceptionHandler</literal> suppresses (i.e.,
doesn't re-throw) an exception, the <link
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a4a406a1/src/test/java/freemarker/ext/beans/BeansWrapperMiscTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/ext/beans/BeansWrapperMiscTest.java b/src/test/java/freemarker/ext/beans/BeansWrapperMiscTest.java
index 697a98c..917b2b3 100644
--- a/src/test/java/freemarker/ext/beans/BeansWrapperMiscTest.java
+++ b/src/test/java/freemarker/ext/beans/BeansWrapperMiscTest.java
@@ -19,20 +19,30 @@
package freemarker.ext.beans;
+import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
+import java.util.Collections;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
+import freemarker.template.Configuration;
import freemarker.template.TemplateBooleanModel;
import freemarker.template.TemplateHashModel;
+import freemarker.template.TemplateMethodModelEx;
+import freemarker.template.TemplateModel;
+import freemarker.template.TemplateModelException;
+import freemarker.template.TemplateScalarModel;
+import freemarker.template.TemplateSequenceModel;
+import freemarker.template.utility.Constants;
@RunWith(JUnit4.class)
public class BeansWrapperMiscTest {
@Test
- public void booleans() throws Exception {
+ public void booleansTest() throws Exception {
final BeansWrapper bw = new BeansWrapper();
assertTrue(((TemplateBooleanModel) bw.wrap(Boolean.TRUE)).getAsBoolean());
@@ -54,4 +64,50 @@ public class BeansWrapperMiscTest {
assertSame(tm, bw.wrap(Boolean.TRUE));
}
+ @Test
+ public void java8IndexedMethodIssueTest() throws TemplateModelException {
+ {
+ BeansWrapper bw = new BeansWrapper(Configuration.VERSION_2_3_26);
+ TemplateHashModel beanTM = (TemplateHashModel) bw.wrap(new BeanWithBothIndexedAndArrayProperty());
+ TemplateModel fooTM = beanTM.get("foo");
+ assertThat(fooTM, instanceOf(TemplateMethodModelEx.class));
+ assertThat(fooTM, instanceOf(TemplateSequenceModel.class));
+ assertEquals("b",
+ ((TemplateScalarModel) ((TemplateMethodModelEx) fooTM).exec(
+ Collections.singletonList(Constants.ONE)))
+ .getAsString());
+ try {
+ ((TemplateSequenceModel) fooTM).size();
+ fail();
+ } catch (TemplateModelException e) {
+ // Expected
+ }
+ }
+
+ {
+ BeansWrapper bw = new BeansWrapper(Configuration.VERSION_2_3_27);
+ TemplateHashModel beanTM = (TemplateHashModel) bw.wrap(new BeanWithBothIndexedAndArrayProperty());
+ TemplateModel fooTM = beanTM.get("foo");
+ assertThat(fooTM, not(instanceOf(TemplateMethodModelEx.class)));
+ assertThat(fooTM, instanceOf(TemplateSequenceModel.class));
+ assertEquals("b",
+ ((TemplateScalarModel) ((TemplateSequenceModel) fooTM).get(1)).getAsString());
+ assertEquals(2, ((TemplateSequenceModel) fooTM).size());
+ }
+ }
+
+ public static class BeanWithBothIndexedAndArrayProperty {
+
+ private final static String[] FOO = new String[] { "a", "b" };
+
+ public String[] getFoo() {
+ return FOO;
+ }
+
+ public String getFoo(int index) {
+ return FOO[index];
+ }
+
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a4a406a1/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/template/DefaultObjectWrapperTest.java b/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
index 9a9e283..26bcf9a 100644
--- a/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
+++ b/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
@@ -93,7 +93,7 @@ public class DefaultObjectWrapperTest {
expected.add(Configuration.VERSION_2_3_24);
expected.add(Configuration.VERSION_2_3_24); // no non-BC change in 2.3.25
expected.add(Configuration.VERSION_2_3_26);
- expected.add(Configuration.VERSION_2_3_26); // no non-BC change in 2.3.27
+ expected.add(Configuration.VERSION_2_3_27);
List<Version> actual = new ArrayList<Version>();
for (int i = _TemplateAPI.VERSION_INT_2_3_0; i <= Configuration.getVersion().intValue(); i++) {
[13/19] incubator-freemarker git commit: Error message fix for ?chunk
Posted by dd...@apache.org.
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;
[02/19] incubator-freemarker git commit: Merged: Fix grammar in
InvalidReferenceException tip
Posted by dd...@apache.org.
Merged: Fix grammar in InvalidReferenceException tip
Merge commit 'refs/pull/29/head' of https://github.com/apache/incubator-freemarker into 2.3-gae
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/b44df00e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/b44df00e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/b44df00e
Branch: refs/heads/2.3
Commit: b44df00e02ce489bc2e5295b74042612cbc4c123
Parents: 67691b4 732fe76
Author: ddekany <dd...@apache.org>
Authored: Tue Aug 8 00:18:33 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Tue Aug 8 00:22:09 2017 +0200
----------------------------------------------------------------------
src/main/java/freemarker/core/InvalidReferenceException.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
[15/19] incubator-freemarker git commit: Allowed Iterable constructor
parameter for SimpleCollection
Posted by dd...@apache.org.
Allowed Iterable constructor parameter for SimpleCollection
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/3531b06e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/3531b06e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/3531b06e
Branch: refs/heads/2.3
Commit: 3531b06e9e9f1cf730470d886ade505003f31cd9
Parents: e395401
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 26 00:28:02 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 26 00:28:02 2017 +0200
----------------------------------------------------------------------
.../freemarker/template/SimpleCollection.java | 23 ++++++++++++--------
1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3531b06e/src/main/java/freemarker/template/SimpleCollection.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/SimpleCollection.java b/src/main/java/freemarker/template/SimpleCollection.java
index aa67ef1..b29c110 100644
--- a/src/main/java/freemarker/template/SimpleCollection.java
+++ b/src/main/java/freemarker/template/SimpleCollection.java
@@ -43,7 +43,7 @@ implements TemplateCollectionModel, Serializable {
private boolean iteratorOwned;
private final Iterator iterator;
- private final Collection collection;
+ private final Iterable iterable;
/**
* @deprecated Use {@link #SimpleCollection(Iterator, ObjectWrapper)}
@@ -51,27 +51,32 @@ implements TemplateCollectionModel, Serializable {
@Deprecated
public SimpleCollection(Iterator iterator) {
this.iterator = iterator;
- collection = null;
+ iterable = null;
}
/**
- * @deprecated Use {@link #SimpleCollection(Collection, ObjectWrapper)}
+ * @param iterable Note that this was a {@link Collection} before 2.3.27, not an {@link Iterable}
+ *
+ * @deprecated Use {@link #SimpleCollection(Iterable, ObjectWrapper)}
*/
@Deprecated
- public SimpleCollection(Collection collection) {
- this.collection = collection;
+ public SimpleCollection(Iterable iterable) {
+ this.iterable = iterable;
iterator = null;
}
public SimpleCollection(Iterator iterator, ObjectWrapper wrapper) {
super(wrapper);
this.iterator = iterator;
- collection = null;
+ iterable = null;
}
- public SimpleCollection(Collection collection, ObjectWrapper wrapper) {
+ /**
+ * @param iterable Note that this was a {@link Collection} before 2.3.27, not an {@link Iterable}
+ */
+ public SimpleCollection(Iterable iterable, ObjectWrapper wrapper) {
super(wrapper);
- this.collection = collection;
+ this.iterable = iterable;
iterator = null;
}
@@ -87,7 +92,7 @@ implements TemplateCollectionModel, Serializable {
public TemplateModelIterator iterator() {
return iterator != null
? new SimpleTemplateModelIterator(iterator, false)
- : new SimpleTemplateModelIterator(collection.iterator(), true);
+ : new SimpleTemplateModelIterator(iterable.iterator(), true);
}
/**
[10/19] incubator-freemarker git commit: (JavaDoc typos)
Posted by dd...@apache.org.
(JavaDoc typos)
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/94a3c999
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/94a3c999
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/94a3c999
Branch: refs/heads/2.3
Commit: 94a3c9998d1e52abe3cd78ba1a22335e91b7b736
Parents: a923ee8
Author: ddekany <dd...@apache.org>
Authored: Sun Aug 20 00:10:05 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Aug 20 00:10:05 2017 +0200
----------------------------------------------------------------------
src/main/java/freemarker/template/utility/Constants.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/94a3c999/src/main/java/freemarker/template/utility/Constants.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/utility/Constants.java b/src/main/java/freemarker/template/utility/Constants.java
index ef8333d..056c8a8 100644
--- a/src/main/java/freemarker/template/utility/Constants.java
+++ b/src/main/java/freemarker/template/utility/Constants.java
@@ -39,8 +39,8 @@ import freemarker.template.TemplateSequenceModel;
* Frequently used constant {@link TemplateModel} values.
*
* <p>These constants should be stored in the {@link TemplateModel}
- * sub-interfaces, but for bacward compatibility they are stored here instead.
- * Starting from FreeMarker 2.4 they should be copyed (not moved!) into the
+ * sub-interfaces, but for backward compatibility they are stored here instead.
+ * Starting from FreeMarker 2.4 they should be copied (not moved!) into the
* {@link TemplateModel} sub-interfaces, and this class should be marked as
* deprecated.</p>
*/
[12/19] incubator-freemarker git commit: (TemplateScalarModel JavaDoc
improvement)
Posted by dd...@apache.org.
(TemplateScalarModel JavaDoc improvement)
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/05dc3856
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/05dc3856
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/05dc3856
Branch: refs/heads/2.3
Commit: 05dc3856ce729946b9cf60c17b5e0a1331a4d77c
Parents: 61902c3
Author: ddekany <dd...@apache.org>
Authored: Sun Aug 20 23:57:08 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Aug 20 23:57:08 2017 +0200
----------------------------------------------------------------------
.../java/freemarker/template/TemplateScalarModel.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/05dc3856/src/main/java/freemarker/template/TemplateScalarModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/TemplateScalarModel.java b/src/main/java/freemarker/template/TemplateScalarModel.java
index ca67f75..7b628de 100644
--- a/src/main/java/freemarker/template/TemplateScalarModel.java
+++ b/src/main/java/freemarker/template/TemplateScalarModel.java
@@ -19,10 +19,15 @@
package freemarker.template;
+import freemarker.core.TemplateMarkupOutputModel;
+
/**
* "string" template language data-type; like in Java, an unmodifiable UNICODE character sequence.
* (The name of this interface should be {@code TemplateStringModel}. The misnomer is inherited from the
* old times, when this was the only single-value type in FreeMarker.)
+ * When a template has to print a value of this class, it will assume that it stores plain text (not HTML, XML, etc.),
+ * and thus it will be possibly auto-escaped. To avoid that, use the appropriate {@link TemplateMarkupOutputModel}
+ * instead.
*/
public interface TemplateScalarModel extends TemplateModel {
@@ -32,12 +37,9 @@ public interface TemplateScalarModel extends TemplateModel {
public TemplateModel EMPTY_STRING = new SimpleScalar("");
/**
- * Returns the string representation of this model. Don't return {@code null}, as that will cause exception. (In
- * classic-compatible mode the engine will convert {@code null} into empty string, though.)
- *
- * <p>
- * Objects of this type should be immutable, that is, calling {@link #getAsString()} should always return the same
- * value as for the first time.
+ * Returns the {@link String} representation of this model. Returning {@code null} is illegal, and may cause
+ * exception in the calling code. (Except, in classic-compatible mode the engine will convert {@code null} into
+ * empty string.)
*/
public String getAsString() throws TemplateModelException;
[04/19] incubator-freemarker git commit: (Minor JavaDoc fixes)
Posted by dd...@apache.org.
(Minor JavaDoc fixes)
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/f1f8080b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/f1f8080b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/f1f8080b
Branch: refs/heads/2.3
Commit: f1f8080b47b6736c0096fae177730c5d53ea8925
Parents: 0359d26
Author: ddekany <dd...@apache.org>
Authored: Tue Aug 8 00:23:30 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Tue Aug 8 00:23:30 2017 +0200
----------------------------------------------------------------------
src/main/java/freemarker/ext/beans/BeansWrapper.java | 2 +-
src/main/java/freemarker/template/TemplateModelException.java | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f1f8080b/src/main/java/freemarker/ext/beans/BeansWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/ext/beans/BeansWrapper.java b/src/main/java/freemarker/ext/beans/BeansWrapper.java
index 1a10bf0..f108ad6 100644
--- a/src/main/java/freemarker/ext/beans/BeansWrapper.java
+++ b/src/main/java/freemarker/ext/beans/BeansWrapper.java
@@ -898,7 +898,7 @@ public class BeansWrapper implements RichObjectWrapper, WriteProtectable {
* Wraps a Java method so that it can be called from templates, without wrapping its parent ("this") object. The
* result is almost the same as that you would get by wrapping the parent object then getting the method from the
* resulting {@link TemplateHashModel} by name. Except, if the wrapped method is overloaded, with this method you
- * explicitly select a an overload, while otherwise you would get a {@link TemplateMethodModelEx} that selects an
+ * explicitly select an overload, while otherwise you would get a {@link TemplateMethodModelEx} that selects an
* overload each time it's called based on the argument values.
*
* @param object The object whose method will be called, or {@code null} if {@code method} is a static method.
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f1f8080b/src/main/java/freemarker/template/TemplateModelException.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/TemplateModelException.java b/src/main/java/freemarker/template/TemplateModelException.java
index cdf3825..1ab47b4 100644
--- a/src/main/java/freemarker/template/TemplateModelException.java
+++ b/src/main/java/freemarker/template/TemplateModelException.java
@@ -23,7 +23,8 @@ import freemarker.core.Environment;
import freemarker.core._ErrorDescriptionBuilder;
/**
- * {@link TemplateModel} methods throw this exception if the requested data can't be retrieved.
+ * {@link ObjectWrapper}-s may throw this when wrapping/unwrapping fails, or {@link TemplateModel} methods throw this
+ * if the requested data can't be retrieved.
*/
public class TemplateModelException extends TemplateException {
[07/19] incubator-freemarker git commit: Bug fixed (FREEMARKER-70):
The usage of loop variable built-ins, like loopVar?index,
was disallowed by the parser inside interpolations that are inside a string
literal expression (as in <#list 1..3 as loopVar>${'
Posted by dd...@apache.org.
Bug fixed (FREEMARKER-70): The usage of loop variable built-ins, like loopVar?index, was disallowed by the parser inside interpolations that are inside a string literal expression (as in <#list 1..3 as loopVar>${'${loopVar?index}'}</#list>), saying that there's no loop variable in scope with loopVar name.
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/056bf1cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/056bf1cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/056bf1cd
Branch: refs/heads/2.3
Commit: 056bf1cd7e59740af304b2566caacd921378a5bd
Parents: 924a420
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 12 00:20:32 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 12 00:20:32 2017 +0200
----------------------------------------------------------------------
src/main/java/freemarker/core/StringLiteral.java | 12 +++++-------
src/main/javacc/FTL.jj | 19 +++++++++++++------
src/manual/en_US/book.xml | 13 +++++++++++++
.../java/freemarker/core/ListErrorsTest.java | 5 +++++
4 files changed, 36 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/056bf1cd/src/main/java/freemarker/core/StringLiteral.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/StringLiteral.java b/src/main/java/freemarker/core/StringLiteral.java
index c2b69a6..7c25623 100644
--- a/src/main/java/freemarker/core/StringLiteral.java
+++ b/src/main/java/freemarker/core/StringLiteral.java
@@ -41,15 +41,13 @@ final class StringLiteral extends Expression implements TemplateScalarModel {
}
/**
- * @param parentTkMan
- * The token source of the template that contains this string literal. As of this writing, we only need
- * this to share the {@code namingConvetion} with that.
+ * @param parentParser
+ * The parser of the template that contains this string literal.
*/
- void parseValue(FMParserTokenManager parentTkMan, OutputFormat outputFormat) throws ParseException {
+ void parseValue(FMParser parentParser, OutputFormat outputFormat) throws ParseException {
// The way this works is incorrect (the literal should be parsed without un-escaping),
// but we can't fix this backward compatibly.
if (value.length() > 3 && (value.indexOf("${") >= 0 || value.indexOf("#{") >= 0)) {
-
Template parentTemplate = getTemplate();
ParserConfiguration pcfg = parentTemplate.getParserConfiguration();
@@ -65,12 +63,12 @@ final class StringLiteral extends Expression implements TemplateScalarModel {
FMParser parser = new FMParser(parentTemplate, false, tkMan, pcfg);
// We continue from the parent parser's current state:
- parser.setupStringLiteralMode(parentTkMan, outputFormat);
+ parser.setupStringLiteralMode(parentParser, outputFormat);
try {
dynamicValue = parser.StaticTextAndInterpolations();
} finally {
// The parent parser continues from this parser's current state:
- parser.tearDownStringLiteralMode(parentTkMan);
+ parser.tearDownStringLiteralMode(parentParser);
}
} catch (ParseException e) {
e.setTemplateName(parentTemplate.getSourceName());
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/056bf1cd/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index 175614c..2963a41 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -78,7 +78,7 @@ public class FMParser {
private ParserConfiguration pCfg;
/** Keeps track of #list and #foreach nesting. */
- private List/*<ParserIteratorBlockContext>*/ iteratorBlockContexts;
+ private List<ParserIteratorBlockContext> iteratorBlockContexts;
/**
* Keeps track of the nesting depth of directives that support #break.
@@ -273,7 +273,9 @@ public class FMParser {
}
}
- void setupStringLiteralMode(FMParserTokenManager parentTokenSource, OutputFormat outputFormat) {
+ void setupStringLiteralMode(FMParser parentParser, OutputFormat outputFormat) {
+ FMParserTokenManager parentTokenSource = parentParser.token_source;
+
token_source.initialNamingConvention = parentTokenSource.initialNamingConvention;
token_source.namingConvention = parentTokenSource.namingConvention;
token_source.namingConventionEstabilisher = parentTokenSource.namingConventionEstabilisher;
@@ -285,9 +287,14 @@ public class FMParser {
// Emulate bug, where the string literal parser haven't inherited the IcI:
incompatibleImprovements = _TemplateAPI.VERSION_INT_2_3_0;
}
+
+ // So that loop variable built-ins, like ?index, works inside the interpolations in the string literal:
+ iteratorBlockContexts = parentParser.iteratorBlockContexts;
}
- void tearDownStringLiteralMode(FMParserTokenManager parentTokenSource) {
+ void tearDownStringLiteralMode(FMParser parentParser) {
+ // If the naming convention was established inside the string literal, it's inherited by the parent:
+ FMParserTokenManager parentTokenSource = parentParser.token_source;
parentTokenSource.namingConvention = token_source.namingConvention;
parentTokenSource.namingConventionEstabilisher = token_source.namingConventionEstabilisher;
}
@@ -507,7 +514,7 @@ public class FMParser {
private ParserIteratorBlockContext pushIteratorBlockContext() {
if (iteratorBlockContexts == null) {
- iteratorBlockContexts = new ArrayList(4);
+ iteratorBlockContexts = new ArrayList<ParserIteratorBlockContext>(4);
}
ParserIteratorBlockContext newCtx = new ParserIteratorBlockContext();
iteratorBlockContexts.add(newCtx);
@@ -527,7 +534,7 @@ public class FMParser {
throws ParseException {
int size = iteratorBlockContexts != null ? iteratorBlockContexts.size() : 0;
for (int i = size - 1; i >= 0; i--) {
- ParserIteratorBlockContext ctx = (ParserIteratorBlockContext) iteratorBlockContexts.get(i);
+ ParserIteratorBlockContext ctx = iteratorBlockContexts.get(i);
if (loopVarName.equals(ctx.loopVarName) || loopVarName.equals(ctx.loopVar2Name)) {
if (ctx.kind == ITERATOR_BLOCK_KIND_USER_DIRECTIVE) {
throw new ParseException(
@@ -2297,7 +2304,7 @@ StringLiteral StringLiteral(boolean interpolate) :
result.setLocation(template, t, t);
if (interpolate && !raw) {
// TODO: This logic is broken. It can't handle literals that contains both ${...} and $\{...}.
- if (t.image.indexOf("${") >= 0 || t.image.indexOf("#{") >= 0) result.parseValue(token_source, outputFormat);
+ if (t.image.indexOf("${") >= 0 || t.image.indexOf("#{") >= 0) result.parseValue(this, outputFormat);
}
return result;
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/056bf1cd/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 6d6d6f9..03c42b0 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -26926,6 +26926,19 @@ TemplateModel x = env.getVariable("x"); // get variable x</programlisting>
</listitem>
<listitem>
+ <para>Bug fixed (<link
+ xlink:href="https://issues.apache.org/jira/browse/FREEMARKER-70">FREEMARKER-70</link>):
+ The usage of loop variable built-ins, like
+ <literal><replaceable>loopVar</replaceable>?index</literal>, was
+ disallowed by the parser inside interpolations that are inside a
+ string literal expression (as in <literal><#list 1..3 as
+ loopVar>${'${loopVar?index}'}</#list></literal>),
+ saying that there's no loop variable in scope with
+ <literal><replaceable>loopVar</replaceable></literal>
+ name.</para>
+ </listitem>
+
+ <listitem>
<para>Bug fixed: Comments were not allowed by the parser between
the <literal>switch</literal> tag and the first
<literal>case</literal> tag.</para>
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/056bf1cd/src/test/java/freemarker/core/ListErrorsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/ListErrorsTest.java b/src/test/java/freemarker/core/ListErrorsTest.java
index 60ca7e6..7a4aaa4 100644
--- a/src/test/java/freemarker/core/ListErrorsTest.java
+++ b/src/test/java/freemarker/core/ListErrorsTest.java
@@ -47,6 +47,11 @@ public class ListErrorsTest extends TemplateTest {
+ "</#list>",
"1@0[3,4@0]1@0; 2@1[3,4@0]2@1; ");
}
+
+ @Test
+ public void stringInterpolationBugFixTest() throws IOException, TemplateException {
+ assertOutput("<#list 1..3 as x>${'${x?index}'}</#list>", "012");
+ }
@Test
public void testInvalidItemsParseTime() throws IOException, TemplateException {
[03/19] incubator-freemarker git commit: README.md Ant version update
Posted by dd...@apache.org.
README.md Ant version update
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/0359d265
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/0359d265
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/0359d265
Branch: refs/heads/2.3
Commit: 0359d265b8c83a94cc946136d489def86e8aa5ce
Parents: b44df00
Author: ddekany <dd...@apache.org>
Authored: Tue Aug 8 00:22:57 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Tue Aug 8 00:22:57 2017 +0200
----------------------------------------------------------------------
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/0359d265/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 6441fd6..9ed8a0d 100644
--- a/README.md
+++ b/README.md
@@ -101,7 +101,7 @@ If you haven't yet, download the source release, or checkout FreeMarker from
the source code repository. See repository locations here:
http://freemarker.org/sourcecode.html
-You need JDK 8, Apache Ant (tested with 1.8.1) and Ivy (tested with 2.4.0) to
+You need JDK 8, Apache Ant (tested with 1.9.6) and Ivy (tested with 2.4.0) to
be installed. To install Ivy (but be sure it's not already installed), issue
`ant download-ivy`; it will copy Ivy under `~/.ant/lib`. (Alternatively, you
can copy `ivy-<version>.jar` into the Ant home `lib` subfolder manually.)
[06/19] incubator-freemarker git commit: (Minor code cleanup)
Posted by dd...@apache.org.
(Minor code cleanup)
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/924a4201
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/924a4201
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/924a4201
Branch: refs/heads/2.3
Commit: 924a420119b72f663769d7f3e9422ba22637478f
Parents: cdd12d8
Author: ddekany <dd...@apache.org>
Authored: Fri Aug 11 23:46:17 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Fri Aug 11 23:46:17 2017 +0200
----------------------------------------------------------------------
src/main/java/freemarker/template/utility/Constants.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/924a4201/src/main/java/freemarker/template/utility/Constants.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/utility/Constants.java b/src/main/java/freemarker/template/utility/Constants.java
index fd48e70..ef8333d 100644
--- a/src/main/java/freemarker/template/utility/Constants.java
+++ b/src/main/java/freemarker/template/utility/Constants.java
@@ -96,7 +96,7 @@ public class Constants {
}
- public static final TemplateHashModelEx EMPTY_HASH = new EmptyHashModel();
+ public static final TemplateHashModelEx2 EMPTY_HASH = new EmptyHashModel();
/**
* An empty hash. Since 2.3.27, it implements {@link TemplateHashModelEx2}, before that it was only
@@ -133,12 +133,9 @@ public class Constants {
/**
* @since 2.3.27
*/
- public static final KeyValuePairIterator EMPTY_KEY_VALUE_PAIR_ITERATOR = EmptyKeyValuePairIterator.INSTANCE;
+ public static final KeyValuePairIterator EMPTY_KEY_VALUE_PAIR_ITERATOR = new EmptyKeyValuePairIterator();
private static class EmptyKeyValuePairIterator implements TemplateHashModelEx2.KeyValuePairIterator {
-
- static final EmptyKeyValuePairIterator INSTANCE = new EmptyKeyValuePairIterator();
-
private EmptyKeyValuePairIterator() {
//
}
[05/19] incubator-freemarker git commit: Minor error message
generation fix.
Posted by dd...@apache.org.
Minor error message generation fix.
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/cdd12d8b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/cdd12d8b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/cdd12d8b
Branch: refs/heads/2.3
Commit: cdd12d8be3a4b016d8564f7d7feadbb28c3cfa23
Parents: f1f8080
Author: ddekany <dd...@apache.org>
Authored: Fri Aug 11 23:46:03 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Fri Aug 11 23:46:03 2017 +0200
----------------------------------------------------------------------
src/main/java/freemarker/core/UnexpectedTypeException.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cdd12d8b/src/main/java/freemarker/core/UnexpectedTypeException.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/UnexpectedTypeException.java b/src/main/java/freemarker/core/UnexpectedTypeException.java
index 73420e3..0878f81 100644
--- a/src/main/java/freemarker/core/UnexpectedTypeException.java
+++ b/src/main/java/freemarker/core/UnexpectedTypeException.java
@@ -104,7 +104,7 @@ public class UnexpectedTypeException extends TemplateException {
new _DelayedJQuote(blamedAssignmentTargetVarName) }),
" has evaluated to ",
new _DelayedAOrAn(new _DelayedFTLTypeDescription(model)),
- (blamedAssignmentTargetVarName == null ? ":" : ".")};
+ (blamed != null ? ":" : ".")};
}
}
[19/19] incubator-freemarker git commit: Merge remote-tracking branch
'origin/2.3-gae' into 2.3
Posted by dd...@apache.org.
Merge remote-tracking branch 'origin/2.3-gae' into 2.3
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/b2578291
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/b2578291
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/b2578291
Branch: refs/heads/2.3
Commit: b2578291026b6347e891a6707caf90a956bf7dfd
Parents: a5fb351 a4a406a
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 26 01:38:49 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 26 01:38:49 2017 +0200
----------------------------------------------------------------------
README.md | 2 +-
.../core/BuiltInsForMultipleTypes.java | 4 +-
.../freemarker/core/BuiltInsForSequences.java | 6 +-
.../core/BuiltInsForStringsEncoding.java | 16 +++---
.../core/BuiltInsForStringsRegexp.java | 12 ++--
.../core/InvalidReferenceException.java | 2 +-
src/main/java/freemarker/core/Macro.java | 3 +-
.../java/freemarker/core/StringLiteral.java | 12 ++--
.../core/UnexpectedTypeException.java | 2 +-
.../java/freemarker/ext/beans/BeanModel.java | 18 ++++--
.../java/freemarker/ext/beans/BeansWrapper.java | 16 +++++-
.../ext/beans/ClassBasedModelFactory.java | 5 +-
.../freemarker/ext/beans/SimpleMethodModel.java | 21 ++++---
.../java/freemarker/template/Configuration.java | 12 ++++
.../template/GeneralPurposeNothing.java | 2 +-
.../freemarker/template/SimpleCollection.java | 23 +++++---
.../template/TemplateCollectionModel.java | 12 ++--
.../template/TemplateCollectionModelEx.java | 4 +-
.../template/TemplateModelException.java | 3 +-
.../template/TemplateScalarModel.java | 14 +++--
.../java/freemarker/template/_TemplateAPI.java | 1 +
.../freemarker/template/utility/Constants.java | 11 ++--
src/main/javacc/FTL.jj | 35 +++++++-----
src/manual/en_US/book.xml | 47 ++++++++++++++--
.../java/freemarker/core/ListErrorsTest.java | 5 ++
.../ext/beans/BeansWrapperMiscTest.java | 58 +++++++++++++++++++-
.../template/DefaultObjectWrapperTest.java | 2 +-
27 files changed, 252 insertions(+), 96 deletions(-)
----------------------------------------------------------------------
[14/19] incubator-freemarker git commit: (JavaDoc improvements)
Posted by dd...@apache.org.
(JavaDoc improvements)
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/e3954012
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/e3954012
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/e3954012
Branch: refs/heads/2.3
Commit: e395401297b57e9208e4f17bffbb7731bc77b75a
Parents: 0213afa
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 26 00:26:36 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 26 00:26:36 2017 +0200
----------------------------------------------------------------------
src/main/java/freemarker/ext/beans/BeanModel.java | 2 +-
.../freemarker/template/TemplateCollectionModel.java | 12 ++++++++----
.../freemarker/template/TemplateCollectionModelEx.java | 4 ++--
3 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e3954012/src/main/java/freemarker/ext/beans/BeanModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/ext/beans/BeanModel.java b/src/main/java/freemarker/ext/beans/BeanModel.java
index f9b56c7..8ec19ea 100644
--- a/src/main/java/freemarker/ext/beans/BeanModel.java
+++ b/src/main/java/freemarker/ext/beans/BeanModel.java
@@ -119,7 +119,7 @@ implements
* matching the key name. If a method or property is found, it's wrapped
* into {@link freemarker.template.TemplateMethodModelEx} (for a method or
* indexed property), or evaluated on-the-fly and the return value wrapped
- * into appropriate model (for a simple property) Models for various
+ * into appropriate model (for a non-indexed property) Models for various
* properties and methods are cached on a per-class basis, so the costly
* introspection is performed only once per property or method of a class.
* (Side-note: this also implies that any class whose method has been called
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e3954012/src/main/java/freemarker/template/TemplateCollectionModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/TemplateCollectionModel.java b/src/main/java/freemarker/template/TemplateCollectionModel.java
index f6662af..4bd21f8 100644
--- a/src/main/java/freemarker/template/TemplateCollectionModel.java
+++ b/src/main/java/freemarker/template/TemplateCollectionModel.java
@@ -23,10 +23,14 @@ import java.util.Collection;
/**
* "collection" template language data type: a collection of values that can be enumerated, but can't be or not meant to
- * be accessed by index or key. As such, this is not a super-interface of {@link TemplateSequenceModel}, and
- * implementations of that interface needn't also implement this interface just because they can. They should though, if
- * enumeration with this interface is significantly faster than enumeration by index. The {@code #list} directive will
- * enumerate using this interface if it's available.
+ * be accessed by index or key, nor the number of elements in it is known. As such, this is very similar to Java's
+ * {@link Iterable} interface (but it predates that interface, hence the unfortunate class name).
+ *
+ * <p>
+ * Note that this is not a super-interface of {@link TemplateSequenceModel}, and implementations of that interface
+ * needn't also implement this interface just because they can. They should though, if enumeration with this interface
+ * is significantly faster than enumeration by index. The {@code #list} directive will enumerate using this interface if
+ * it's available.
*
* <p>
* The enumeration should be repeatable if that's possible with reasonable effort, otherwise a second enumeration
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e3954012/src/main/java/freemarker/template/TemplateCollectionModelEx.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/TemplateCollectionModelEx.java b/src/main/java/freemarker/template/TemplateCollectionModelEx.java
index 266c209..f089abf 100644
--- a/src/main/java/freemarker/template/TemplateCollectionModelEx.java
+++ b/src/main/java/freemarker/template/TemplateCollectionModelEx.java
@@ -22,8 +22,8 @@ package freemarker.template;
import java.util.Collection;
/**
- * "extended collection" template language data type: Adds size/emptiness querybility and "contains" test to
- * {@link TemplateCollectionModel}. The added extra operations is provided by all Java {@link Collection}-s, and this
+ * "collection" template language data type: Adds size/emptiness querybility to
+ * {@link TemplateCollectionModel}. The added extra operations are provided by all Java {@link Collection}-s, and this
* interface was added to make that accessible for templates too.
*
* @since 2.3.22
[16/19] incubator-freemarker git commit: Added VERSION_2_3_27 to
Configuration
Posted by dd...@apache.org.
Added VERSION_2_3_27 to Configuration
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/09821f96
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/09821f96
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/09821f96
Branch: refs/heads/2.3
Commit: 09821f96c2703fcaab0bbe739cd527ff6e8ad5da
Parents: 3531b06
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 26 00:28:24 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 26 00:28:24 2017 +0200
----------------------------------------------------------------------
src/main/java/freemarker/template/Configuration.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/09821f96/src/main/java/freemarker/template/Configuration.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/Configuration.java b/src/main/java/freemarker/template/Configuration.java
index 5956a39..efa14ee 100644
--- a/src/main/java/freemarker/template/Configuration.java
+++ b/src/main/java/freemarker/template/Configuration.java
@@ -413,6 +413,9 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
/** FreeMarker version 2.3.26 (an {@link #Configuration(Version) incompatible improvements break-point}) */
public static final Version VERSION_2_3_26 = new Version(2, 3, 26);
+
+ /** FreeMarker version 2.3.26 (an {@link #Configuration(Version) incompatible improvements break-point}) */
+ public static final Version VERSION_2_3_27 = new Version(2, 3, 27);
/** The default of {@link #getIncompatibleImprovements()}, currently {@link #VERSION_2_3_0}. */
public static final Version DEFAULT_INCOMPATIBLE_IMPROVEMENTS = Configuration.VERSION_2_3_0;
[08/19] incubator-freemarker git commit: Minor error message
fixes/improvements.
Posted by dd...@apache.org.
Minor error message fixes/improvements.
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/08aa7896
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/08aa7896
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/08aa7896
Branch: refs/heads/2.3
Commit: 08aa7896ae9fd17e1b1a38b0bfd9a2eacaf4b54b
Parents: 056bf1c
Author: ddekany <dd...@apache.org>
Authored: Sun Aug 20 00:08:05 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Aug 20 00:08:05 2017 +0200
----------------------------------------------------------------------
.../freemarker/core/BuiltInsForStringsEncoding.java | 16 ++++++++--------
.../freemarker/core/BuiltInsForStringsRegexp.java | 12 +++++++-----
src/main/java/freemarker/core/Macro.java | 3 ++-
.../ext/beans/ClassBasedModelFactory.java | 5 ++++-
.../freemarker/template/GeneralPurposeNothing.java | 2 +-
5 files changed, 22 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/08aa7896/src/main/java/freemarker/core/BuiltInsForStringsEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/BuiltInsForStringsEncoding.java b/src/main/java/freemarker/core/BuiltInsForStringsEncoding.java
index d6c2e12..3cfb241 100644
--- a/src/main/java/freemarker/core/BuiltInsForStringsEncoding.java
+++ b/src/main/java/freemarker/core/BuiltInsForStringsEncoding.java
@@ -22,6 +22,7 @@ package freemarker.core;
import java.io.UnsupportedEncodingException;
import java.util.List;
+import freemarker.template.Configuration;
import freemarker.template.SimpleScalar;
import freemarker.template.TemplateMethodModel;
import freemarker.template.TemplateModel;
@@ -177,14 +178,13 @@ class BuiltInsForStringsEncoding {
String cs = env.getEffectiveURLEscapingCharset();
if (cs == null) {
throw new _TemplateModelException(
- "To do URL encoding, the framework that encloses "
- + "FreeMarker must specify the output encoding "
- + "or the URL encoding charset, so ask the "
- + "programmers to fix it. Or, as a last chance, "
- + "you can set the url_encoding_charset setting in "
- + "the template, e.g. "
- + "<#setting url_escaping_charset='ISO-8859-1'>, or "
- + "give the charset explicitly to the buit-in, e.g. "
+ "To do URL encoding, the framework that encloses FreeMarker must specify the \"",
+ Configuration.OUTPUT_ENCODING_KEY, "\" setting or the \"",
+ Configuration.URL_ESCAPING_CHARSET_KEY,
+ "\" setting, so ask the programmers to set them. Or, as a last chance, you can set the "
+ + "url_encoding_charset setting in the template, e.g. <#setting ",
+ Configuration.URL_ESCAPING_CHARSET_KEY,
+ "='ISO-8859-1'>, or give the charset explicitly to the built-in, e.g. "
+ "foo?url('ISO-8859-1').");
}
try {
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/08aa7896/src/main/java/freemarker/core/BuiltInsForStringsRegexp.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/BuiltInsForStringsRegexp.java b/src/main/java/freemarker/core/BuiltInsForStringsRegexp.java
index c2c054e..584833d 100644
--- a/src/main/java/freemarker/core/BuiltInsForStringsRegexp.java
+++ b/src/main/java/freemarker/core/BuiltInsForStringsRegexp.java
@@ -196,7 +196,7 @@ class BuiltInsForStringsRegexp {
try {
return new SimpleScalar(firedEntireInputMatcher.group(i));
} catch (Exception e) {
- throw new _TemplateModelException(e, "Failed to read match group");
+ throw new _TemplateModelException(e, "Failed to read regular expression match group");
}
}
@@ -204,7 +204,7 @@ class BuiltInsForStringsRegexp {
try {
return firedEntireInputMatcher.groupCount() + 1;
} catch (Exception e) {
- throw new _TemplateModelException(e, "Failed to get match group count");
+ throw new _TemplateModelException(e, "Failed to get regular expression match group count");
}
}
@@ -255,7 +255,9 @@ class BuiltInsForStringsRegexp {
public TemplateModel next() throws TemplateModelException {
final ArrayList matchingInputParts = RegexMatchModel.this.matchingInputParts;
if (matchingInputParts == null) {
- if (!hasFindInfo) throw new _TemplateModelException("There were no more matches");
+ if (!hasFindInfo) {
+ throw new _TemplateModelException("There were no more regular expression matches");
+ }
MatchWithGroups result = new MatchWithGroups(input, matcher);
nextIdx++;
hasFindInfo = matcher.find();
@@ -264,7 +266,7 @@ class BuiltInsForStringsRegexp {
try {
return (TemplateModel) matchingInputParts.get(nextIdx++);
} catch (IndexOutOfBoundsException e) {
- throw new _TemplateModelException(e, "There were no more matches");
+ throw new _TemplateModelException(e, "There were no more regular expression matches");
}
}
}
@@ -283,7 +285,7 @@ class BuiltInsForStringsRegexp {
try {
return (TemplateModel) matchingInputParts.get(nextIdx++);
} catch (IndexOutOfBoundsException e) {
- throw new _TemplateModelException(e, "There were no more matches");
+ throw new _TemplateModelException(e, "There were no more regular expression matches");
}
}
};
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/08aa7896/src/main/java/freemarker/core/Macro.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Macro.java b/src/main/java/freemarker/core/Macro.java
index 53756df..ef657ac 100644
--- a/src/main/java/freemarker/core/Macro.java
+++ b/src/main/java/freemarker/core/Macro.java
@@ -210,7 +210,8 @@ public final class Macro extends TemplateElement implements TemplateModel {
boolean argWasSpecified = localVars.containsKey(argName);
throw new _MiscTemplateException(env,
new _ErrorDescriptionBuilder(
- "When calling macro ", new _DelayedJQuote(name),
+ "When calling ", (isFunction() ? "function" : "macro"), " ",
+ new _DelayedJQuote(name),
", required parameter ", new _DelayedJQuote(argName),
" (parameter #", Integer.valueOf(i + 1), ") was ",
(argWasSpecified
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/08aa7896/src/main/java/freemarker/ext/beans/ClassBasedModelFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/ext/beans/ClassBasedModelFactory.java b/src/main/java/freemarker/ext/beans/ClassBasedModelFactory.java
index 1395b8e..5d9ae81 100644
--- a/src/main/java/freemarker/ext/beans/ClassBasedModelFactory.java
+++ b/src/main/java/freemarker/ext/beans/ClassBasedModelFactory.java
@@ -24,6 +24,8 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import freemarker.core._DelayedJQuote;
+import freemarker.core._TemplateModelException;
import freemarker.template.TemplateHashModel;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
@@ -49,7 +51,8 @@ abstract class ClassBasedModelFactory implements TemplateHashModel {
if (e instanceof TemplateModelException) {
throw (TemplateModelException) e;
} else {
- throw new TemplateModelException(e);
+ throw new _TemplateModelException(e,
+ "Failed to get valeu for key ", new _DelayedJQuote(key), "; see cause exception.");
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/08aa7896/src/main/java/freemarker/template/GeneralPurposeNothing.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/GeneralPurposeNothing.java b/src/main/java/freemarker/template/GeneralPurposeNothing.java
index 8023bd8..cb2d3af 100644
--- a/src/main/java/freemarker/template/GeneralPurposeNothing.java
+++ b/src/main/java/freemarker/template/GeneralPurposeNothing.java
@@ -58,7 +58,7 @@ implements TemplateBooleanModel, TemplateScalarModel, TemplateSequenceModel, Tem
}
public TemplateModel get(int i) throws TemplateModelException {
- throw new TemplateModelException("Empty list");
+ throw new TemplateModelException("Can't get item from an empty sequence.");
}
public TemplateModel get(String key) {
[09/19] incubator-freemarker git commit: (Removed unused
EvalUtil.modelToNumber call)
Posted by dd...@apache.org.
(Removed unused EvalUtil.modelToNumber call)
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/a923ee8f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/a923ee8f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/a923ee8f
Branch: refs/heads/2.3
Commit: a923ee8fa24679746a48fe7c3a60a7a316d076d2
Parents: 08aa789
Author: ddekany <dd...@apache.org>
Authored: Sun Aug 20 00:08:47 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Aug 20 00:08:47 2017 +0200
----------------------------------------------------------------------
src/main/java/freemarker/core/BuiltInsForMultipleTypes.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a923ee8f/src/main/java/freemarker/core/BuiltInsForMultipleTypes.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/BuiltInsForMultipleTypes.java b/src/main/java/freemarker/core/BuiltInsForMultipleTypes.java
index 98c3a4d..2adcebc 100644
--- a/src/main/java/freemarker/core/BuiltInsForMultipleTypes.java
+++ b/src/main/java/freemarker/core/BuiltInsForMultipleTypes.java
@@ -691,9 +691,7 @@ class BuiltInsForMultipleTypes {
TemplateModel _eval(Environment env) throws TemplateException {
TemplateModel model = target.eval(env);
if (model instanceof TemplateNumberModel) {
- TemplateNumberModel numberModel = (TemplateNumberModel) model;
- Number num = EvalUtil.modelToNumber(numberModel, target);
- return new NumberFormatter(numberModel, env);
+ return new NumberFormatter((TemplateNumberModel) model, env);
} else if (model instanceof TemplateDateModel) {
TemplateDateModel dm = (TemplateDateModel) model;
return new DateFormatter(dm, env);
[11/19] incubator-freemarker git commit: (Fixed some parser error
message oversights.)
Posted by dd...@apache.org.
(Fixed some parser error message oversights.)
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/61902c38
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/61902c38
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/61902c38
Branch: refs/heads/2.3
Commit: 61902c38b25d9a1bd51d4e65b759e80ee4f09071
Parents: 94a3c99
Author: ddekany <dd...@apache.org>
Authored: Sun Aug 20 23:56:41 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Aug 20 23:56:41 2017 +0200
----------------------------------------------------------------------
src/main/javacc/FTL.jj | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/61902c38/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index 2963a41..b7bdd48 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -1795,10 +1795,10 @@ Expression EqualityExpression() :
)
rhs = RelationalExpression()
{
- notHashLiteral(lhs, "scalar");
- notHashLiteral(rhs, "scalar");
- notListLiteral(lhs, "scalar");
- notListLiteral(rhs, "scalar");
+ notHashLiteral(lhs, "string");
+ notHashLiteral(rhs, "string");
+ notListLiteral(lhs, "string");
+ notListLiteral(rhs, "string");
result = new ComparisonExpression(lhs, rhs, t.image);
result.setLocation(template, lhs, rhs);
}
@@ -1832,10 +1832,10 @@ Expression RelationalExpression() :
)
rhs = RangeExpression()
{
- notHashLiteral(lhs, "scalar");
- notHashLiteral(rhs, "scalar");
- notListLiteral(lhs, "scalar");
- notListLiteral(rhs, "scalar");
+ notHashLiteral(lhs, "number");
+ notHashLiteral(rhs, "number");
+ notListLiteral(lhs, "number");
+ notListLiteral(rhs, "number");
notStringLiteral(lhs, "number");
notStringLiteral(rhs, "number");
result = new ComparisonExpression(lhs, rhs, t.image);
[17/19] incubator-freemarker git commit: (Version history fixes)
Posted by dd...@apache.org.
(Version history fixes)
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/ce4b9e4a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/ce4b9e4a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/ce4b9e4a
Branch: refs/heads/2.3
Commit: ce4b9e4a0e8d4169a3225fd293afd4692f1554de
Parents: 09821f9
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 26 00:28:46 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 26 00:28:46 2017 +0200
----------------------------------------------------------------------
src/manual/en_US/book.xml | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ce4b9e4a/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 03c42b0..4961955 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -26917,7 +26917,7 @@ TemplateModel x = env.getVariable("x"); // get variable x</programlisting>
<literal>&&</literal> (logical <quote>and</quote>)
operator: <literal>\and</literal> and
<literal>&amp;&amp;</literal>. These are to work around
- issues in applications where the template must be a valid XML
+ issues in applications where the template must be valid XML
(<literal>&&</literal> is not valid XML/HTML, at most
places), or where the template entered is stored after XML or
HTML escaping. Note that lonely <literal>&amp;</literal>,
@@ -26998,9 +26998,8 @@ TemplateModel x = env.getVariable("x"); // get variable x</programlisting>
<para><literal>Constants.EMPTY_HASH</literal> and
<literal>GeneralPurposeNothing</literal> (the value of
<literal>missingVar!</literal>) now implements
- <literal>TemplateHashModelEx2</literal>, so it can be listed
- with <literal><#list ... as k, v></literal>. Earlier they
- were only a <literal>TemplateHashModelEx</literal>-s.</para>
+ <literal>TemplateHashModelEx2</literal>. Earlier they were only
+ a <literal>TemplateHashModelEx</literal>-s.</para>
</listitem>
<listitem>