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/05 14:26:21 UTC

[01/50] incubator-freemarker git commit: converted the readme from txt to md and added the build status from travis

Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3 bfb836b25 -> a5fb3511f


converted the readme from txt to md and added the build status from travis


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

Branch: refs/heads/2.3
Commit: f871237b3101c9ce531b6b675a77d39793179644
Parents: 93dea88
Author: Pradeep Murugesan <pr...@outlook.com>
Authored: Thu Apr 13 12:30:54 2017 +0200
Committer: Pradeep Murugesan <pr...@outlook.com>
Committed: Thu Apr 13 12:30:54 2017 +0200

----------------------------------------------------------------------
 README    | 237 ----------------------------------------------------
 README.md | 256 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 build.xml |  10 +--
 3 files changed, 260 insertions(+), 243 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f871237b/README
----------------------------------------------------------------------
diff --git a/README b/README
deleted file mode 100644
index c5cfc1e..0000000
--- a/README
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-===============================================================================
-
- Apache FreeMarker {version}
-
- For the latest version or to report bugs visit:
-
- http://freemarker.org/
-
-===============================================================================
-
-  DISCLAIMER
-
-  Apache FreeMarker is an effort undergoing incubation at The Apache
-  Software Foundation (ASF). Incubation is required of all newly accepted
-  projects until a further review indicates that the infrastructure,
-  communications, and decision making process have stabilized in a manner
-  consistent with other successful ASF projects. While incubation status is
-  not necessarily a reflection of the completeness or stability of the
-  code, it does indicate that the project has yet to be fully endorsed by
-  the ASF.
-
-
-What is Apache FreeMarker?
---------------------------
-
-FreeMarker is a "template engine"; a generic tool to generate text
-output (anything from HTML to auto generated source code) based on
-templates. It's a Java package, a class library for Java programmers.
-It's not an application for end-users in itself, but something that
-programmers can embed into their products. FreeMarker is designed to
-be practical for the generation of HTML Web pages, particularly by
-servlet-based applications following the MVC (Model View Controller)
-pattern.
-
-
-Licensing
----------
-
-FreeMarker is licensed under the Apache License, Version 2.0.
-
-See the LICENSE file for more details!
-
-
-Documentation
--------------
-
-Online: http://freemarker.org/docs/
-
-Offline: The full documentation is available in the binary distribution
-in the documentation/index.html directory.
-
-
-Installing
-----------
-
-If you are using Maven, just add this dependency:
-
-  <!--
-  Attention: Be sure nothing pulls in an old dependency with groupId
-  "freemarker" (without the "org."), because then you will end up with
-  two freemarker.jar-s and unpredictable behavior on runtime!
-  -->
-  <dependency>
-    <groupId>org.freemarker</groupId>
-    <artifactId>freemarker</artifactId>
-    <version>{version}</version>
-  </dependency>
-
-Otherwise simply copy freemarker.jar to a location where your Java
-application's ClassLoader will find it. For example, if you are using
-FreeMarker in a web application, you probably want to put
-freemarker.jar into the WEB-INF/lib directory of your web application.
-
-FreeMarker has no required dependencies. It has several optional
-dependencies, but usually you don't have to deal with them, because if
-you are using an optional feature that's certainly because your
-application already uses the related library.
-
-The minimum required Java version is currently Java SE 5. (The presence
-of a later version may be detected on runtime and utilized by
-FreeMarker.)
-
-
-Change log
-----------
-
-Online (for stable releases only):
-http://freemarker.org/docs/app_versions.html
-
-Offline:
-In the binary release, open documentation/index.html, and you will find the
-link.
-
-
-Building
---------
-
-First of all, if you haven't yet, download the source release, or check
-out FreeMarker from the source code repository.
-
-You need JDK 8(!), Apache Ant and Ivy to be installed. (As of this writing
-it was tested with Ant 1.8.1 and Ivy 2.3.0.) To install Ivy (but be sure
-it's not already installed), issue `ant download-ivy`, which will copy it
-under ~/.ant/lib. Alternatively, you can copy ivy-<version>.jar into your
-Ant home directory "lib" subfolder manually.
-
-It's recommended to copy build.properties.sample into build.properties, and
-edit its content to fit your system. (Although basic jar building should
-succeeds without the build.properties file too.)
-
-To build freemarker.jar, just issue "ant" in the project root
-directory, and it should download all dependencies automatically and
-build freemarker.jar.
-
-If later you change the dependencies in ivy.xml, or otherwise want to
-re-download some of them, it will not happen automatically anymore.
-You have to issue "ant update-deps" for that.
-
-
-Eclipse and other IDE setup
----------------------------
-
-Below you find the step-by-step setup for Eclipse Mars.1. If you are using a
-different version or an entierly different IDE, still read this, and try to
-apply it to your development environment:
-
-- Install Ant and Ivy, if you haven't yet; see earlier.
-- From the command line, run `ant clean jar ide-dependencies`. (Note that
-  now the folders "ide-dependencies", "build/generated-sources" and "META-INF"
-  were created.)
-- Start Eclipse
-- You may prefer to start a new workspace (File -> "Switch workspace"), but
-  it's optional.
-- Window -> Preferences
-  - General -> Workspace, set the text file encoding
-    to "UTF-8". (Or, you can set the same later on project level instead.)
-  - General -> Editors, set:
-    - Insert space for tabs
-    - Show print margin, 120 columns
-  - Java -> Code Style -> Formatter -> Import...
-    Select src\ide-settings\Eclipse\Formatter-profile-FreeMarker.xml
-    inside the FreeMarker project directory.
-    (On IntelliJ IDEA, import
-    src/ide-settings/IntelliJ-IDEA/Java-code-style-FreeMarker.xml instead)
-    This profile uses space-only indentation policy and 120 character line
-    width, and formatting rules that are pretty much standard in modern Java.
-  - Java -> Code Style -> Organize imports
-    (On IntelliJ IDEA, this was already configured by the Java code style
-    import earlier.)
-    The order is this (the Eclipse default): java, javax, org, com.
-    Number of imports required for .*: 99
-    Number of static imports needed for .*: 1
-  - Java -> Installed JRE-s:
-    Ensure that you have JDK 8 installed, and that it was added to Eclipse.
-    Note that it's not JRE, but JDK.
-  - Java -> Compiler -> Javadoc:
-    "Malformed Javadoc comments": Error
-    "Only consider members as visible": Private
-    "Validate tag argunebts": true
-    "Missing tag descriptions": Validate @return tags
-    "Missing Javadoc tags": Ignore
-    "Missing Javadoc comments": Ignore
-- Create new "Java Project" in Eclipse:
-  - In the first window popping up:
-    - Change the "location" to the directory of the FreeMarker project
-    - Press "Next"
-  - In the next window, you see the build path settings:
-    - On "Source" tab, ensure that exactly these are marked as source
-      directories (be careful, Eclipse doesn't auto-detect these well):
-        build/generated-sources/java
-        src/main/java
-        src/main/resources
-        src/test/java
-        src/test/resources
-    - On the "Libraries" tab:
-      - Delete everyhing from there, except the "JRE System Library [...]"
-      - Edit "JRE System Library [...]" to "Execution Environment" "JavaSE 1.8"
-      - Add all jar-s that are directly under the "ide-dependencies" directory
-        (use the "Add JARs..." and select all those files).
-    - On the "Order and Export" tab find dom4j-*.jar, and send it to the
-        bottom of the list (becase, an old org.jaxen is included inside
-        dom4j-*.jar, which casues compilation errors if it wins over
-        jaxen-*.jar).
-   - Press "Finish"
-- Eclipse will indicate many errors at this point; it's expected, read on.
-- Project -> Properties -> Java Compiler
-  - Set "Compiler Compliance Level" to "1.5" (you will have to uncheck
-    "Use compliance from execution environment" for that)
-  - In Errors/Warnings, check in "Enable project specific settings", then set
-    "Forbidden reference (access rules)" from "Error" to "Warning".
-- You will still have errors on these java files (because different java
-  files depend on different versions of the same library, and Eclipse can't
-  handle that). Exclude those java files from the Build Path (in the Package
-  Explorer, right click on the problematic file -> "Build Path" -> "Exclude"):
-    _Jython20*.java
-    _Jython22*.java
-    _FreeMarkerPageContext2.java
-    FreeMarkerJspFactory2.java
-    Java8*.java
-  Also, close these files if they are open. Now you shouldn't have any errors.
-- At Project -> Properties -> Java Code Style -> Formatter, check in "Enable
-  project specific settings", and then select "FreeMarker" as active profile.
-- At Project -> Properties -> Java Editor -> Save Actions, check "Enable project
-  specific settings", then "Perform the selected actions on save", and have
-  only "Organize imports" and "Additional actions" checked (the list for the
-  last should contain "Add missing @Override annotations",
-  "Add missing @Override annotations to implementations of interface methods",
-  "Add missing @Deprecated annotations", and "Remove unnecessary cast").
-- Right click on the project -> Run As -> JUnit Test
-  It should run without problems (all green).
-- It's highly recommened to use the Eclipse FindBugs plugin.
-  - Install it from Eclipse Marketplace (3.0.1 as of this writing)
-  - Window -> Preferences -> Java -> FindBugs:
-    Set all bug marker ranks from Warning to Error. (For false alarms we add
-    @SuppressFBWarnings(value = "...", justification = "...") annotations.)
-  - Project -> Properties -> FindBugs -> [x] Run Automatically
-  - There should 0 errors. But sometimes the plugin fails to take the
-    @SuppressFBWarnings annotations into account; then use Project -> Clean. 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f871237b/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7b1b039
--- /dev/null
+++ b/README.md
@@ -0,0 +1,256 @@
+```
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+```
+
+
+Apache FreeMarker {version}   [![Build Status](https://travis-ci.org/apache/incubator-freemarker.svg?branch=2.3-gae)](https://travis-ci.org/apache/incubator-freemarker)
+===========================
+ For the latest version or to report bugs visit:
+
+ http://freemarker.org/
+
+
+
+DISCLAIMER
+==========
+  Apache FreeMarker is an effort undergoing incubation at The Apache
+  Software Foundation (ASF). Incubation is required of all newly accepted
+  projects until a further review indicates that the infrastructure,
+  communications, and decision making process have stabilized in a manner
+  consistent with other successful ASF projects. While incubation status is
+  not necessarily a reflection of the completeness or stability of the
+  code, it does indicate that the project has yet to be fully endorsed by
+  the ASF.
+
+
+What is Apache FreeMarker?
+--------------------------
+
+FreeMarker is a "template engine"; a generic tool to generate text
+output (anything from HTML to auto generated source code) based on
+templates. It's a Java package, a class library for Java programmers.
+It's not an application for end-users in itself, but something that
+programmers can embed into their products. FreeMarker is designed to
+be practical for the generation of HTML Web pages, particularly by
+servlet-based applications following the MVC (Model View Controller)
+pattern.
+
+
+Licensing
+---------
+
+FreeMarker is licensed under the Apache License, Version 2.0.
+
+See the LICENSE file for more details!
+
+
+Documentation
+-------------
+
+Online: http://freemarker.org/docs/
+
+Offline: The full documentation is available in the binary distribution
+in the documentation/index.html directory.
+
+
+Installing
+----------
+
+If you are using Maven, just add this dependency:
+
+```xml
+  <!--
+  Attention: Be sure nothing pulls in an old dependency with groupId
+  "freemarker" (without the "org."), because then you will end up with
+  two freemarker.jar-s and unpredictable behavior on runtime!
+  -->
+  <dependency>
+    <groupId>org.freemarker</groupId>
+    <artifactId>freemarker</artifactId>
+    <version>{version}</version>
+  </dependency>
+```
+Otherwise simply copy freemarker.jar to a location where your Java
+application's ClassLoader will find it. For example, if you are using
+FreeMarker in a web application, you probably want to put
+freemarker.jar into the WEB-INF/lib directory of your web application.
+
+FreeMarker has no required dependencies. It has several optional
+dependencies, but usually you don't have to deal with them, because if
+you are using an optional feature that's certainly because your
+application already uses the related library.
+
+The minimum required Java version is currently Java SE 5. (The presence
+of a later version may be detected on runtime and utilized by
+FreeMarker.)
+
+
+Change log
+----------
+
+Online (for stable releases only):
+http://freemarker.org/docs/app_versions.html
+
+Offline:
+In the binary release, open documentation/index.html, and you will find the
+link.
+
+
+Local setup
+===========
+
+First of all, if you haven't yet, download the source release, or checkout FreeMarker from the source code repository.
+
+You need 
+1. JDK 8(!), 
+2. Apache Ant and 
+3. Ivy 
+
+to be installed. (As of this writing it was tested with Ant 1.8.1 and Ivy 2.3.0.). 
+
+Ivy Installation
+---------------------------
+To install Ivy (but be sure it's not already installed).
+Issue 
+```
+ant download-ivy
+``` 
+which will copy it under ~/.ant/lib. Alternatively, you can copy ivy-<version>.jar into your Ant home directory "lib" subfolder manually.
+
+
+Building
+---------------------------
+
+To build freemarker.jar, just issue 
+```
+ant
+```
+in the project root directory, and it should download all dependencies automatically and build freemarker.jar. 
+
+It's recommended to copy build.properties.sample into build.properties, and edit its content to fit your system. (Although basic jar building should succeeds without the build.properties file too.)
+
+Managing dependencies
+---------------------------
+If later you change the dependencies in ivy.xml, or otherwise want to re-download some of them, it will not happen automatically anymore. Issue 
+```
+ant update-deps
+```
+
+
+Eclipse and other IDE setup
+===========================
+
+Below you find the step-by-step setup for Eclipse Mars.1. If you are using a different version or an entierly different IDE, still read this, and try to apply it to your development environment:
+
+- Install Ant and Ivy, if you haven't yet; see earlier.
+- From the command line, run 
+  ```
+  ant clean jar ide-dependencies
+  ```
+   (Note that now the folders "ide-dependencies", "build/generated-sources" and "META-INF"
+  were created.)
+- Start Eclipse
+- You may prefer to start a new workspace (File -> "Switch workspace"), but
+  it's optional.
+- Window -> Preferences
+  - General -> Workspace, set the text file encoding
+    to "UTF-8". (Or, you can set the same later on project level instead.)
+  - General -> Editors, set:
+    - Insert space for tabs
+    - Show print margin, 120 columns
+  - Java -> Code Style -> Formatter -> Import...
+    Select src\ide-settings\Eclipse\Formatter-profile-FreeMarker.xml
+    inside the FreeMarker project directory.
+    (On IntelliJ IDEA, import
+    src/ide-settings/IntelliJ-IDEA/Java-code-style-FreeMarker.xml instead)
+    This profile uses space-only indentation policy and 120 character line
+    width, and formatting rules that are pretty much standard in modern Java.
+  - Java -> Code Style -> Organize imports
+    (On IntelliJ IDEA, this was already configured by the Java code style
+    import earlier.)
+    The order is this (the Eclipse default): java, javax, org, com.
+    Number of imports required for .*: 99
+    Number of static imports needed for .*: 1
+  - Java -> Installed JRE-s:
+    Ensure that you have JDK 8 installed, and that it was added to Eclipse.
+    Note that it's not JRE, but JDK.
+  - Java -> Compiler -> Javadoc:
+    "Malformed Javadoc comments": Error
+    "Only consider members as visible": Private
+    "Validate tag argunebts": true
+    "Missing tag descriptions": Validate @return tags
+    "Missing Javadoc tags": Ignore
+    "Missing Javadoc comments": Ignore
+- Create new "Java Project" in Eclipse:
+  - In the first window popping up:
+    - Change the "location" to the directory of the FreeMarker project
+    - Press "Next"
+  - In the next window, you see the build path settings:
+    - On "Source" tab, ensure that exactly these are marked as source
+      directories (be careful, Eclipse doesn't auto-detect these well):
+        build/generated-sources/java
+        src/main/java
+        src/main/resources
+        src/test/java
+        src/test/resources
+    - On the "Libraries" tab:
+      - Delete everyhing from there, except the "JRE System Library [...]"
+      - Edit "JRE System Library [...]" to "Execution Environment" "JavaSE 1.8"
+      - Add all jar-s that are directly under the "ide-dependencies" directory
+        (use the "Add JARs..." and select all those files).
+    - On the "Order and Export" tab find dom4j-*.jar, and send it to the
+        bottom of the list (becase, an old org.jaxen is included inside
+        dom4j-*.jar, which casues compilation errors if it wins over
+        jaxen-*.jar).
+   - Press "Finish"
+- Eclipse will indicate many errors at this point; it's expected, read on.
+- Project -> Properties -> Java Compiler
+  - Set "Compiler Compliance Level" to "1.5" (you will have to uncheck
+    "Use compliance from execution environment" for that)
+  - In Errors/Warnings, check in "Enable project specific settings", then set
+    "Forbidden reference (access rules)" from "Error" to "Warning".
+- You will still have errors on these java files (because different java
+  files depend on different versions of the same library, and Eclipse can't
+  handle that). Exclude those java files from the Build Path (in the Package
+  Explorer, right click on the problematic file -> "Build Path" -> "Exclude"):
+    _Jython20*.java
+    _Jython22*.java
+    _FreeMarkerPageContext2.java
+    FreeMarkerJspFactory2.java
+    Java8*.java
+  Also, close these files if they are open. Now you shouldn't have any errors.
+- At Project -> Properties -> Java Code Style -> Formatter, check in "Enable
+  project specific settings", and then select "FreeMarker" as active profile.
+- At Project -> Properties -> Java Editor -> Save Actions, check "Enable project
+  specific settings", then "Perform the selected actions on save", and have
+  only "Organize imports" and "Additional actions" checked (the list for the
+  last should contain "Add missing @Override annotations",
+  "Add missing @Override annotations to implementations of interface methods",
+  "Add missing @Deprecated annotations", and "Remove unnecessary cast").
+- Right click on the project -> Run As -> JUnit Test
+  It should run without problems (all green).
+- It's highly recommened to use the Eclipse FindBugs plugin.
+  - Install it from Eclipse Marketplace (3.0.1 as of this writing)
+  - Window -> Preferences -> Java -> FindBugs:
+    Set all bug marker ranks from Warning to Error. (For false alarms we add
+    @SuppressFBWarnings(value = "...", justification = "...") annotations.)
+  - Project -> Properties -> FindBugs -> [x] Run Automatically
+  - There should 0 errors. But sometimes the plugin fails to take the
+    @SuppressFBWarnings annotations into account; then use Project -> Clean. 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f871237b/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index cf8be0a..861a1b5 100644
--- a/build.xml
+++ b/build.xml
@@ -54,8 +54,6 @@
   </condition>
   <condition property="has.all.explicit.boot.classpaths">
     <and>
-      <isset property="has.explicit.boot.classpath.j2se1.5"/>
-      <isset property="has.explicit.boot.classpath.j2se1.6"/>
       <isset property="has.explicit.boot.classpath.j2se1.8"/>
     </and>
   </condition>
@@ -670,7 +668,7 @@
     <!-- Copy txt-s -->
     <copy todir="${dist.bin.dir}" includeEmptyDirs="no">
       <fileset dir="." defaultexcludes="no">
-        <include name="README" />
+        <include name="README.md" />
         <!-- LICENSE is binary-distribution-specific, and is copied later. -->
         <include name="NOTICE" />
         <include name="DISCLAIMER" />
@@ -678,7 +676,7 @@
       </fileset>
     </copy>
     <replace
-      file="${dist.bin.dir}/README"
+      file="${dist.bin.dir}/README.md"
       token="{version}"
       value="${version}"
     />
@@ -719,7 +717,7 @@
     <!-- Copy extensionless files: -->
     <copy todir="${dist.src.dir}" includeEmptyDirs="no">
       <fileset dir="." defaultexcludes="no">
-        <include name="README" />
+        <include name="README.md" />
         <include name="LICENSE" />
         <include name="NOTICE" />
         <include name="DISCLAIMER" />
@@ -727,7 +725,7 @@
       </fileset>
     </copy>
     <replace
-      file="${dist.src.dir}/README"
+      file="${dist.src.dir}/README.md"
       token="{version}"
       value="${version}"
     />


[11/50] incubator-freemarker git commit: added javadoc task as part of the build process

Posted by dd...@apache.org.
added javadoc task as part of the build process


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

Branch: refs/heads/2.3
Commit: 6dcaf5cb685a4ed9fb90bbac22c5fb20fffe8d03
Parents: 0c22546
Author: Pradeep Murugesan <pr...@outlook.com>
Authored: Sun Apr 16 09:47:49 2017 +0200
Committer: Pradeep Murugesan <pr...@outlook.com>
Committed: Mon Apr 17 15:29:10 2017 +0200

----------------------------------------------------------------------
 .travis.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/6dcaf5cb/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index d663b22..c9a3521 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,7 @@
 language: java
 before_install: ant download-ivy
-install: ant
+install:
+  - ant
+  - ant javadoc
 jdk:
   - oraclejdk8
\ No newline at end of file


[07/50] incubator-freemarker git commit: Added "ci" Ant task

Posted by dd...@apache.org.
Added "ci" Ant task


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

Branch: refs/heads/2.3
Commit: 7295c65f9b3784423a0361dafc9a6c98deb1de66
Parents: 9a60974
Author: ddekany <dd...@apache.org>
Authored: Mon Apr 17 11:39:03 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Mon Apr 17 11:39:03 2017 +0200

----------------------------------------------------------------------
 build.xml | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7295c65f/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 861a1b5..11772d1 100644
--- a/build.xml
+++ b/build.xml
@@ -146,7 +146,6 @@
   <!-- ================================================================= -->
   <!-- Compilation                                                       -->
   <!-- ================================================================= -->
-
   
   <target name="javacc" depends="init" unless="parser.uptodate"
     description="Build the parser from its grammar file"
@@ -992,7 +991,15 @@ Proceed? </input>
     <echo>Note that before releasing, voting is needed!</echo>
     <echo>*****************************************************************</echo>
   </target>
-  
+
+  <!-- ================================================================= -->
+  <!-- CI (like Travis).......................                           -->
+  <!-- ================================================================= -->
+	
+  <target name="ci"
+  	depends="clean, update-deps, jar, test, javadoc"
+  	description="CI should invoke this task"
+  />
   
   <!-- ================================================================== -->
   <!-- Dependency management (keep it exactly identical for all projects) -->


[33/50] incubator-freemarker git commit: Legacy <#call m> haven't set the source code position of m.

Posted by dd...@apache.org.
Legacy <#call m> haven't set the source code position of m.


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

Branch: refs/heads/2.3
Commit: 6f0283d72847aca5d53277c4659c2f1275c7c667
Parents: 1dba510
Author: ddekany <dd...@apache.org>
Authored: Sun Jul 9 00:36:18 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Jul 9 00:38:26 2017 +0200

----------------------------------------------------------------------
 src/main/javacc/FTL.jj | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/6f0283d7/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index fb6106d..385bbea 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -3432,11 +3432,14 @@ TemplateElement Call() :
     Token start, end, id;
     HashMap namedArgs = null;
     ArrayList positionalArgs = null;
-    String macroName= null;
+    Identifier macroName= null;
 }
 {
     start = <CALL>
-    id = <ID> { macroName = id.image; }
+    id = <ID> {
+        macroName = new Identifier(id.image);
+        macroName.setLocation(template, id, id);
+    }
     (
         LOOKAHEAD(<ID><EQUALS>)
         namedArgs = NamedArgs()
@@ -3454,9 +3457,9 @@ TemplateElement Call() :
     {
         UnifiedCall result = null;
         if (positionalArgs != null) {
-            result = new UnifiedCall(new Identifier(macroName), positionalArgs, TemplateElements.EMPTY, null);
+            result = new UnifiedCall(macroName, positionalArgs, TemplateElements.EMPTY, null);
         } else {
-            result = new UnifiedCall(new Identifier(macroName), namedArgs, TemplateElements.EMPTY, null);
+            result = new UnifiedCall(macroName, namedArgs, TemplateElements.EMPTY, null);
         }
         result.legacySyntax = true;
         result.setLocation(template, start, end);


[29/50] incubator-freemarker git commit: Build: Fixed Maven SNAPSHOT deployment (all artifacts use the same build number now). Added "maven-install" task for local installation.

Posted by dd...@apache.org.
Build: Fixed Maven SNAPSHOT deployment (all artifacts use the same build number now). Added "maven-install" task for local installation.


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

Branch: refs/heads/2.3
Commit: 9b3d130acd1f87c11f139b60e45b9b3e809eb5b1
Parents: 96d3971
Author: ddekany <dd...@apache.org>
Authored: Sat Jul 8 00:50:24 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Jul 8 00:50:24 2017 +0200

----------------------------------------------------------------------
 build.xml | 39 ++++++++++++++-------------------------
 1 file changed, 14 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b3d130a/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 5b030bf..32e4168 100644
--- a/build.xml
+++ b/build.xml
@@ -892,7 +892,16 @@
 </project>
 ]]></echo>
   </target>
-  
+
+  <target name="maven-install" depends="jar, maven-pom"
+      description="Installs the jar into the local maven repo (without signing)">
+		<exec executable="${mvnCommand}" failonerror="true">
+			<arg value="install:install-file" />
+			<arg value="-Dfile=build/freemarker.jar" />
+			<arg value="-DpomFile=build/pom.xml" />
+		</exec>
+  </target>
+
   <!--
     Uploads the freemarker.jar that is in the current DISTRIBUTION DIRECTORY
     to a Maven repository (snapshot or central).
@@ -949,7 +958,7 @@ Proceed? </input>
     
 		<!-- Sign and deploy the main artifact -->
 		<exec executable="${mvnCommand}" failonerror="true">
-			<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
+			<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.6:sign-and-deploy-file" />
       <!--
         As we use the gpg plugin instead of a normal Maven "deploy", sadly we can't just
         inherit the repo URL and repositoryId from the parent POM.
@@ -958,35 +967,15 @@ Proceed? </input>
 			<arg value="-DrepositoryId=${maven-server-id}" />
 			<arg value="-DpomFile=build/pom.xml" />
 			<arg value="-Dfile=${dist.bin.dir}/freemarker.jar" />
-      <arg value="-Pgpg" />
-		</exec>
-
-		<!-- Sign and deploy the sources artifact -->
-		<exec executable="${mvnCommand}" failonerror="true">
-			<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
-			<arg value="-Durl=${maven-repository-url}" />
-			<arg value="-DrepositoryId=${maven-server-id}" />
-			<arg value="-DpomFile=build/pom.xml" />
-			<arg value="-Dfile=build/maven-source-attachment.jar" />
-			<arg value="-Dclassifier=sources" />
-      <arg value="-Pgpg" />
-		</exec>
-
-		<!-- Sign and deploy the javadoc artifact -->
-		<exec executable="${mvnCommand}" failonerror="true">
-			<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
-			<arg value="-Durl=${maven-repository-url}" />
-			<arg value="-DrepositoryId=${maven-server-id}" />
-			<arg value="-DpomFile=build/pom.xml" />
-			<arg value="-Dfile=build/maven-javadoc-attachment.jar" />
-			<arg value="-Dclassifier=javadoc" />
+			<arg value="-Dsources=build/maven-source-attachment.jar" />
+			<arg value="-Djavadoc=build/maven-javadoc-attachment.jar" />
       <arg value="-Pgpg" />
 		</exec>
     
     <echo>*****************************************************************</echo>
     <echo>Check the above lines for any Maven errors!</echo>
     <echo>Now you need to close and maybe release the staged repo on</echo>
-    <echo>http://repository.apache.org.</echo>
+    <echo>http://repository.apache.org (except for SNAPSHOT versions).</echo>
     <echo>Note that before releasing, voting is needed!</echo>
     <echo>*****************************************************************</echo>
   </target>


[10/50] incubator-freemarker git commit: Build: Upgraded to Ivy 2.4.0

Posted by dd...@apache.org.
Build: Upgraded to Ivy 2.4.0


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

Branch: refs/heads/2.3
Commit: 0c2254661f54be42d2b10fca8a74cd21a9ac5452
Parents: 30aec8a
Author: ddekany <dd...@apache.org>
Authored: Mon Apr 17 14:51:33 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Mon Apr 17 14:51:33 2017 +0200

----------------------------------------------------------------------
 README.md | 2 +-
 build.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/0c225466/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index eba34dd..d175433 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.3.0) to
+You need JDK 8, Apache Ant (tested with 1.8.1) 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.)

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/0c225466/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 1db2c89..5b030bf 100644
--- a/build.xml
+++ b/build.xml
@@ -131,7 +131,7 @@
     <mkdir dir="build"/>
   </target>
 
-  <property name="ivy.install.version" value="2.3.0" />
+  <property name="ivy.install.version" value="2.4.0" />
   <property name="ivy.home" value="${user.home}/.ant" />
   <property name="ivy.jar.dir" value="${ivy.home}/lib" />
   <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />


[21/50] incubator-freemarker git commit: FREEMARKER-58: Manual example mistakes

Posted by dd...@apache.org.
FREEMARKER-58: Manual example mistakes


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

Branch: refs/heads/2.3
Commit: 367560fecfbbc2733c97f95b4d9afc8ab1431bbf
Parents: dc3277e
Author: ddekany <dd...@apache.org>
Authored: Tue Jun 13 18:57:52 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Tue Jun 13 18:57:52 2017 +0200

----------------------------------------------------------------------
 src/manual/en_US/book.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/367560fe/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 3f003b3..77b13cd 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -5151,9 +5151,9 @@ other@example.com</programlisting>
           <literal>namespace</literal> parameter:</para>
 
           <programlisting role="template">&lt;#import "/lib/example.ftl" as e&gt;
-${my.mail}
+${e.mail}
 &lt;#assign mail="other@example.com" <emphasis>in e</emphasis>&gt;
-${my.mail}</programlisting>
+${e.mail}</programlisting>
 
           <programlisting role="output">user@example.com
 other@example.com</programlisting>
@@ -5218,7 +5218,7 @@ User is: ${user}
 &lt;#import "/lib/example.ftl" as e2&gt;
 &lt;#import "/lib/example.ftl" as e3&gt;
 ${e.mail}, ${e2.mail}, ${e3.mail}
-&lt;#assign mail="other@example.com" in my&gt;
+&lt;#assign mail="other@example.com" in e&gt;
 ${e.mail}, ${e2.mail}, ${e3.mail}</programlisting>
 
           <programlisting role="output">user@example.com, user@example.com, user@example.com


[46/50] incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)

Posted by dd...@apache.org.
(Attempt to fix Travis problem with JUnit)


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

Branch: refs/heads/2.3
Commit: 13ddf6462ad9f9c6d162202ba5e3af29343e4f08
Parents: b9978ed
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 12:24:10 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 5 12:24:10 2017 +0200

----------------------------------------------------------------------
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/13ddf646/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index c0493be..5e1f7ca 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
 language: java
-install: ant download-ivy download-junit
+install: ant download-ivy download-ant-junit
 script: ant ci
 jdk:
   - oraclejdk8
\ No newline at end of file


[22/50] incubator-freemarker git commit: Minor JavaDoc improvements

Posted by dd...@apache.org.
Minor 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/4b5b7e87
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/4b5b7e87
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/4b5b7e87

Branch: refs/heads/2.3
Commit: 4b5b7e8715359effbc39990c01305b9703abf90f
Parents: 367560f
Author: ddekany <dd...@apache.org>
Authored: Fri Jun 23 21:06:16 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Fri Jun 23 21:06:16 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/IfBlock.java           |  2 +-
 src/main/java/freemarker/core/TemplateElement.java   | 11 ++++++-----
 src/main/java/freemarker/core/TemplateObject.java    |  3 ---
 src/main/java/freemarker/ext/beans/BeansWrapper.java |  2 +-
 src/main/java/freemarker/template/Configuration.java | 10 ++++++++--
 src/main/java/freemarker/template/Template.java      |  5 ++++-
 6 files changed, 20 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b5b7e87/src/main/java/freemarker/core/IfBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/IfBlock.java b/src/main/java/freemarker/core/IfBlock.java
index f61e2d3..223d755 100644
--- a/src/main/java/freemarker/core/IfBlock.java
+++ b/src/main/java/freemarker/core/IfBlock.java
@@ -25,7 +25,7 @@ import freemarker.template.TemplateException;
 
 /**
  * Container for a group of related #if, #elseif and #else elements.
- * Each such block is a nested {@link ConditionalBlock}. Note that if an #if has no #else of #elseif,
+ * Each such block is a nested {@link ConditionalBlock}. Note that if an #if has no #else or #elseif,
  * {@link ConditionalBlock} doesn't need this parent element. 
  */
 final class IfBlock extends TemplateElement {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b5b7e87/src/main/java/freemarker/core/TemplateElement.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/TemplateElement.java b/src/main/java/freemarker/core/TemplateElement.java
index f63db63..a8dedea 100644
--- a/src/main/java/freemarker/core/TemplateElement.java
+++ b/src/main/java/freemarker/core/TemplateElement.java
@@ -77,11 +77,12 @@ abstract public class TemplateElement extends TemplateObject {
     abstract TemplateElement[] accept(Environment env) throws TemplateException, IOException;
 
     /**
-     * One-line description of the element, that contain all the information that is used in {@link #getCanonicalForm()}
-     * , except the nested content (elements) of the element. The expressions inside the element (the parameters) has to
-     * be shown. Meant to be used for stack traces, also for tree views that don't go down to the expression-level.
-     * There are no backward-compatibility guarantees regarding the format used ATM, but it must be regular enough to be
-     * machine-parseable, and it must contain all information necessary for restoring an AST equivalent to the original.
+     * One-line description of the element, that contains all the information that is used in
+     * {@link #getCanonicalForm()}, except the nested content (elements) of the element. The expressions inside the
+     * element (the parameters) has to be shown. Meant to be used for stack traces, also for tree views that don't go
+     * down to the expression-level. There are no backward-compatibility guarantees regarding the format used ATM, but
+     * it must be regular enough to be machine-parseable, and it must contain all information necessary for restoring an
+     * AST equivalent to the original.
      * 
      * This final implementation calls {@link #dump(boolean) dump(false)}.
      * 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b5b7e87/src/main/java/freemarker/core/TemplateObject.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/TemplateObject.java b/src/main/java/freemarker/core/TemplateObject.java
index 87ee274..248395d 100644
--- a/src/main/java/freemarker/core/TemplateObject.java
+++ b/src/main/java/freemarker/core/TemplateObject.java
@@ -198,9 +198,6 @@ public abstract class TemplateObject {
      * that is equivalent with the original could be reconstructed from the tree view. Thus, for literal values that are
      * leaf nodes the symbols should be the canonical form of value.
      * 
-     * Note that {@link TemplateElement#getDescription()} has similar role, only it doesn't go under the element level
-     * (i.e. down to the expression level), instead it always prints the embedded expressions itself.
-     * 
      * @see #getCanonicalForm()
      * @see TemplateElement#getDescription()
      */

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b5b7e87/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 93cdcb6..1a10bf0 100644
--- a/src/main/java/freemarker/ext/beans/BeansWrapper.java
+++ b/src/main/java/freemarker/ext/beans/BeansWrapper.java
@@ -1516,7 +1516,7 @@ public class BeansWrapper implements RichObjectWrapper, WriteProtectable {
      * enumeration. To obtain an enum model for a class, get the element of this
      * hash with the fully qualified class name. For example, if you place this 
      * hash model inside the root data model under name "enums", you can use 
-     * i.e. <code>statics["java.math.RoundingMode"].UP</code> to access the 
+     * i.e. <code>enums["java.math.RoundingMode"].UP</code> to access the 
      * {@link java.math.RoundingMode#UP} value.
      * @return a hash model whose keys are fully qualified class names, and
      * that returns hash models whose elements are the enum models of the

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b5b7e87/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 a2df266..42426e8 100644
--- a/src/main/java/freemarker/template/Configuration.java
+++ b/src/main/java/freemarker/template/Configuration.java
@@ -122,7 +122,7 @@ import freemarker.template.utility.XmlEscape;
  *  ...
  *  
  *  // Later, whenever the application needs a template (so you may do this a lot, and from multiple threads):
- *  {@link Template Template} myTemplate = cfg.{@link #getTemplate(String) getTemplate}("myTemplate.html");
+ *  {@link Template Template} myTemplate = cfg.{@link #getTemplate(String) getTemplate}("myTemplate.ftlh");
  *  myTemplate.{@link Template#process(Object, java.io.Writer) process}(dataModel, out);</pre>
  * 
  * <p>A couple of settings that you should not leave on its default value are:
@@ -2324,7 +2324,9 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      * messages (or the column number you get through other API-s). So for example if the users edit templates in an
      * editor where the tab width is set to 4, you should set this to 4 so that the column numbers printed by FreeMarker
      * will match the column number shown in the editor. This setting doesn't affect the output of templates, as a tab
-     * in the template will remain a tab in the output too.
+     * in the template will remain a tab in the output too. If you set this setting to 1, then tab characters will be
+     * kept in the return value of {@link Template#getSource(int, int, int, int)}, otherwise they will be replaced with
+     * the appropriate number of spaces.
      * 
      * @param tabSize
      *            At least 1, at most 256.
@@ -2651,12 +2653,16 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      * default encoding if no encoding is set explicitly for the specified
      * locale. You can associate encodings with locales using 
      * {@link #setEncoding(Locale, String)} or {@link #loadBuiltInEncodingMap()}.
+     * 
+     * @param locale Shouldn't be {@code null}, though for backward compatibility it's accepted when the locale to
+     *               encoding {@link Map} (see earlier) is empty.
      */
     public String getEncoding(Locale locale) {
         if (localeToCharsetMap.isEmpty()) {
             return defaultEncoding;
         } else {
             // Try for a full name match (may include country and variant)
+            NullArgumentException.check("locale", locale);
             String charset = (String) localeToCharsetMap.get(locale.toString());
             if (charset == null) {
                 if (locale.getVariant().length() > 0) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b5b7e87/src/main/java/freemarker/template/Template.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/Template.java b/src/main/java/freemarker/template/Template.java
index 26aa071..6c2aa4e 100644
--- a/src/main/java/freemarker/template/Template.java
+++ b/src/main/java/freemarker/template/Template.java
@@ -33,6 +33,7 @@ import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Vector;
 
@@ -598,7 +599,9 @@ public class Template extends Configurable {
     }
 
     /**
-     * Returns the default character encoding used for reading included files.
+     * The encoding that was (allegedly) used to read this template; also the the default character encoding used for
+     * reading files included from this template. Possibly {@code null}, in which case you are supposed to use
+     * {@link Configuration#getEncoding(Locale)}. 
      */
     public String getEncoding() {
         return this.encoding;


[28/50] incubator-freemarker git commit: FREEMARKER-60: Document interaction between lazy import and #global

Posted by dd...@apache.org.
FREEMARKER-60: Document interaction between lazy import and #global


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

Branch: refs/heads/2.3
Commit: 96d3971cc6f21974729f4fc0a7dec159b5a4ff42
Parents: 5d81db7
Author: ddekany <dd...@apache.org>
Authored: Tue Jul 4 21:05:06 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Tue Jul 4 21:05:06 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/Configurable.java | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/96d3971c/src/main/java/freemarker/core/Configurable.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java
index 4887dfe..492282a 100644
--- a/src/main/java/freemarker/core/Configurable.java
+++ b/src/main/java/freemarker/core/Configurable.java
@@ -1703,16 +1703,20 @@ public class Configurable {
     /**
      * Specifies if {@code <#import ...>} (and {@link Environment#importLib(String, String)}) should delay the loading
      * and processing of the imported templates until the content of the imported namespace is actually accessed. This
-     * makes the overhead of <em>unused</em> imports negligible. A drawback is that importing a missing or otherwise
-     * broken template will be successful, and the problem will remain hidden until (and if) the namespace content is
-     * actually used. Also, you lose the strict control over when the namespace initializing code in the imported
-     * template will be executed, though it shouldn't mater for well written imported templates anyway. Note that the
-     * namespace initializing code will run with the same {@linkplain Configurable#getLocale() locale} as it was at the
-     * point of the {@code <#import ...>} call (other settings won't be handled specially like that).
+     * makes the overhead of <em>unused</em> imports negligible. Note that turning on lazy importing isn't entirely
+     * transparent, as accessing global variables (usually created with {@code <#global ...=...>}) that should be
+     * created by the imported template won't trigger the loading and processing of the lazily imported template
+     * (because globals aren't accessed through the namespace variable), so the global variable will just be missing.
+     * In general, you lose the strict control over when the namespace initializing code in the imported template will
+     * be executed, though it shouldn't mater for most well designed imported templates.
+     * Another drawback is that importing a missing or otherwise broken template will be successful, and the problem
+     * will remain hidden until (and if) the namespace content is actually used. Note that the namespace initializing
+     * code will run with the same {@linkplain Configurable#getLocale() locale} as it was at the point of the
+     * {@code <#import ...>} call (other settings won't be handled specially like that).
      * 
      * <p>
      * The default is {@code false} (and thus imports are eager) for backward compatibility, which can cause
-     * perceivable overhead if you have many imports and only a few of them is used.
+     * perceivable overhead if you have many imports and only a few of them is actually used.
      * 
      * <p>
      * This setting also affects {@linkplain #setAutoImports(Map) auto-imports}, unless you have set a non-{@code null}


[44/50] incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)

Posted by dd...@apache.org.
(Attempt to fix Travis problem with JUnit)


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

Branch: refs/heads/2.3
Commit: 7d01bed48872fba44488720638b3fc40510012c6
Parents: cb819b8
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 12:11:33 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 5 12:11:33 2017 +0200

----------------------------------------------------------------------
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d01bed4/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index fb4fdc1..c68923b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,4 @@
+dist: trusty
 language: java
 install: ant download-ivy
 script: ant ci


[09/50] incubator-freemarker git commit: Improved README build section.

Posted by dd...@apache.org.
Improved README build section.


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

Branch: refs/heads/2.3
Commit: 30aec8a17eaa131edefedf28c26e4f3f488a9214
Parents: fc308a9
Author: ddekany <dd...@apache.org>
Authored: Mon Apr 17 14:37:10 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Mon Apr 17 14:37:10 2017 +0200

----------------------------------------------------------------------
 README.md | 40 +++++++++++++++-------------------------
 1 file changed, 15 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/30aec8a1/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index e460531..eba34dd 100644
--- a/README.md
+++ b/README.md
@@ -94,43 +94,33 @@ In the binary release, open documentation/index.html, and you will find the
 link.
 
 
-Local setup
-===========
+Building FreeMarker
+===================
 
-First of all, if you haven't yet, download the source release, or checkout
-FreeMarker from the source code repository.
+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 and Ivy to be installed. (As of this writing
-it was tested with Ant 1.8.1 and Ivy 2.3.0.). 
-
-
-Ivy Installation
-----------------
-
-To install Ivy (but be sure it's not already installed). Issue
-`ant download-ivy` which will copy it under `~/.ant/lib`. Alternatively, you
-can copy `ivy-<version>.jar` into your Ant home directory `lib` subfolder
-manually.
-
-
-Building
---------
-
-To build `freemarker.jar`, just issue `ant` in the project root directory, and
-it should download all dependencies automatically and build freemarker.jar. 
+You need JDK 8, Apache Ant (tested with 1.8.1) and Ivy (tested with 2.3.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.)
 
 It's recommended to copy `build.properties.sample` into `build.properties`,
 and edit its content to fit your system. (Although basic jar building should
 succeeds without the build.properties file too.)
 
-
-Managing dependencies
----------------------
+To build `freemarker.jar`, just issue `ant` in the project root directory, and
+it should download all dependencies automatically and build `freemarker.jar`. 
 
 If later you change the dependencies in `ivy.xml`, or otherwise want to
 re-download some of them, it will not happen automatically anymore, and you
 must issue `ant update-deps`.
 
+To test your build, issue `ant test`.
+
+To generate documentation, issue `ant javadoc` and `ant manualOffline`.
+
 
 Eclipse and other IDE setup
 ===========================


[27/50] incubator-freemarker git commit: Manual: Improved #attempt/#recover documentation

Posted by dd...@apache.org.
Manual: Improved #attempt/#recover documentation


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

Branch: refs/heads/2.3
Commit: 5d81db7dad0f1a54964b3fc8ec348d41988a9e4d
Parents: c30c699
Author: ddekany <dd...@apache.org>
Authored: Sun Jul 2 19:11:49 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Jul 2 19:11:49 2017 +0200

----------------------------------------------------------------------
 src/manual/en_US/book.xml | 46 +++++++++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/5d81db7d/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 05435b0..fbbee7e 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -2971,7 +2971,7 @@ J</programlisting>
               <secondary>substring</secondary>
             </indexterm>
 
-            <para>You can a slice a string in the same way as you <link
+            <para>You can slice a string in the same way as you <link
             linkend="dgui_template_exp_seqenceop_slice">slice a
             sequence</link> (see there), only here instead of sequence items
             you work with characters. Some differences are:</para>
@@ -2989,7 +2989,8 @@ J</programlisting>
                 multi-typed value), then slicing will slice the sequence
                 instead of the string. When you are processing XML, such
                 values are common. In such cases you can use
-                <literal><replaceable>someXMLnode</replaceable>?string[<replaceable>range</replaceable>]</literal>.</para>
+                <literal><replaceable>someXMLnode</replaceable>?string[<replaceable>range</replaceable>]</literal>
+                to fore string slicing.</para>
               </listitem>
 
               <listitem>
@@ -18876,13 +18877,16 @@ ${x}</programlisting>
           outputted even if the outputting of a certain part of the page
           fails. If an error occurs during the execution of the
           <literal><replaceable>attempt block</replaceable></literal>, then
-          the template execution is not aborted, but the
-          <literal><replaceable>recover block</replaceable></literal> is
-          executed instead of the <literal><replaceable>attempt
-          block</replaceable></literal>. If no error occurs during the
-          execution of the <literal><replaceable>attempt
-          block</replaceable></literal>, then the
+          the output of the <literal><replaceable>attempt
+          block</replaceable></literal> is rolled back <phrase
+          role="forProgrammers">(and the error is logged, with the default
+          configuration at least)</phrase>, and the
           <literal><replaceable>recover block</replaceable></literal> is
+          executed instead, then template execution continues normally after
+          the <literal><replaceable>recover block</replaceable></literal>. If
+          no error occurs during the execution of the
+          <literal><replaceable>attempt block</replaceable></literal>, then
+          the <literal><replaceable>recover block</replaceable></literal> is
           ignored. A simple example:</para>
 
           <programlisting role="template">Primary content
@@ -18893,8 +18897,9 @@ ${x}</programlisting>
 &lt;/#attempt&gt;
 Primary content continued</programlisting>
 
-          <para>If the <literal>thisMayFails</literal> variable doesn't exist,
-          then the output is:</para>
+          <para>If the <literal>thisMayFails</literal> variable doesn't exist
+          (or any other error occurs at that place), then the output
+          is:</para>
 
           <programlisting role="output">Primary content
   Ops! The optional content is not available.
@@ -18953,15 +18958,18 @@ Primary content continued</programlisting>
 
           <para><phrase role="forProgrammers">By default errors occurring
           inside an <literal><replaceable>attempt
-          block</replaceable></literal> are logged as errors. This is because
-          <literal>attempt</literal> is not supposed to be a general purpose
-          error handler mechanism, like <literal>try</literal> is in Java.
-          It's for decreasing the impact of unexpected errors, by making it
-          possible that only part of the page is going down, instead of the
-          whole page. But it's still an error, something that someone should
-          fix. (The way this error is reported can be customized with the
-          <literal>attempt_exception_reporter</literal> configuration
-          setting.)</phrase></para>
+          block</replaceable></literal> are <link
+          linkend="pgui_misc_logging">logged</link> with
+          <literal>ERROR</literal> level, despite that the template recovers
+          from them. This is because <literal>attempt</literal> is not meant
+          to be a general purpose error handler mechanism, like
+          <literal>try</literal> is in Java. It's for decreasing the impact of
+          unexpected errors on the visitors, by making it possible that only
+          part of the page is going down, instead of the whole page. But it's
+          still an error, something that needs the attention of the operators.
+          (The way this error is reported can be customized with the
+          <literal>attempt_exception_reporter</literal> configuration setting,
+          since FreeMarker 2.3.27.)</phrase></para>
         </section>
       </section>
 


[36/50] incubator-freemarker git commit: (Switch parsing cleanup)

Posted by dd...@apache.org.
(Switch parsing 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/3b034066
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/3b034066
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/3b034066

Branch: refs/heads/2.3
Commit: 3b0340661d218a77e2422aed1a73bec1e09b8292
Parents: 507ba1f
Author: ddekany <dd...@apache.org>
Authored: Mon Jul 24 19:50:34 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Mon Jul 24 19:50:34 2017 +0200

----------------------------------------------------------------------
 src/main/javacc/FTL.jj | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3b034066/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index 385bbea..6bd358e 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -3601,21 +3601,22 @@ SwitchBlock Switch() :
         breakableDirectiveNesting++;
         switchBlock = new SwitchBlock(switchExp, ignoredSectionBeforeFirstCase);
     }
-    (
-        LOOKAHEAD(2)
-        caseIns = Case()
-        {
-            if (caseIns.condition == null) {
-                if (defaultFound) {
-                    throw new ParseException(
-                    "You can only have one default case in a switch statement", template, start);
-                }
-                defaultFound = true;
-            }
-            switchBlock.addCase(caseIns);
-        }
-    )*
-    [<STATIC_TEXT_WS>]
+    [
+	    (
+	        caseIns = Case()
+	        {
+	            if (caseIns.condition == null) {
+	                if (defaultFound) {
+	                    throw new ParseException(
+	                    "You can only have one default case in a switch statement", template, start);
+	                }
+	                defaultFound = true;
+	            }
+	            switchBlock.addCase(caseIns);
+	        }
+	    )+
+	    [<STATIC_TEXT_WS>]
+    ]
     end = <END_SWITCH>
     {
         breakableDirectiveNesting--;


[31/50] incubator-freemarker git commit: Some internal AST oversight fixes, and a new internal parser setting, preventStrippings. These are needed for the FM2 to FM3 converter.

Posted by dd...@apache.org.
Some internal AST oversight fixes, and a new internal parser setting, preventStrippings. These are needed for the FM2 to FM3 converter.


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

Branch: refs/heads/2.3
Commit: 9b879885406d687595fb7dafd772087dd83541cb
Parents: a36ea52
Author: ddekany <dd...@apache.org>
Authored: Sat Jul 8 00:53:30 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Jul 8 00:53:30 2017 +0200

----------------------------------------------------------------------
 .../java/freemarker/core/NumericalOutput.java   |  4 ++--
 src/main/java/freemarker/core/TextBlock.java    |  4 ++--
 .../java/freemarker/core/TrimInstruction.java   |  8 +++----
 src/main/java/freemarker/core/_CoreAPI.java     |  4 ++++
 .../java/freemarker/template/Configuration.java | 22 +++++++++++++++++++-
 src/main/java/freemarker/template/Template.java |  9 +++++---
 .../java/freemarker/template/_TemplateAPI.java  |  4 ++++
 src/main/javacc/FTL.jj                          | 15 ++++++++++---
 .../freemarker/core/ast-strlitinterpolation.ast |  4 ++--
 9 files changed, 57 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/src/main/java/freemarker/core/NumericalOutput.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/NumericalOutput.java b/src/main/java/freemarker/core/NumericalOutput.java
index bd1ed11..08e8301 100644
--- a/src/main/java/freemarker/core/NumericalOutput.java
+++ b/src/main/java/freemarker/core/NumericalOutput.java
@@ -150,8 +150,8 @@ final class NumericalOutput extends Interpolation {
     Object getParameterValue(int idx) {
         switch (idx) {
         case 0: return expression;
-        case 1: return Integer.valueOf(minFracDigits);
-        case 2: return Integer.valueOf(maxFracDigits);
+        case 1: return hasFormat ? Integer.valueOf(minFracDigits) : null;
+        case 2: return hasFormat ? Integer.valueOf(maxFracDigits) : null;
         default: throw new IndexOutOfBoundsException();
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/src/main/java/freemarker/core/TextBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/TextBlock.java b/src/main/java/freemarker/core/TextBlock.java
index fb343fa..8be305b 100644
--- a/src/main/java/freemarker/core/TextBlock.java
+++ b/src/main/java/freemarker/core/TextBlock.java
@@ -143,8 +143,8 @@ public final class TextBlock extends TemplateElement {
     private boolean deliberateLeftTrim() {
         boolean result = false;
         for (TemplateElement elem = this.nextTerminalNode(); 
-             elem != null && elem.beginLine == this.endLine;
-             elem = elem.nextTerminalNode()) {
+            elem != null && elem.beginLine == this.endLine;
+            elem = elem.nextTerminalNode()) {
             if (elem instanceof TrimInstruction) {
                 TrimInstruction ti = (TrimInstruction) elem;
                 if (!ti.left && !ti.right) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/src/main/java/freemarker/core/TrimInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/TrimInstruction.java b/src/main/java/freemarker/core/TrimInstruction.java
index 1279b99..a563a8a 100644
--- a/src/main/java/freemarker/core/TrimInstruction.java
+++ b/src/main/java/freemarker/core/TrimInstruction.java
@@ -25,10 +25,10 @@ package freemarker.core;
  */
 final class TrimInstruction extends TemplateElement {
     
-    private static final int TYPE_T = 0;  
-    private static final int TYPE_LT = 1;  
-    private static final int TYPE_RT = 2;  
-    private static final int TYPE_NT = 3;  
+    static final int TYPE_T = 0;  
+    static final int TYPE_LT = 1;  
+    static final int TYPE_RT = 2;  
+    static final int TYPE_NT = 3;  
 
     final boolean left, right;
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/src/main/java/freemarker/core/_CoreAPI.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/_CoreAPI.java b/src/main/java/freemarker/core/_CoreAPI.java
index 66442da..1f10f81 100644
--- a/src/main/java/freemarker/core/_CoreAPI.java
+++ b/src/main/java/freemarker/core/_CoreAPI.java
@@ -213,5 +213,9 @@ public class _CoreAPI {
     public static TemplateElement getChildElement(TemplateElement te, int index) {
         return te.getChild(index);
     }
+
+    public static void setPreventStrippings(FMParser parser, boolean preventStrippings) {
+        parser.setPreventStrippings(preventStrippings);
+    }
     
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/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 57b0121..5956a39 100644
--- a/src/main/java/freemarker/template/Configuration.java
+++ b/src/main/java/freemarker/template/Configuration.java
@@ -499,7 +499,8 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
     private Version incompatibleImprovements;
     private int tagSyntax = ANGLE_BRACKET_TAG_SYNTAX;
     private int namingConvention = AUTO_DETECT_NAMING_CONVENTION;
-    private int tabSize = 8;  // Default from JavaCC 3.x 
+    private int tabSize = 8;  // Default from JavaCC 3.x
+    private boolean preventStrippings;
 
     private TemplateCache cache;
     
@@ -2399,6 +2400,25 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
     }
     
     /**
+     * Getter pair of {@link #setPreventStrippings(boolean)}.
+     * 
+     * @since 2.3.27
+     */
+    boolean getPreventStrippings() {
+        return preventStrippings;
+    }
+
+    /**
+     * Used internally; added for the FreeMarker 2 to FreeMarker 3 converter, prevents the stripping/removal of AST
+     * nodes so that the source code can be fully reproduced from the AST.
+     * 
+     * @since 2.3.27
+     */
+    void setPreventStrippings(boolean preventStrippings) {
+        this.preventStrippings = preventStrippings;
+    }
+
+    /**
      * Retrieves the template with the given name from the template cache, loading it into the cache first if it's
      * missing/staled.
      * 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/src/main/java/freemarker/template/Template.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/Template.java b/src/main/java/freemarker/template/Template.java
index 6c2aa4e..240e527 100644
--- a/src/main/java/freemarker/template/Template.java
+++ b/src/main/java/freemarker/template/Template.java
@@ -225,9 +225,9 @@ public class Template extends Configurable {
      * @since 2.3.24
      */
     public Template(
-            String name, String sourceName, Reader reader,
-            Configuration cfg, ParserConfiguration customParserConfiguration,
-            String encoding) throws IOException {
+           String name, String sourceName, Reader reader,
+           Configuration cfg, ParserConfiguration customParserConfiguration,
+           String encoding) throws IOException {
         this(name, sourceName, cfg, customParserConfiguration);
         
         this.setEncoding(encoding);
@@ -243,6 +243,9 @@ public class Template extends Configurable {
             
             try {
                 FMParser parser = new FMParser(this, reader, actualParserConfiguration);
+                if (cfg != null) {
+                    _CoreAPI.setPreventStrippings(parser, cfg.getPreventStrippings());
+                }
                 try {
                     this.rootElement = parser.Root();
                 } catch (IndexOutOfBoundsException exc) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/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 373e0e6..22cbc21 100644
--- a/src/main/java/freemarker/template/_TemplateAPI.java
+++ b/src/main/java/freemarker/template/_TemplateAPI.java
@@ -164,5 +164,9 @@ public class _TemplateAPI {
     public static TimeZone getDefaultTimeZone() {
         return Configuration.getDefaultTimeZone();
     }
+
+    public static void setPreventStrippings(Configuration conf, boolean preventStrippings) {
+        conf.setPreventStrippings(preventStrippings);
+    }
     
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index 75c7784..94338af 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -70,7 +70,7 @@ public class FMParser {
 
     private Template template;
 
-    private boolean stripWhitespace, stripText;
+    private boolean stripWhitespace, stripText, preventStrippings;
     private int incompatibleImprovements;
     private OutputFormat outputFormat;
     private int autoEscapingPolicy;
@@ -291,6 +291,13 @@ public class FMParser {
         parentTokenSource.namingConvention = token_source.namingConvention;
         parentTokenSource.namingConventionEstabilisher = token_source.namingConventionEstabilisher;
     }
+    
+    /**
+     * Used when we need to recreate the source code from the AST (such as for the FM2 to FM3 converter).
+     */
+    void setPreventStrippings(boolean preventStrippings) {
+        this.preventStrippings = preventStrippings;
+    }
 
     private OutputFormat getFormatFromStdFileExt() {
         String sourceName = template.getSourceName();
@@ -3975,7 +3982,7 @@ TextBlock PCData() :
         }
     )+
     {
-        if (stripText && mixedContentNesting == 1) return null;
+        if (stripText && mixedContentNesting == 1 && !preventStrippings) return null;
 
         TextBlock result = new TextBlock(buf.toString(), false);
         result.setLocation(template, start, t);
@@ -4383,7 +4390,9 @@ TemplateElement Root() :
     {
         TemplateElement root = children.asSingleElement(); 
         root.setFieldsForRootElement();
-        root = root.postParseCleanup(stripWhitespace);
+        if (!preventStrippings) {
+            root = root.postParseCleanup(stripWhitespace);
+        }
         // The cleanup result is possibly an element from deeper:
         root.setFieldsForRootElement();
         return root;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/src/test/resources/freemarker/core/ast-strlitinterpolation.ast
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/core/ast-strlitinterpolation.ast b/src/test/resources/freemarker/core/ast-strlitinterpolation.ast
index 7d14e80..e8130bb 100644
--- a/src/test/resources/freemarker/core/ast-strlitinterpolation.ast
+++ b/src/test/resources/freemarker/core/ast-strlitinterpolation.ast
@@ -60,8 +60,8 @@
                 - content: x  // f.c.Identifier
             - value part: #{...}  // f.c.NumericalOutput
                 - content: y  // f.c.Identifier
-                - minimum decimals: "0"  // Integer
-                - maximum decimals: "0"  // Integer
+                - minimum decimals: null  // Null
+                - maximum decimals: null  // Null
     #text  // f.c.TextBlock
         - content: "\n6. "  // String
     ${...}  // f.c.DollarVariable


[14/50] incubator-freemarker git commit: travis.yml file update

Posted by dd...@apache.org.
travis.yml file update

Merge commit 'refs/pull/22/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/a4273fc8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/a4273fc8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/a4273fc8

Branch: refs/heads/2.3
Commit: a4273fc8e3d971f81d20eef76902d132106fe1f0
Parents: e64dc4d 4d6897e
Author: ddekany <dd...@apache.org>
Authored: Tue Apr 18 10:33:48 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Tue Apr 18 10:35:04 2017 +0200

----------------------------------------------------------------------
 .travis.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[47/50] incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)

Posted by dd...@apache.org.
(Attempt to fix Travis problem with JUnit)


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

Branch: refs/heads/2.3
Commit: c2fcbc8dd55dfc95538a23b8a34b9df9fb7c3ea2
Parents: 13ddf64
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 12:38:00 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 5 12:38:00 2017 +0200

----------------------------------------------------------------------
 build.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c2fcbc8d/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 1e7e340..7f5b57a 100644
--- a/build.xml
+++ b/build.xml
@@ -141,7 +141,8 @@
          dest="${ivy.jar.file}" usetimestamp="true"/>
   </target>
 
-  <property name="ant-junit.install.version" value="1.10.1" />
+  <!-- Since 2017-08-05 or so, ant-junit was gone from Ant on Travis, hence we need this there: -->
+  <property name="ant-junit.install.version" value="${ant.version}" />
   <property name="ant-junit.home" value="${user.home}/.ant" />
   <property name="ant-junit.jar.dir" value="${ant-junit.home}/lib" />
   <property name="ant-junit.jar.file" value="${ant-junit.jar.dir}/ant-junit.jar" />


[37/50] incubator-freemarker git commit: (Bit of jj code formatting)

Posted by dd...@apache.org.
(Bit of jj code formatting)


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

Branch: refs/heads/2.3
Commit: 77e877c7657c404d78d2f968273fd05160b9df89
Parents: 3b03406
Author: ddekany <dd...@apache.org>
Authored: Thu Jul 27 18:51:28 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Thu Jul 27 18:51:28 2017 +0200

----------------------------------------------------------------------
 src/main/javacc/FTL.jj | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/77e877c7/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index 6bd358e..b011c41 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -3360,12 +3360,13 @@ TemplateElement UnifiedMacroTransform() :
         positionalArgs = PositionalArgs()
     )
     [
-        <SEMICOLON>{bodyParameters = new ArrayList(4); }
+        <SEMICOLON>
+        { bodyParameters = new ArrayList(4); }
         [
             [<TERMINATING_WHITESPACE>] t = <ID> { bodyParameters.add(t.image); }
             (
                 [<TERMINATING_WHITESPACE>] <COMMA>
-                [<TERMINATING_WHITESPACE>] t = <ID>{bodyParameters.add(t.image); }
+                [<TERMINATING_WHITESPACE>] t = <ID> {bodyParameters.add(t.image); }
             )*
         ]
     ]


[08/50] incubator-freemarker git commit: Build: offline check not needed for download-ivy

Posted by dd...@apache.org.
Build: offline check not needed for download-ivy


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

Branch: refs/heads/2.3
Commit: fc308a95e6d145d1cffa92dec56341943a8dce04
Parents: 7295c65
Author: ddekany <dd...@apache.org>
Authored: Mon Apr 17 13:13:49 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Mon Apr 17 13:13:49 2017 +0200

----------------------------------------------------------------------
 build.xml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/fc308a95/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 11772d1..1db2c89 100644
--- a/build.xml
+++ b/build.xml
@@ -136,8 +136,7 @@
   <property name="ivy.jar.dir" value="${ivy.home}/lib" />
   <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
 
-  <target name="download-ivy" unless="offline">
-
+  <target name="download-ivy">
     <mkdir dir="${ivy.jar.dir}"/>
     <get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
          dest="${ivy.jar.file}" usetimestamp="true"/>


[25/50] incubator-freemarker git commit: Fixed wrong test

Posted by dd...@apache.org.
Fixed wrong test


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

Branch: refs/heads/2.3
Commit: 387dcd44ff8f0c56f9c4c6508025c2a68e54ea14
Parents: f933ed0
Author: ddekany <dd...@apache.org>
Authored: Wed Jun 28 15:22:37 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Wed Jun 28 15:22:37 2017 +0200

----------------------------------------------------------------------
 .../freemarker/test/templatesuite/templates/boolean.ftl          | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/387dcd44/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl b/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl
index a76d9b9..49816ee 100644
--- a/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl
+++ b/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl
@@ -71,9 +71,9 @@
 <#else>
     boolean4 && boolean5 failed.<br />
 </#if></p>
-<@assert test=boolean4 &amp;&amp; boolean5 />
+<@assert test=true &amp;&amp; true />
 <@assert test=!(false &amp;&amp; true) />
-<@assert test=boolean4 \and boolean5 />
+<@assert test=true \and true />
 <@assert test=!(false \and true) />
  
 <p>Now test list models:</p>


[50/50] 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/a5fb3511
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/a5fb3511
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/a5fb3511

Branch: refs/heads/2.3
Commit: a5fb3511f13dbf6fb20ea85de120a2e8bb6175fe
Parents: bfb836b 67691b4
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 16:23:16 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 5 16:23:16 2017 +0200

----------------------------------------------------------------------
 .travis.yml                                     |   9 +
 README                                          | 234 --------------
 README.md                                       | 223 +++++++++++++
 build.xml                                       |  74 ++---
 .../freemarker/cache/TemplateNameFormat.java    |   4 +-
 .../java/freemarker/core/ArithmeticEngine.java  |   8 +-
 .../java/freemarker/core/BlockAssignment.java   |  84 ++---
 .../core/BuiltInsForMultipleTypes.java          |   2 +-
 src/main/java/freemarker/core/Case.java         |   4 +-
 src/main/java/freemarker/core/Configurable.java | 174 +++++++---
 src/main/java/freemarker/core/Environment.java  |  45 ++-
 src/main/java/freemarker/core/IfBlock.java      |   2 +-
 .../java/freemarker/core/NumericalOutput.java   |   4 +-
 src/main/java/freemarker/core/SwitchBlock.java  |  31 +-
 .../freemarker/core/TemplateConfiguration.java  |  15 +-
 .../java/freemarker/core/TemplateElement.java   |  11 +-
 .../java/freemarker/core/TemplateObject.java    |   3 -
 src/main/java/freemarker/core/TextBlock.java    |   4 +-
 .../java/freemarker/core/TrimInstruction.java   |   8 +-
 src/main/java/freemarker/core/_CoreAPI.java     |   4 +
 src/main/java/freemarker/core/_Java8Impl.java   |   2 +-
 .../core/_ObjectBuilderSettingEvaluator.java    |   3 +-
 .../java/freemarker/ext/beans/BeansWrapper.java |   2 +-
 .../template/AttemptExceptionReporter.java      |  48 +++
 .../java/freemarker/template/Configuration.java |  91 +++++-
 .../template/GeneralPurposeNothing.java         |  15 +-
 .../LoggingAttemptExceptionReporter.java        |  29 ++
 src/main/java/freemarker/template/Template.java |  14 +-
 .../template/TemplateExceptionHandler.java      |   8 +-
 .../template/TemplateNodeModelEx.java           |   4 +-
 .../java/freemarker/template/_TemplateAPI.java  |   9 +
 .../freemarker/template/utility/Constants.java  |  36 ++-
 src/main/javacc/FTL.jj                          | 136 ++++++--
 .../resources/freemarker/version.properties     |  11 +-
 src/manual/en_US/book.xml                       | 324 +++++++++++++++----
 .../freemarker/core/AttemptLoggingTest.java     |  77 +++++
 .../core/CapturingAssignmentTest.java           |  55 ++++
 .../core/ParsingErrorMessagesTest.java          |   2 +
 .../core/TemplateConfigurationTest.java         |   2 +
 .../freemarker/template/ConfigurationTest.java  |  12 +
 .../template/DefaultObjectWrapperTest.java      |   1 +
 .../template/utility/ConstantsTest.java         |  21 ++
 .../freemarker/core/ast-strlitinterpolation.ast |   4 +-
 .../test/templatesuite/expected/switch.txt      |   2 +
 .../test/templatesuite/templates/boolean.ftl    |   4 +
 .../test/templatesuite/templates/switch.ftl     |   3 +
 46 files changed, 1296 insertions(+), 562 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5fb3511/build.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5fb3511/src/main/java/freemarker/core/TemplateElement.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5fb3511/src/main/java/freemarker/template/Template.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5fb3511/src/main/resources/freemarker/version.properties
----------------------------------------------------------------------


[43/50] incubator-freemarker git commit: (JavaDoc adjustment...)

Posted by dd...@apache.org.
(JavaDoc adjustment...)


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

Branch: refs/heads/2.3
Commit: cb819b8aa2f0da9f6cf398b4fc33b59fc66a0c3e
Parents: 889b8a9
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 11:57:50 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 5 11:57:50 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/ArithmeticEngine.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cb819b8a/src/main/java/freemarker/core/ArithmeticEngine.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/ArithmeticEngine.java b/src/main/java/freemarker/core/ArithmeticEngine.java
index 5e485b8..9eedf64 100644
--- a/src/main/java/freemarker/core/ArithmeticEngine.java
+++ b/src/main/java/freemarker/core/ArithmeticEngine.java
@@ -38,7 +38,8 @@ public abstract class ArithmeticEngine {
 
     /**
      * Arithmetic engine that converts all numbers to {@link BigDecimal} and
-     * then operates on them. This is FreeMarker's default arithmetic engine.
+     * then operates on them, and also keeps the result as a {@link BigDecimal}. This is FreeMarker's default arithmetic
+     * engine.
      */
     public static final BigDecimalEngine BIGDECIMAL_ENGINE = new BigDecimalEngine();
     /**


[48/50] incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)

Posted by dd...@apache.org.
(Attempt to fix Travis problem with JUnit)


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

Branch: refs/heads/2.3
Commit: c688e15c7049d61523a709c43e0a6bd7b8df59dd
Parents: c2fcbc8
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 12:41:55 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 5 12:41:55 2017 +0200

----------------------------------------------------------------------
 build.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c688e15c/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 7f5b57a..4f45785 100644
--- a/build.xml
+++ b/build.xml
@@ -142,7 +142,8 @@
   </target>
 
   <!-- Since 2017-08-05 or so, ant-junit was gone from Ant on Travis, hence we need this there: -->
-  <property name="ant-junit.install.version" value="${ant.version}" />
+  <antversion property="antVersionNumber"/>
+  <property name="ant-junit.install.version" value="${antVersionNumber}" />
   <property name="ant-junit.home" value="${user.home}/.ant" />
   <property name="ant-junit.jar.dir" value="${ant-junit.home}/lib" />
   <property name="ant-junit.jar.file" value="${ant-junit.jar.dir}/ant-junit.jar" />


[45/50] incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)

Posted by dd...@apache.org.
(Attempt to fix Travis problem with JUnit)


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

Branch: refs/heads/2.3
Commit: b9978edde7822046f81c0976a10028940d9bd990
Parents: 7d01bed
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 12:22:49 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 5 12:22:49 2017 +0200

----------------------------------------------------------------------
 .travis.yml |  3 +--
 build.xml   | 11 ++++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/b9978edd/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index c68923b..c0493be 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,5 @@
-dist: trusty
 language: java
-install: ant download-ivy
+install: ant download-ivy download-junit
 script: ant ci
 jdk:
   - oraclejdk8
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/b9978edd/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 32e4168..1e7e340 100644
--- a/build.xml
+++ b/build.xml
@@ -135,12 +135,21 @@
   <property name="ivy.home" value="${user.home}/.ant" />
   <property name="ivy.jar.dir" value="${ivy.home}/lib" />
   <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
-
   <target name="download-ivy">
     <mkdir dir="${ivy.jar.dir}"/>
     <get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
          dest="${ivy.jar.file}" usetimestamp="true"/>
   </target>
+
+  <property name="ant-junit.install.version" value="1.10.1" />
+  <property name="ant-junit.home" value="${user.home}/.ant" />
+  <property name="ant-junit.jar.dir" value="${ant-junit.home}/lib" />
+  <property name="ant-junit.jar.file" value="${ant-junit.jar.dir}/ant-junit.jar" />
+  <target name="download-ant-junit">
+    <mkdir dir="${ant-junit.jar.dir}"/>
+    <get src="https://repo1.maven.org/maven2/org/apache/ant/ant-junit/${ant-junit.install.version}/ant-junit-${ant-junit.install.version}.jar"
+         dest="${ant-junit.jar.file}" usetimestamp="true"/>
+  </target>
   
   <!-- ================================================================= -->
   <!-- Compilation                                                       -->


[23/50] incubator-freemarker git commit: Improved #attempt error reporting:

Posted by dd...@apache.org.
Improved #attempt error reporting:

- Added new configuration setting, attempt_exception_reporter (Configurable.setAttemptExceptionReporter(AttemptExceptionReporter)), to allow the customization of how the exceptions handled (and thus suppressed) by the "attempt" directive are reported. The default AttemptExceptionReporter logs the exception as an error, just as it was in earlier versions, though now the error message will indicate that the exception was thrown inside an attempt directive block.
- Bug fixed: When the TemplateExceptionHandler suppresses (i.e., doesn't re-throw) an exception, the attempt directive won't log it anymore. (To be precise, the AttemptExceptionReporter won't be invoked for it anymore; the default one logs as error.)


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

Branch: refs/heads/2.3
Commit: 304df82a7501f66386b2c5be740d377961f93dc5
Parents: 4b5b7e8
Author: ddekany <dd...@apache.org>
Authored: Wed Jun 28 01:42:10 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Wed Jun 28 01:42:26 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/Configurable.java | 107 ++++++++++++++++---
 src/main/java/freemarker/core/Environment.java  |  27 +++--
 .../freemarker/core/TemplateConfiguration.java  |   7 ++
 .../template/AttemptExceptionReporter.java      |  48 +++++++++
 .../java/freemarker/template/Configuration.java |  45 ++++++++
 .../LoggingAttemptExceptionReporter.java        |  29 +++++
 .../template/TemplateExceptionHandler.java      |   8 +-
 .../java/freemarker/template/_TemplateAPI.java  |   5 +
 src/manual/en_US/book.xml                       |  66 +++++++++---
 .../freemarker/core/AttemptLoggingTest.java     |  77 +++++++++++++
 .../core/TemplateConfigurationTest.java         |   2 +
 .../freemarker/template/ConfigurationTest.java  |  12 +++
 12 files changed, 392 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/src/main/java/freemarker/core/Configurable.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java
index 914015a..9084956 100644
--- a/src/main/java/freemarker/core/Configurable.java
+++ b/src/main/java/freemarker/core/Configurable.java
@@ -52,6 +52,7 @@ import freemarker.cache.PathRegexMatcher;
 import freemarker.cache.TemplateLoader;
 import freemarker.ext.beans.BeansWrapper;
 import freemarker.ext.beans.BeansWrapperBuilder;
+import freemarker.template.AttemptExceptionReporter;
 import freemarker.template.Configuration;
 import freemarker.template.DefaultObjectWrapper;
 import freemarker.template.ObjectWrapper;
@@ -162,6 +163,13 @@ public class Configurable {
     /** Alias to the {@code ..._SNAKE_CASE} variation due to backward compatibility constraints. */
     public static final String TEMPLATE_EXCEPTION_HANDLER_KEY = TEMPLATE_EXCEPTION_HANDLER_KEY_SNAKE_CASE;
     
+    /** Legacy, snake case ({@code like_this}) variation of the setting name. @since 2.3.27 */
+    public static final String ATTEMPT_EXCEPTION_REPORTER_KEY_SNAKE_CASE = "attempt_exception_reporter";
+    /** Modern, camel case ({@code likeThis}) variation of the setting name. @since 2.3.27 */
+    public static final String ATTEMPT_EXCEPTION_REPORTER_KEY_CAMEL_CASE = "attemptExceptionReporter";
+    /** Alias to the {@code ..._SNAKE_CASE} variation due to backward compatibility constraints. */
+    public static final String ATTEMPT_EXCEPTION_REPORTER_KEY = ATTEMPT_EXCEPTION_REPORTER_KEY_SNAKE_CASE;
+    
     /** Legacy, snake case ({@code like_this}) variation of the setting name. @since 2.3.23 */
     public static final String ARITHMETIC_ENGINE_KEY_SNAKE_CASE = "arithmetic_engine";
     /** Modern, camel case ({@code likeThis}) variation of the setting name. @since 2.3.23 */
@@ -275,6 +283,7 @@ public class Configurable {
         // Must be sorted alphabetically!
         API_BUILTIN_ENABLED_KEY_SNAKE_CASE,
         ARITHMETIC_ENGINE_KEY_SNAKE_CASE,
+        ATTEMPT_EXCEPTION_REPORTER_KEY_SNAKE_CASE,
         AUTO_FLUSH_KEY_SNAKE_CASE,
         AUTO_IMPORT_KEY_SNAKE_CASE,
         AUTO_INCLUDE_KEY_SNAKE_CASE,
@@ -305,6 +314,7 @@ public class Configurable {
         // Must be sorted alphabetically!
         API_BUILTIN_ENABLED_KEY_CAMEL_CASE,
         ARITHMETIC_ENGINE_KEY_CAMEL_CASE,
+        ATTEMPT_EXCEPTION_REPORTER_KEY_CAMEL_CASE,
         AUTO_FLUSH_KEY_CAMEL_CASE,
         AUTO_IMPORT_KEY_CAMEL_CASE,
         AUTO_INCLUDE_KEY_CAMEL_CASE,
@@ -348,6 +358,7 @@ public class Configurable {
     private String falseStringValue;  // deduced from booleanFormat
     private Integer classicCompatible;
     private TemplateExceptionHandler templateExceptionHandler;
+    private AttemptExceptionReporter attemptExceptionReporter;
     private ArithmeticEngine arithmeticEngine;
     private ObjectWrapper objectWrapper;
     private String outputEncoding;
@@ -412,9 +423,10 @@ public class Configurable {
         classicCompatible = Integer.valueOf(0);
         properties.setProperty(CLASSIC_COMPATIBLE_KEY, classicCompatible.toString());
         
-        templateExceptionHandler = _TemplateAPI.getDefaultTemplateExceptionHandler(
-                incompatibleImprovements);
+        templateExceptionHandler = _TemplateAPI.getDefaultTemplateExceptionHandler(incompatibleImprovements);
         properties.setProperty(TEMPLATE_EXCEPTION_HANDLER_KEY, templateExceptionHandler.getClass().getName());
+
+        attemptExceptionReporter = _TemplateAPI.getDefaultAttemptExceptionReporter(incompatibleImprovements);
         
         arithmeticEngine = ArithmeticEngine.BIGDECIMAL_ENGINE;
         properties.setProperty(ARITHMETIC_ENGINE_KEY, arithmeticEngine.getClass().getName());
@@ -461,12 +473,8 @@ public class Configurable {
      */
     public Configurable(Configurable parent) {
         this.parent = parent;
-        locale = null;
-        numberFormat = null;
-        classicCompatible = null;
-        templateExceptionHandler = null;
         properties = new Properties(parent.properties);
-        customAttributes = new HashMap(0);
+        customAttributes = new HashMap<Object, Object>(0);
     }
     
     @Override
@@ -1313,7 +1321,16 @@ public class Configurable {
      * Neither is it meant to be used to roll back the printed output. These should be solved outside template
      * processing when the exception raises from {@link Template#process(Object, Writer) Template.process}.
      * {@link TemplateExceptionHandler} meant to be used if you want to include special content <em>in</em> the template
-     * output, or if you want to suppress certain exceptions. 
+     * output, or if you want to suppress certain exceptions. If you suppress an exception, and the
+     * {@link Environment#getLogTemplateExceptions()} returns {@code false}, then it's the responsibility of the
+     * {@link TemplateExceptionHandler} to log the exception (if you want it to be logged).  
+     *  
+     * <p>The {@link #setLogTemplateExceptions(boolean) log_template_exceptions} and
+     * {@link #setAttemptExceptionReporter(AttemptExceptionReporter) attempt_exception_reporter} settings take effect
+     * before the {@link TemplateExceptionHandler} is invoked, so these settings are technically independent, and deal
+     * with different aspects of exception handling.  
+     * 
+     * @see #setAttemptExceptionReporter(AttemptExceptionReporter)
      */
     public void setTemplateExceptionHandler(TemplateExceptionHandler templateExceptionHandler) {
         NullArgumentException.check("templateExceptionHandler", templateExceptionHandler);
@@ -1337,6 +1354,44 @@ public class Configurable {
     public boolean isTemplateExceptionHandlerSet() {
         return templateExceptionHandler != null;
     }
+    
+    /**
+     * Specifies how exceptions handled (and hence suppressed) by an {@code #attempt} blocks will be logged or otherwise
+     * reported. The default value is {@link AttemptExceptionReporter#LOG_ERROR_REPORTER}.
+     * 
+     * <p>Note that {@code #attempt} is not supposed to be a general purpose error handler mechanism, like {@code try}
+     * is in Java. It's for decreasing the impact of unexpected errors, by making it possible that only part of the
+     * page is going down, instead of the whole page. But it's still an error, something that someone should fix. So the
+     * error should be reported, not just ignored in a custom {@link AttemptExceptionReporter}-s.
+     * 
+     * <p>The {@link AttemptExceptionReporter} is invoked regardless of the value of the
+     * {@link #setLogTemplateExceptions(boolean) log_template_exceptions} setting.
+     * 
+     * @since 2.3.27
+     */
+    public void setAttemptExceptionReporter(AttemptExceptionReporter attemptExceptionReporter) {
+        NullArgumentException.check("attemptExceptionReporter", attemptExceptionReporter);
+        this.attemptExceptionReporter = attemptExceptionReporter;
+    }
+    
+    /**
+     * The getter pair of {@link #setAttemptExceptionReporter(AttemptExceptionReporter)}.
+     * 
+     * @since 2.3.27
+     */
+    public AttemptExceptionReporter getAttemptExceptionReporter() {
+        return attemptExceptionReporter != null
+                ? attemptExceptionReporter : parent.getAttemptExceptionReporter();
+    }
+    
+    /**
+     * Tells if this setting is set directly in this object or its value is coming from the {@link #getParent() parent}.
+     *  
+     * @since 2.3.27
+     */
+    public boolean isAttemptExceptionReporterSet() {
+        return attemptExceptionReporter != null;
+    }
 
     /**
      * Sets the arithmetic engine used to perform arithmetic operations.
@@ -1607,8 +1662,9 @@ public class Configurable {
      * written applications, because there the {@link TemplateException} thrown by the public FreeMarker API is also
      * logged by the caller (even if only as the cause exception of a higher level exception). Hence, in modern
      * applications it should be set to {@code false}. Note that this setting has no effect on the logging of exceptions
-     * caught by {@code #attempt}; those are always logged, no mater what (because those exceptions won't bubble up
-     * until the API caller).
+     * caught by {@code #attempt}; by default those are always logged as errors (because those exceptions won't bubble
+     * up to the API caller), however, that can be changed with the {@link
+     * #setAttemptExceptionReporter(AttemptExceptionReporter) attempt_exception_reporter} setting.
      * 
      * @since 2.3.22
      */
@@ -2020,8 +2076,17 @@ public class Configurable {
      *       {@code "rethrow"} (means {@link TemplateExceptionHandler#RETHROW_HANDLER}),
      *       {@code "debug"} (means {@link TemplateExceptionHandler#DEBUG_HANDLER}),
      *       {@code "html_debug"} (means {@link TemplateExceptionHandler#HTML_DEBUG_HANDLER}),
-     *       {@code "ignore"} (means {@link TemplateExceptionHandler#IGNORE_HANDLER}),
-     *       {@code "default"} (only allowed for {@link Configuration} instances) for the default.
+     *       {@code "ignore"} (means {@link TemplateExceptionHandler#IGNORE_HANDLER}), or
+     *       {@code "default"} (only allowed for {@link Configuration} instances) for the default value.
+     *       
+     *   <li><p>{@code "attempt_exception_reporter"}:
+     *       See {@link #setAttemptExceptionReporter(AttemptExceptionReporter)}.
+     *       <br>String value: If the value contains dot, then it's interpreted as an <a href="#fm_obe">object builder
+     *       expression</a>.
+     *       If the value does not contain dot, then it must be one of these predefined values (case insensitive):
+     *       {@code "log_error"} (means {@link AttemptExceptionReporter#LOG_ERROR_REPORTER}),
+     *       {@code "log_warn"} (means {@link AttemptExceptionReporter#LOG_WARN_REPORTER}), or
+     *       {@code "default"} (only allowed for {@link Configuration} instances) for the default value.
      *       
      *   <li><p>{@code "arithmetic_engine"}:
      *       See {@link #setArithmeticEngine(ArithmeticEngine)}.  
@@ -2457,6 +2522,24 @@ public class Configurable {
                     setTemplateExceptionHandler((TemplateExceptionHandler) _ObjectBuilderSettingEvaluator.eval(
                             value, TemplateExceptionHandler.class, false, _SettingEvaluationEnvironment.getCurrent()));
                 }
+            } else if (ATTEMPT_EXCEPTION_REPORTER_KEY_SNAKE_CASE.equals(name)
+                    || ATTEMPT_EXCEPTION_REPORTER_KEY_CAMEL_CASE.equals(name)) {
+                if (value.indexOf('.') == -1) {
+                    if ("log_error".equalsIgnoreCase(value) || "logError".equals(value)) {
+                        setAttemptExceptionReporter(
+                                AttemptExceptionReporter.LOG_ERROR_REPORTER);
+                    } else if ("log_warn".equalsIgnoreCase(value) || "logWarn".equals(value)) {
+                        setAttemptExceptionReporter(
+                                AttemptExceptionReporter.LOG_WARN_REPORTER);
+                    } else if (DEFAULT.equalsIgnoreCase(value) && this instanceof Configuration) {
+                        ((Configuration) this).unsetAttemptExceptionReporter();
+                    } else {
+                        throw invalidSettingValueException(name, value);
+                    }
+                } else {
+                    setAttemptExceptionReporter((AttemptExceptionReporter) _ObjectBuilderSettingEvaluator.eval(
+                            value, AttemptExceptionReporter.class, false, _SettingEvaluationEnvironment.getCurrent()));
+                }
             } else if (ARITHMETIC_ENGINE_KEY_SNAKE_CASE.equals(name) || ARITHMETIC_ENGINE_KEY_CAMEL_CASE.equals(name)) {
                 if (value.indexOf('.') == -1) { 
                     if ("bigdecimal".equalsIgnoreCase(value)) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/src/main/java/freemarker/core/Environment.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Environment.java b/src/main/java/freemarker/core/Environment.java
index ce34a65..1fa59a0 100644
--- a/src/main/java/freemarker/core/Environment.java
+++ b/src/main/java/freemarker/core/Environment.java
@@ -839,20 +839,27 @@ public final class Environment extends Configurable {
         }
         lastThrowable = templateException;
 
-        // Log the exception, if logTemplateExceptions isn't false. However, even if it's false, if we are inside
-        // an #attempt block, it has to be logged, as it certainly won't bubble up to the caller of FreeMarker.
-        if (LOG.isErrorEnabled() && (isInAttemptBlock() || getLogTemplateExceptions())) {
+        if (getLogTemplateExceptions() && LOG.isErrorEnabled()
+                && !isInAttemptBlock() /* because then the AttemptExceptionReporter will report this */) {
             LOG.error("Error executing FreeMarker template", templateException);
         }
 
-        // Stop exception is not passed to the handler, but
-        // explicitly rethrown.
-        if (templateException instanceof StopException) {
-            throw templateException;
+        try {
+            // Stop exception is not passed to the handler, but
+            // explicitly rethrown.
+            if (templateException instanceof StopException) {
+                throw templateException;
+            }
+    
+            // Finally, pass the exception to the handler
+            getTemplateExceptionHandler().handleTemplateException(templateException, this, out);
+        } catch (TemplateException e) {
+            // Note that if the TemplateExceptionHandler doesn't rethrow the exception, we don't get in there.
+            if (isInAttemptBlock()) {
+                this.getAttemptExceptionReporter().report(templateException, this);
+            }
+            throw e;
         }
-
-        // Finally, pass the exception to the handler
-        getTemplateExceptionHandler().handleTemplateException(templateException, this, out);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/src/main/java/freemarker/core/TemplateConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/TemplateConfiguration.java b/src/main/java/freemarker/core/TemplateConfiguration.java
index 0569890..5ec5a02 100644
--- a/src/main/java/freemarker/core/TemplateConfiguration.java
+++ b/src/main/java/freemarker/core/TemplateConfiguration.java
@@ -234,6 +234,9 @@ public final class TemplateConfiguration extends Configurable implements ParserC
         if (tc.isTemplateExceptionHandlerSet()) {
             setTemplateExceptionHandler(tc.getTemplateExceptionHandler());
         }
+        if (tc.isAttemptExceptionReporterSet()) {
+            setAttemptExceptionReporter(tc.getAttemptExceptionReporter());
+        }
         if (tc.isTimeFormatSet()) {
             setTimeFormat(tc.getTimeFormat());
         }
@@ -349,6 +352,9 @@ public final class TemplateConfiguration extends Configurable implements ParserC
         if (isTemplateExceptionHandlerSet() && !template.isTemplateExceptionHandlerSet()) {
             template.setTemplateExceptionHandler(getTemplateExceptionHandler());
         }
+        if (isAttemptExceptionReporterSet() && !template.isAttemptExceptionReporterSet()) {
+            template.setAttemptExceptionReporter(getAttemptExceptionReporter());
+        }
         if (isTimeFormatSet() && !template.isTimeFormatSet()) {
             template.setTimeFormat(getTimeFormat());
         }
@@ -635,6 +641,7 @@ public final class TemplateConfiguration extends Configurable implements ParserC
                 || isShowErrorTipsSet()
                 || isSQLDateAndTimeTimeZoneSet()
                 || isTemplateExceptionHandlerSet()
+                || isAttemptExceptionReporterSet()
                 || isTimeFormatSet()
                 || isTimeZoneSet()
                 || isURLEscapingCharsetSet();

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/src/main/java/freemarker/template/AttemptExceptionReporter.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/AttemptExceptionReporter.java b/src/main/java/freemarker/template/AttemptExceptionReporter.java
new file mode 100644
index 0000000..c12076a
--- /dev/null
+++ b/src/main/java/freemarker/template/AttemptExceptionReporter.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package freemarker.template;
+
+import freemarker.core.Configurable;
+import freemarker.core.Environment;
+
+/**
+ * Used for the {@link Configurable#setAttemptExceptionReporter(AttemptExceptionReporter) attempt_exception_reported}
+ * configuration setting.
+ */
+public interface AttemptExceptionReporter {
+    
+    /**
+     * Logs the exception into the "freemarker.runtime" log category with "error" log level. This is the default
+     * {@link AttemptExceptionReporter}. The error message will explain that the error was handled by an
+     * {@code #attempt} block.
+     */
+    AttemptExceptionReporter LOG_ERROR_REPORTER = new LoggingAttemptExceptionReporter(false);
+
+    /**
+     * Like {@link #LOG_ERROR_REPORTER}, but it logs with "warn" log level.
+     */
+    AttemptExceptionReporter LOG_WARN_REPORTER = new LoggingAttemptExceptionReporter(true);
+    
+    /**
+     * Called to log or otherwise report the error that has occurred inside an {@code #attempt} block.  
+     */
+    void report(TemplateException te, Environment env);
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/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 42426e8..57b0121 100644
--- a/src/main/java/freemarker/template/Configuration.java
+++ b/src/main/java/freemarker/template/Configuration.java
@@ -510,6 +510,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
     
     private boolean objectWrapperExplicitlySet;
     private boolean templateExceptionHandlerExplicitlySet;
+    private boolean attemptExceptionReporterExplicitlySet;
     private boolean logTemplateExceptionsExplicitlySet;
     private boolean localeExplicitlySet;
     private boolean defaultEncodingExplicitlySet;
@@ -961,6 +962,10 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
     private TemplateExceptionHandler getDefaultTemplateExceptionHandler() {
         return getDefaultTemplateExceptionHandler(getIncompatibleImprovements());
     }
+
+    private AttemptExceptionReporter getDefaultAttemptExceptionReporter() {
+        return getDefaultAttemptExceptionReporter(getIncompatibleImprovements());
+    }
     
     private boolean getDefaultLogTemplateExceptions() {
         return getDefaultLogTemplateExceptions(getIncompatibleImprovements());
@@ -976,6 +981,11 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
     }
 
     // Package visible as Configurable needs this to initialize the field defaults.
+    final static AttemptExceptionReporter getDefaultAttemptExceptionReporter(Version incompatibleImprovements) {
+        return AttemptExceptionReporter.LOG_ERROR_REPORTER;
+    }
+    
+    // Package visible as Configurable needs this to initialize the field defaults.
     final static boolean getDefaultLogTemplateExceptions(Version incompatibleImprovements) {
         return true;
     }
@@ -1703,6 +1713,36 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      */
     public boolean isTemplateExceptionHandlerExplicitlySet() {
         return templateExceptionHandlerExplicitlySet;
+    }
+    
+    @Override
+    public void setAttemptExceptionReporter(AttemptExceptionReporter attemptExceptionReporter) {
+        super.setAttemptExceptionReporter(attemptExceptionReporter);
+        attemptExceptionReporterExplicitlySet = true;
+    }
+
+    /**
+     * Resets the setting to its default, as if it was never set. This means that when you change the
+     * {@code incompatibe_improvements} setting later, the default will also change as appropriate. Also 
+     * {@link #isAttemptExceptionReporterExplicitlySet()} will return {@code false}.
+     * 
+     * @since 2.3.27
+     */
+    public void unsetAttemptExceptionReporter() {
+        if (attemptExceptionReporterExplicitlySet) {
+            setAttemptExceptionReporter(getDefaultAttemptExceptionReporter());
+            attemptExceptionReporterExplicitlySet = false;
+        }
+    }
+    
+    /**
+     * Tells if {@link #setAttemptExceptionReporter(AttemptExceptionReporter)} (or equivalent) was already called on
+     * this instance.
+     * 
+     * @since 2.3.27
+     */
+    public boolean isAttemptExceptionReporterExplicitlySet() {
+        return attemptExceptionReporterExplicitlySet;
     }    
     
     /**
@@ -1789,6 +1829,11 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
                 templateExceptionHandlerExplicitlySet = true;
                 unsetTemplateExceptionHandler();
             }
+
+            if (!attemptExceptionReporterExplicitlySet) {
+                attemptExceptionReporterExplicitlySet = true;
+                unsetAttemptExceptionReporter();
+            }
             
             if (!logTemplateExceptionsExplicitlySet) {
                 logTemplateExceptionsExplicitlySet = true;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/src/main/java/freemarker/template/LoggingAttemptExceptionReporter.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/LoggingAttemptExceptionReporter.java b/src/main/java/freemarker/template/LoggingAttemptExceptionReporter.java
new file mode 100644
index 0000000..80563ff
--- /dev/null
+++ b/src/main/java/freemarker/template/LoggingAttemptExceptionReporter.java
@@ -0,0 +1,29 @@
+package freemarker.template;
+
+import freemarker.core.Environment;
+import freemarker.log.Logger;
+
+/**
+ * Default {@link AttemptExceptionReporter} implementation, factored out from {@link AttemptExceptionReporter} so that
+ * we can have static field.
+ */
+class LoggingAttemptExceptionReporter implements AttemptExceptionReporter {
+    
+    private static final Logger LOG = Logger.getLogger("freemarker.runtime");
+    
+    private final boolean logAsWarn;
+    
+    public LoggingAttemptExceptionReporter(boolean logAsWarn) {
+        this.logAsWarn = logAsWarn;
+    }
+
+    public void report(TemplateException te, Environment env) {
+        String message = "Error executing FreeMarker template part in the #attempt block";
+        if (!logAsWarn) {
+            LOG.error(message, te);
+        } else {
+            LOG.warn(message, te);
+        }
+    }
+    
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/src/main/java/freemarker/template/TemplateExceptionHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/TemplateExceptionHandler.java b/src/main/java/freemarker/template/TemplateExceptionHandler.java
index 7d3744e..caf1e79 100644
--- a/src/main/java/freemarker/template/TemplateExceptionHandler.java
+++ b/src/main/java/freemarker/template/TemplateExceptionHandler.java
@@ -29,8 +29,8 @@ import freemarker.core.StopException;
 import freemarker.template.utility.StringUtil;
 
 /**
- * Used for the {@code template_exception_handler} configuration setting;
- * see {@link Configurable#setTemplateExceptionHandler(TemplateExceptionHandler)} for more.
+ * Used for the {@link Configurable#setTemplateExceptionHandler(TemplateExceptionHandler) template_exception_handler}
+ * configuration setting.
  */
 public interface TemplateExceptionHandler {
     
@@ -39,9 +39,9 @@ public interface TemplateExceptionHandler {
      * unless you want to suppress the exception.
      * 
      * <p>Note that you can check with {@link Environment#isInAttemptBlock()} if you are inside a {@code #attempt}
-     * block, which then will handle handle this exception and roll back the output generated inside it.
+     * block, which then will handle this exception and roll back the output generated inside it.
      * 
-     * <p>Note that {@link StopException}-s (raised by {@code #stop}) won't be captured.
+     * <p>Note that {@link StopException}-s (raised by {@code #stop}) won't be captured here.
      * 
      * <p>Note that you shouldn't log the exception in this method unless you suppress it. If there's a concern that the
      * exception might won't be logged after it bubbles up from {@link Template#process(Object, Writer)}, simply

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/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 737c528..373e0e6 100644
--- a/src/main/java/freemarker/template/_TemplateAPI.java
+++ b/src/main/java/freemarker/template/_TemplateAPI.java
@@ -81,6 +81,11 @@ public class _TemplateAPI {
         return Configuration.getDefaultTemplateExceptionHandler(incompatibleImprovements);
     }
 
+    public static AttemptExceptionReporter getDefaultAttemptExceptionReporter(
+            Version incompatibleImprovements) {
+        return Configuration.getDefaultAttemptExceptionReporter(incompatibleImprovements);
+    }
+    
     public static boolean getDefaultLogTemplateExceptions(Version incompatibleImprovements) {
         return Configuration.getDefaultLogTemplateExceptions(incompatibleImprovements);
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 77b13cd..a4d63a1 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -2724,7 +2724,7 @@ baz
             <literal>book[test]</literal>. More examples; these are all
             equivalent: <literal>book.author.name</literal>,
             <literal>book["author"].name</literal>,
-            <literal>book.author.["name"]</literal>,
+            <literal>book.author["name"]</literal>,
             <literal>book["author"]["name"]</literal>.</para>
 
             <para>When you use the dot syntax, the same restrictions apply
@@ -18896,15 +18896,14 @@ Primary content continued</programlisting>
           linkend="dgui_template_exp_missing">missing value handler
           operators</link>). It can handle all kind of errors that occurs when
           the block is executed (i.e. not syntactical errors, which are
-          detected earlier). And it's meant to enclose bigger template
-          fragments, where error can occur at various points. For example, you
-          have a part in your template that deals with printing
-          advertisements, but that's not the primary content of the page, so
-          you don't want your whole page be down just because some error
-          occurs with the printing of the advertisements (say, because of a
-          temporal database server faliure). So you put the whole
-          advertisement printing into an <literal><replaceable>attempt
-          block</replaceable></literal>.</para>
+          detected earlier). It meant to enclose bigger template fragments,
+          where error can occur at various points. For example, you have a
+          part in your template that deals with printing advertisements, but
+          that's not the primary content of the page, so you don't want your
+          whole page be down just because some error occurs with the printing
+          of the advertisements (say, because of a database server outage). So
+          you put the whole advertisement printing into an
+          <literal><replaceable>attempt block</replaceable></literal>.</para>
 
           <para>In some environments programmers configure FreeMarker so that
           it doesn't abort template execution for certain errors, but
@@ -18921,11 +18920,17 @@ Primary content continued</programlisting>
           references to special variable are started with dot (for example:
           <literal>${.error}</literal>).</para>
 
-          <para><phrase role="forProgrammers">Errors occurring during template
-          execution are always <link
-          linkend="pgui_misc_logging">logged</link>, even if they occur inside
-          an <literal><replaceable>attempt
-          block</replaceable></literal>.</phrase></para>
+          <para><phrase role="forProgrammers">By default errors occurring
+          inside an <literal><replaceable>attempt
+          block</replaceable></literal> are logged as errors. This is because
+          <literal>attempt</literal> is not supposed to be a general purpose
+          error handler mechanism, like <literal>try</literal> is in Java.
+          It's for decreasing the impact of unexpected errors, by making it
+          possible that only part of the page is going down, instead of the
+          whole page. But it's still an error, something that someone should
+          fix. (The way this error is reported can be customized with the
+          <literal>attempt_exception_reporter</literal> configuration
+          setting.)</phrase></para>
         </section>
       </section>
 
@@ -26855,6 +26860,37 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
 
           <itemizedlist>
             <listitem>
+              <para>Added new configuration setting,
+              <literal>attempt_exception_reporter</literal>
+              (<literal>Configurable.setAttemptExceptionReporter(AttemptExceptionReporter)</literal>),
+              to allow the customization of how the exceptions handled (and
+              thus suppressed) by the <link
+              linkend="ref.directive.attempt"><literal>attempt</literal>
+              directive</link> are reported. The default
+              <literal>AttemptExceptionReporter</literal> logs the exception
+              as an error, just as it was in earlier versions, though now the
+              error message will indicate that the exception was thrown inside
+              an <literal>attempt</literal> directive block.</para>
+            </listitem>
+
+            <listitem>
+              <para>Bug fixed: When the
+              <literal>TemplateExceptionHandler</literal> suppresses (i.e.,
+              doesn't re-throw) an exception, the <link
+              linkend="ref.directive.attempt"><literal>attempt</literal>
+              directive</link> won't log it anymore. (To be precise, the
+              <literal>AttemptExceptionReporter</literal> won't be invoked for
+              it anymore; the default one logs as error.)</para>
+            </listitem>
+
+            <listitem>
+              <para>When logging error due to an error in an <link
+              linkend="ref.directive.attempt"><literal>attempt</literal>
+              directive</link> block, the log message now indicates that error
+              was inside an <literal>attempt</literal> block.</para>
+            </listitem>
+
+            <listitem>
               <para>Bug fixed (<link
               xlink:href="https://issues.apache.org/jira/browse/FREEMARKER-52">FREEMARKER-52</link>):
               When setting the <literal>output_format</literal> with

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/src/test/java/freemarker/core/AttemptLoggingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/AttemptLoggingTest.java b/src/test/java/freemarker/core/AttemptLoggingTest.java
new file mode 100644
index 0000000..edf3d18
--- /dev/null
+++ b/src/test/java/freemarker/core/AttemptLoggingTest.java
@@ -0,0 +1,77 @@
+package freemarker.core;
+
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+import freemarker.template.AttemptExceptionReporter;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateExceptionHandler;
+import freemarker.test.TemplateTest;
+
+public class AttemptLoggingTest extends TemplateTest {
+
+    @Test
+    public void standardConfigTest() throws IOException, TemplateException {
+        assertOutput("<#attempt>${missingVar1}<#recover>r</#attempt>", "r");
+        // Here, we should have an ERROR entry in the log that refers to an exception in an #attempt block. But we can't
+        // easily assert that automatically, so it has to be checked manually...
+        
+        getConfiguration().setAttemptExceptionReporter(AttemptExceptionReporter.LOG_WARN_REPORTER);
+        assertOutput("<#attempt>${missingVar2}<#recover>r</#attempt>", "r");
+        // Again, it must be checked manually if there's a WARN entry
+    }
+
+    @Test
+    public void customConfigTest() throws IOException, TemplateException {
+        List<String> reports = new ArrayList<String>();
+        getConfiguration().setAttemptExceptionReporter(new TestAttemptExceptionReporter(reports));
+        
+        assertOutput(
+                "<#attempt>${missingVar1}<#recover>r</#attempt>"
+                + "<#attempt>${missingVar2}<#recover>r</#attempt>",
+                "rr");
+        assertEquals(2, reports.size());
+        assertThat(reports.get(0), containsString("missingVar1"));
+        assertThat(reports.get(1), containsString("missingVar2"));
+    }
+
+    @Test
+    public void dontReportSuppressedExceptionsTest() throws IOException, TemplateException {
+        List<String> reports = new ArrayList<String>();
+        getConfiguration().setAttemptExceptionReporter(new TestAttemptExceptionReporter(reports));
+        
+        getConfiguration().setTemplateExceptionHandler(new TemplateExceptionHandler() {
+            public void handleTemplateException(TemplateException te, Environment env, Writer out) throws TemplateException {
+                try {
+                    out.write("[E]");
+                } catch (IOException e) {
+                    throw new TemplateException("Failed to write to the output", e, env);
+                }
+            }
+        });
+
+        assertOutput("<#attempt>${missingVar1}t<#recover>r</#attempt>", "[E]t");
+        
+        assertEquals(0, reports.size());
+    }
+    
+    private static final class TestAttemptExceptionReporter implements AttemptExceptionReporter {
+        private final List<String> reports;
+
+        private TestAttemptExceptionReporter(List<String> reports) {
+            this.reports = reports;
+        }
+
+        public void report(TemplateException te, Environment env) {
+            reports.add(te.getMessage());
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/src/test/java/freemarker/core/TemplateConfigurationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/TemplateConfigurationTest.java b/src/test/java/freemarker/core/TemplateConfigurationTest.java
index 837f6b6..bd397d4 100644
--- a/src/test/java/freemarker/core/TemplateConfigurationTest.java
+++ b/src/test/java/freemarker/core/TemplateConfigurationTest.java
@@ -48,6 +48,7 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 
 import freemarker.cache.StringTemplateLoader;
+import freemarker.template.AttemptExceptionReporter;
 import freemarker.template.Configuration;
 import freemarker.template.SimpleObjectWrapper;
 import freemarker.template.Template;
@@ -170,6 +171,7 @@ public class TemplateConfigurationTest {
         SETTING_ASSIGNMENTS.put("outputEncoding", "utf-16");
         SETTING_ASSIGNMENTS.put("showErrorTips", false);
         SETTING_ASSIGNMENTS.put("templateExceptionHandler", TemplateExceptionHandler.IGNORE_HANDLER);
+        SETTING_ASSIGNMENTS.put("attemptExceptionReporter", AttemptExceptionReporter.LOG_WARN_REPORTER);
         SETTING_ASSIGNMENTS.put("timeFormat", "@HH:mm");
         SETTING_ASSIGNMENTS.put("timeZone", NON_DEFAULT_TZ);
         SETTING_ASSIGNMENTS.put("arithmeticEngine", ArithmeticEngine.CONSERVATIVE_ENGINE);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/src/test/java/freemarker/template/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/template/ConfigurationTest.java b/src/test/java/freemarker/template/ConfigurationTest.java
index 15ba915..2beeff0 100644
--- a/src/test/java/freemarker/template/ConfigurationTest.java
+++ b/src/test/java/freemarker/template/ConfigurationTest.java
@@ -1206,6 +1206,18 @@ public class ConfigurationTest extends TestCase {
         cfg.setSetting(Configurable.LOG_TEMPLATE_EXCEPTIONS_KEY, "false");
         assertEquals(false, cfg.getLogTemplateExceptions());
     }
+
+    public void testSetAttemptExceptionReporter() throws TemplateException {
+        Configuration cfg = new Configuration(Configuration.VERSION_2_3_0);
+        assertEquals(AttemptExceptionReporter.LOG_ERROR_REPORTER, cfg.getAttemptExceptionReporter());
+        assertFalse(cfg.isAttemptExceptionReporterExplicitlySet());
+        cfg.setSetting(Configurable.ATTEMPT_EXCEPTION_REPORTER_KEY, "log_warn");
+        assertEquals(AttemptExceptionReporter.LOG_WARN_REPORTER, cfg.getAttemptExceptionReporter());
+        assertTrue(cfg.isAttemptExceptionReporterExplicitlySet());
+        cfg.setSetting(Configurable.ATTEMPT_EXCEPTION_REPORTER_KEY, "default");
+        assertEquals(AttemptExceptionReporter.LOG_ERROR_REPORTER, cfg.getAttemptExceptionReporter());
+        assertFalse(cfg.isAttemptExceptionReporterExplicitlySet());
+    }
     
     public void testSharedVariables() throws TemplateModelException {
         Configuration cfg = new Configuration();



[15/50] incubator-freemarker git commit: (Some JavaDoc and error message typos fixed)

Posted by dd...@apache.org.
(Some JavaDoc and error message typos fixed)


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

Branch: refs/heads/2.3
Commit: a5668475024251cdbba7aeda9277247f2898341b
Parents: a4273fc
Author: ddekany <dd...@apache.org>
Authored: Sat Apr 22 12:59:23 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Apr 22 12:59:23 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/template/Configuration.java | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5668475/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 ca6729c..a2df266 100644
--- a/src/main/java/freemarker/template/Configuration.java
+++ b/src/main/java/freemarker/template/Configuration.java
@@ -115,7 +115,7 @@ import freemarker.template.utility.XmlEscape;
  * <pre>
  *  // Where the application is initialized; in general you do this ONLY ONCE in the application life-cycle!
  *  Configuration cfg = new Configuration(VERSION_<i>X</i>_<i>Y</i>_<i>Z</i>));
- *  // Where X, Y, Z enables the not-100%-backward-compatible fixes introduced in
+ *  // Where VERSION_<i>X</i>_<i>Y</i>_<i>Z</i> enables the not-100%-backward-compatible fixes introduced in
  *  // FreeMarker version X.Y.Z  and earlier (see {@link #Configuration(Version)}).
  *  cfg.set<i>SomeSetting</i>(...);
  *  cfg.set<i>OtherSetting</i>(...);
@@ -1219,7 +1219,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
     }
     
     /**
-     * Sets a {@link TemplateLookupStrategy} that is used to look up templates based on the requested name; as a side
+     * Sets the {@link TemplateLookupStrategy} that is used to look up templates based on the requested name; as a side
      * effect the template cache will be emptied. The default value is {@link TemplateLookupStrategy#DEFAULT_2_3_0}.
      * 
      * @since 2.3.22
@@ -1530,7 +1530,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
 
     /**
      * Sets the time in milliseconds that must elapse before checking whether there is a newer version of a template
-     * "file" exists than the cached one. Defaults to 5000 ms.
+     * "file" than the cached one. Defaults to 5000 ms.
      * 
      * <p>
      * When you get a template via {@link #getTemplate(String)} (or some of its overloads). FreeMarker will try to get
@@ -1927,7 +1927,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      * Where you can't use the standard extensions, templates still can be associated to output formats with
      * patterns matching their name (their path) using {@link #setTemplateConfigurations(TemplateConfigurationFactory)}.
      * But if all templates will have the same output format, you may use {@link #setOutputFormat(OutputFormat)} after
-     * all, to set a value like {@link HTMLOutputFormat#INSTANCE}, {@link XMLOutputFormat#INSTANCE}, etc. Also note
+     * all, to a value like {@link HTMLOutputFormat#INSTANCE}, {@link XMLOutputFormat#INSTANCE}, etc. Also note
      * that templates can specify their own output format like {@code 
      * <#ftl output_format="HTML">}, which overrides any configuration settings.
      * 
@@ -1992,7 +1992,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      * @param name
      *            Either the name of the output format as it was registered with
      *            {@link Configuration#setRegisteredCustomOutputFormats(Collection)}, or a combined output format name.
-     *            A output combined format is created ad-hoc from the registered formats. For example, if you need RTF
+     *            A combined output format is created ad-hoc from the registered formats. For example, if you need RTF
      *            embedded into HTML, the name will be <code>HTML{RTF}</code>, where "HTML" and "RTF" refer to the
      *            existing formats. This logic can be used recursively, so for example <code>XML{HTML{RTF}}</code> is
      *            also valid.
@@ -2337,7 +2337,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
         }
         // To avoid integer overflows:
         if (tabSize > 256) {
-            throw new IllegalArgumentException("\"tabSize\" can be more than 256, but was " + tabSize);
+            throw new IllegalArgumentException("\"tabSize\" can't be more than 256, but was " + tabSize);
         }
         this.tabSize = tabSize;
     }


[20/50] incubator-freemarker git commit: (Error message typo. Better error message for allow_nothing VS allows_nothing.)

Posted by dd...@apache.org.
(Error message typo. Better error message for allow_nothing VS allows_nothing.)


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

Branch: refs/heads/2.3
Commit: dc3277e0d52ad304abdffe6f687d0a152071d5dc
Parents: 3fc5f90
Author: ddekany <dd...@apache.org>
Authored: Tue Jun 13 18:57:07 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Tue Jun 13 18:57:07 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/Configurable.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/dc3277e0/src/main/java/freemarker/core/Configurable.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java
index 7262e4f..914015a 100644
--- a/src/main/java/freemarker/core/Configurable.java
+++ b/src/main/java/freemarker/core/Configurable.java
@@ -947,7 +947,7 @@ public class Configurable {
         int commaIdx = booleanFormat.indexOf(',');
         if (commaIdx == -1) {
             throw new IllegalArgumentException(
-                    "Setting value must be string that contains two comma-separated values for true and false, " +
+                    "Setting value must be a string that contains two comma-separated values for true and false, " +
                     "respectively.");
         }
         
@@ -2538,6 +2538,12 @@ public class Configurable {
                     }
                     setNewBuiltinClassResolver(
                             new OptInTemplateClassResolver(allowedClasses, trustedTemplates));
+                } else if ("allow_nothing".equals(value)) {
+                    throw new IllegalArgumentException(
+                            "The correct value would be: allows_nothing");
+                } else if ("allowNothing".equals(value)) {
+                    throw new IllegalArgumentException(
+                            "The correct value would be: allowsNothing");
                 } else if (value.indexOf('.') != -1) {
                     setNewBuiltinClassResolver((TemplateClassResolver) _ObjectBuilderSettingEvaluator.eval(
                                     value, TemplateClassResolver.class, false,


[24/50] incubator-freemarker git commit: Added alternative syntaxes for the && (logical and) operator: \and and & & . These are to work around issues in applications where the template must be a valid XML (&& is not valid XML/HTML, at most places),

Posted by dd...@apache.org.
Added alternative syntaxes for the && (logical and) operator: \and and &amp;&amp;. These are to work around issues in applications where the template must be a valid XML (&& is not valid XML/HTML, at most places), or where the template entered is stored after XML or HTML escaping. Note that lonely &amp;, and `and` without \ is not recognized for backward compatibility.


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

Branch: refs/heads/2.3
Commit: f933ed03db875aa1f550e091339da6469e8cd6ba
Parents: 304df82
Author: ddekany <dd...@apache.org>
Authored: Wed Jun 28 11:29:28 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Wed Jun 28 11:29:28 2017 +0200

----------------------------------------------------------------------
 src/main/javacc/FTL.jj                          |  2 +-
 src/manual/en_US/book.xml                       | 94 +++++++++++++++-----
 .../test/templatesuite/templates/boolean.ftl    |  4 +
 3 files changed, 77 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f933ed03/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index c6a9d8b..75c7784 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -1251,7 +1251,7 @@ TOKEN:
     |
     <PERCENT : "%">
     |
-    <AND : "&" | "&&" >
+    <AND : "&" | "&&" | "&amp;&amp;" | "\\and" >
     |
     <OR : "|" | "||">
     |

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f933ed03/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index a4d63a1..05435b0 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -3457,30 +3457,29 @@ ${12 % -5} &lt;#-- Prints 2 --&gt;
           <literal>&lt;#if (x &gt; y)&gt;</literal>, although it's considered
           to be less elegant.</para>
 
-          <note>
-            <para>FreeMarker supports some other alternatives too, but these
-            are deprecated:</para>
+          <para>FreeMarker supports some more syntactical alternatives:</para>
 
-            <itemizedlist>
-              <listitem>
-                <para>Writing <literal>&amp;gt;</literal> and
-                <literal>&amp;lt;</literal> on the place of the problematic
-                relation marks, like in: <literal>&lt;#if x &amp;gt;
-                y&gt;</literal> or <literal>&lt;#if x &amp;gt;=
-                y&gt;</literal> . Note that in general FTL does not support
-                entity references (the
-                <literal>&amp;<replaceable>...</replaceable>;</literal>
-                things) in FTL tags; it's just an exception with the
-                arithmetical comparisons.</para>
-              </listitem>
+          <itemizedlist>
+            <listitem>
+              <para><literal>&amp;gt;</literal> and
+              <literal>&amp;lt;</literal> can also be used, like in:
+              <literal>&lt;#if x &amp;gt; y&gt;</literal> or <literal>&lt;#if
+              x &amp;gt;= y&gt;</literal>. This isn't meant to be entered
+              manually; it's to work around cases where the template gets
+              XML/HTML escaped and the user can't easily prevent that
+              happening. Note that in general FTL does not support entity
+              references (the
+              <literal>&amp;<replaceable>...</replaceable>;</literal> things)
+              in FTL tags; it's just an exception with these operators.</para>
+            </listitem>
 
-              <listitem>
-                <para><literal>\lt</literal>, <literal>\lte</literal>,
-                <literal>\gt</literal> and <literal>\gte</literal> which are
-                the same as the ones without the backslash</para>
-              </listitem>
-            </itemizedlist>
-          </note>
+            <listitem>
+              <para>Deprecated forms: <literal>\lt</literal>,
+              <literal>\lte</literal>, <literal>\gt</literal> and
+              <literal>\gte</literal>. These are the same as the ones without
+              the backslash.</para>
+            </listitem>
+          </itemizedlist>
         </section>
 
         <section xml:id="dgui_template_exp_logicalop">
@@ -3535,6 +3534,38 @@ ${12 % -5} &lt;#-- Prints 2 --&gt;
 &lt;#if <emphasis>!</emphasis>hot&gt; &lt;#-- here hot must be a boolean --&gt;
   It's not hot.
 &lt;/#if&gt;</programlisting>
+
+          <para>FreeMarker supports some more syntactical alternatives:</para>
+
+          <itemizedlist>
+            <listitem>
+              <para><literal>\and</literal> (since FreeMarker 2.3.27): In some
+              applications using <literal>&amp;&amp;</literal> causes problems
+              as it's not valid in XML or HTML. While FreeMarker templates was
+              never intended to be valid XML/HTML, only their output should be
+              that, in reality there are some applications that expect the
+              template itself to be valid XML/HTML regardless. This syntax is
+              a workaround for such cases. Also note that unlike with the
+              comparison operators, <literal>and</literal> without
+              <literal>\</literal> is not supported due to backward
+              compatibility restrictions.</para>
+            </listitem>
+
+            <listitem>
+              <para><literal>&amp;amp;&amp;amp;</literal> (since FreeMarker
+              2.3.27): This isn't meant to be entered manually; it's to work
+              around cases where the template gets XML/HTML escaped and the
+              user can't easily prevent that happening. Note that in general
+              FTL does not support entity references (the
+              <literal>&amp;<replaceable>...</replaceable>;</literal> things)
+              in FTL tags; it's just an exception with these operators.</para>
+            </listitem>
+
+            <listitem>
+              <para>Deprecated forms: <literal>&amp;</literal> and
+              <literal>|</literal>. Don't use them anymore.</para>
+            </listitem>
+          </itemizedlist>
         </section>
 
         <section xml:id="dgui_template_exp_builtin">
@@ -26856,6 +26887,25 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
         accepted (graduated) Apache project.</para>
 
         <section>
+          <title>Changes on the FTL side</title>
+
+          <itemizedlist>
+            <listitem>
+              <para>Added alternative syntaxes for the
+              <literal>&amp;&amp;</literal> (logical <quote>and</quote>)
+              operator: <literal>\and</literal> and
+              <literal>&amp;amp;&amp;amp;</literal>. These are to work around
+              issues in applications where the template must be a valid XML
+              (<literal>&amp;&amp;</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;amp;</literal>,
+              and <literal>and</literal> without <literal>\</literal> is not
+              recognized for backward compatibility.</para>
+            </listitem>
+          </itemizedlist>
+        </section>
+
+        <section>
           <title>Changes on the Java side</title>
 
           <itemizedlist>

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f933ed03/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl b/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl
index ab11c64..a76d9b9 100644
--- a/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl
+++ b/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl
@@ -71,6 +71,10 @@
 <#else>
     boolean4 && boolean5 failed.<br />
 </#if></p>
+<@assert test=boolean4 &amp;&amp; boolean5 />
+<@assert test=!(false &amp;&amp; true) />
+<@assert test=boolean4 \and boolean5 />
+<@assert test=!(false \and true) />
  
 <p>Now test list models:</p>
 


[19/50] incubator-freemarker git commit: Wrong bugfix description: output_format=XHTML isn't supposed to work and it doesn't either. It's output_format=XHTMLOutputFormat that works now.

Posted by dd...@apache.org.
Wrong bugfix description: output_format=XHTML isn't supposed to work and it doesn't either. It's output_format=XHTMLOutputFormat that works now.


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

Branch: refs/heads/2.3
Commit: 3fc5f907056edf82e03fe47cf72fc176d2e110b6
Parents: f0a6f45
Author: ddekany <dd...@apache.org>
Authored: Fri May 26 11:59:07 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Fri May 26 11:59:07 2017 +0200

----------------------------------------------------------------------
 src/manual/en_US/book.xml | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3fc5f907/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index a3656d1..3f003b3 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -26858,12 +26858,13 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
               <para>Bug fixed (<link
               xlink:href="https://issues.apache.org/jira/browse/FREEMARKER-52">FREEMARKER-52</link>):
               When setting the <literal>output_format</literal> with
-              <literal>Properties</literal>, the <literal>XHTML</literal>
-              abbreviation wasn't recognized. Like in a
-              <literal>.properties</literal> file,
-              <literal>output_format=XHTML</literal> didn't work, only
+              <literal>Properties</literal>, the
+              <literal>XHTMLOutputFormat</literal> abbreviation wasn't
+              recognized (for example in a <literal>.properties</literal>
+              file, <literal>output_format=XHTMLOutputFormat</literal> didn't
+              work, only
               <literal>output_format=freemarker.core.XHTMLOutputFormat()</literal>
-              did.</para>
+              did).</para>
             </listitem>
           </itemizedlist>
         </section>


[40/50] incubator-freemarker git commit: (JavaDoc adjustment)

Posted by dd...@apache.org.
(JavaDoc adjustment)


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

Branch: refs/heads/2.3
Commit: e3d1bb837df300d4b9230716cc391199a599e109
Parents: 15afde1
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 10:03:39 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 5 10:03:39 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/Environment.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e3d1bb83/src/main/java/freemarker/core/Environment.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Environment.java b/src/main/java/freemarker/core/Environment.java
index c826381..565dcd4 100644
--- a/src/main/java/freemarker/core/Environment.java
+++ b/src/main/java/freemarker/core/Environment.java
@@ -242,8 +242,7 @@ public final class Environment extends Configurable {
     /**
      * Returns the {@link Template} that we are "lexically" inside at the moment. This template will change when
      * entering an {@code #include} or calling a macro or function in another template, or returning to yet another
-     * template with {@code #nested}. As such, it's useful in {@link TemplateDirectiveModel} to find out if from where
-     * the directive was called from.
+     * template with {@code #nested}.
      * 
      * @see #getMainTemplate()
      * @see #getCurrentNamespace()


[04/50] incubator-freemarker git commit: REAMDE needs no copyright header

Posted by dd...@apache.org.
REAMDE needs no copyright header


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

Branch: refs/heads/2.3
Commit: 6ac622ef24ec502f0a38c59848f095afa0401d05
Parents: 36fdc7c
Author: ddekany <dd...@apache.org>
Authored: Fri Apr 14 14:27:38 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Fri Apr 14 14:27:38 2017 +0200

----------------------------------------------------------------------
 README.md | 20 --------------------
 1 file changed, 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/6ac622ef/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index e4ad314..e460531 100644
--- a/README.md
+++ b/README.md
@@ -1,23 +1,3 @@
-```
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-```
-
-
 Apache FreeMarker {version}
 ===========================
 


[39/50] incubator-freemarker git commit: Fixed some parser error message glitches.

Posted by dd...@apache.org.
Fixed some parser error message glitches.


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

Branch: refs/heads/2.3
Commit: 15afde13463306d0e96f09211e0ccdf92d9ec71e
Parents: 16ff174
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 10:01:56 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 5 10:03:03 2017 +0200

----------------------------------------------------------------------
 src/main/javacc/FTL.jj                                      | 6 +++---
 src/test/java/freemarker/core/ParsingErrorMessagesTest.java | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/15afde13/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index b011c41..175614c 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -3227,7 +3227,7 @@ Macro Macro() :
     )
     {
         if (inMacro || inFunction) {
-            throw new ParseException("Macros cannot be nested.", template, start);
+            throw new ParseException("Macro or function definitions can't be nested into each other.", template, start);
         }
         if (isFunction) inFunction = true; else inMacro = true;
     }
@@ -3294,12 +3294,12 @@ Macro Macro() :
     (
         end = <END_MACRO>
         {
-        	if (isFunction) throw new ParseException("Expected function end tag here.", template, start);
+        	if (isFunction) throw new ParseException("Expected function end tag here.", template, end);
     	}
         |
         end = <END_FUNCTION>
         {
-    		if (!isFunction) throw new ParseException("Expected macro end tag here.", template, start);
+    		if (!isFunction) throw new ParseException("Expected macro end tag here.", template, end);
     	}
     )
     {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/15afde13/src/test/java/freemarker/core/ParsingErrorMessagesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/ParsingErrorMessagesTest.java b/src/test/java/freemarker/core/ParsingErrorMessagesTest.java
index 53194a8..e471a31 100644
--- a/src/test/java/freemarker/core/ParsingErrorMessagesTest.java
+++ b/src/test/java/freemarker/core/ParsingErrorMessagesTest.java
@@ -61,7 +61,9 @@ public class ParsingErrorMessagesTest {
     @Test
     public void testUnclosedDirectives() {
         assertErrorContains("<#macro x>", "#macro", "unclosed");
+        assertErrorContains("<#macro x></#function>", "macro end tag");
         assertErrorContains("<#function x>", "#macro", "unclosed");
+        assertErrorContains("<#function x></#macro>", "function end tag");
         assertErrorContains("<#assign x>", "#assign", "unclosed");
         assertErrorContains("<#macro m><#local x>", "#local", "unclosed");
         assertErrorContains("<#global x>", "#global", "unclosed");


[12/50] incubator-freemarker git commit: changed the build script to point to ci task

Posted by dd...@apache.org.
changed the build script to point to ci task


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

Branch: refs/heads/2.3
Commit: 4d6897ec4b64f10b3f0cc3d5730f3b8365d525fc
Parents: 6dcaf5c
Author: Pradeep Murugesan <pr...@outlook.com>
Authored: Mon Apr 17 15:30:27 2017 +0200
Committer: Pradeep Murugesan <pr...@outlook.com>
Committed: Mon Apr 17 15:30:27 2017 +0200

----------------------------------------------------------------------
 .travis.yml | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4d6897ec/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index c9a3521..fb4fdc1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,5 @@
 language: java
-before_install: ant download-ivy
-install:
-  - ant
-  - ant javadoc
+install: ant download-ivy
+script: ant ci
 jdk:
   - oraclejdk8
\ No newline at end of file


[42/50] incubator-freemarker git commit: GeneralPurposeNothing also implements TemplateHashModelEx2

Posted by dd...@apache.org.
GeneralPurposeNothing also implements TemplateHashModelEx2


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

Branch: refs/heads/2.3
Commit: 889b8a965a19588037a90aadf5c58d51386520ec
Parents: 2aebfe5
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 11:16:38 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 5 11:16:38 2017 +0200

----------------------------------------------------------------------
 .../freemarker/template/GeneralPurposeNothing.java   | 15 +++++++++------
 src/manual/en_US/book.xml                            |  8 +++++---
 2 files changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/889b8a96/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 7ba8602..8023bd8 100644
--- a/src/main/java/freemarker/template/GeneralPurposeNothing.java
+++ b/src/main/java/freemarker/template/GeneralPurposeNothing.java
@@ -19,9 +19,10 @@
 
 package freemarker.template;
 
-import java.util.ArrayList;
 import java.util.List;
 
+import freemarker.template.utility.Constants;
+
 /**
  * Singleton object representing nothing, used by ?if_exists built-in.
  * It is meant to be interpreted in the most sensible way possible in various contexts.
@@ -29,11 +30,9 @@ import java.util.List;
  */
 
 final class GeneralPurposeNothing
-implements TemplateBooleanModel, TemplateScalarModel, TemplateSequenceModel, TemplateHashModelEx, TemplateMethodModelEx {
+implements TemplateBooleanModel, TemplateScalarModel, TemplateSequenceModel, TemplateHashModelEx2, TemplateMethodModelEx {
 
     private static final TemplateModel instance = new GeneralPurposeNothing();
-      
-    private static final TemplateCollectionModel EMPTY_COLLECTION = new SimpleCollection(new ArrayList(0));
 
     private GeneralPurposeNothing() {
     }
@@ -71,10 +70,14 @@ implements TemplateBooleanModel, TemplateScalarModel, TemplateSequenceModel, Tem
     }
     
     public TemplateCollectionModel keys() {
-        return EMPTY_COLLECTION;
+        return Constants.EMPTY_COLLECTION;
     }
 
     public TemplateCollectionModel values() {
-        return EMPTY_COLLECTION;
+        return Constants.EMPTY_COLLECTION;
+    }
+
+    public KeyValuePairIterator keyValuePairIterator() throws TemplateModelException {
+        return Constants.EMPTY_KEY_VALUE_PAIR_ITERATOR;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/889b8a96/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 1288f8a..6d6d6f9 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -26982,10 +26982,12 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
             </listitem>
 
             <listitem>
-              <para><literal>Constants.EMPTY_HASH</literal> now implements
+              <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>&lt;#list ... as k, v&gt;</literal>. Earlier it
-              was only a <literal>TemplateHashModelEx</literal>.</para>
+              with <literal>&lt;#list ... as k, v&gt;</literal>. Earlier they
+              were only a <literal>TemplateHashModelEx</literal>-s.</para>
             </listitem>
 
             <listitem>


[49/50] incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)

Posted by dd...@apache.org.
(Attempt to fix Travis problem with JUnit)


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

Branch: refs/heads/2.3
Commit: 67691b4c62d51998f5eb86f77bdaa24a98c10725
Parents: c688e15
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 13:11:23 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 5 13:11:23 2017 +0200

----------------------------------------------------------------------
 .travis.yml |  6 +++++-
 build.xml   | 14 +-------------
 2 files changed, 6 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/67691b4c/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 5e1f7ca..3a560ea 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,9 @@
 language: java
-install: ant download-ivy download-ant-junit
+before_install:
+- sudo apt-get -qq update
+# ant-optional is needed for ant junit
+- sudo apt-get install ant-optional
+install: ant download-ivy
 script: ant ci
 jdk:
   - oraclejdk8
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/67691b4c/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 4f45785..88deeea 100644
--- a/build.xml
+++ b/build.xml
@@ -140,18 +140,6 @@
     <get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
          dest="${ivy.jar.file}" usetimestamp="true"/>
   </target>
-
-  <!-- Since 2017-08-05 or so, ant-junit was gone from Ant on Travis, hence we need this there: -->
-  <antversion property="antVersionNumber"/>
-  <property name="ant-junit.install.version" value="${antVersionNumber}" />
-  <property name="ant-junit.home" value="${user.home}/.ant" />
-  <property name="ant-junit.jar.dir" value="${ant-junit.home}/lib" />
-  <property name="ant-junit.jar.file" value="${ant-junit.jar.dir}/ant-junit.jar" />
-  <target name="download-ant-junit">
-    <mkdir dir="${ant-junit.jar.dir}"/>
-    <get src="https://repo1.maven.org/maven2/org/apache/ant/ant-junit/${ant-junit.install.version}/ant-junit-${ant-junit.install.version}.jar"
-         dest="${ant-junit.jar.file}" usetimestamp="true"/>
-  </target>
   
   <!-- ================================================================= -->
   <!-- Compilation                                                       -->
@@ -460,7 +448,7 @@
   <target name="test" depends="compileTest" description="Run test cases">
     <mkdir dir="build/junit-reports" />
     <ivy:cachepath conf="run.test" pathid="ivy.dep.run.test" />
-    <junit haltonfailure="on" fork="true" forkmode="once">
+    <junit haltonfailure="off" logfailedtests="true" fork="true" forkmode="once">
       <classpath>
         <pathelement path="build/test-classes" />
         <pathelement path="build/classes" />


[13/50] incubator-freemarker git commit: (README heading hierarchy fix)

Posted by dd...@apache.org.
(README heading hierarchy 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/e64dc4dd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/e64dc4dd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/e64dc4dd

Branch: refs/heads/2.3
Commit: e64dc4dd8a95476b82917273fe7b06fbc07c95ab
Parents: 0c22546
Author: ddekany <dd...@apache.org>
Authored: Mon Apr 17 23:01:11 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Mon Apr 17 23:01:11 2017 +0200

----------------------------------------------------------------------
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e64dc4dd/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index d175433..6441fd6 100644
--- a/README.md
+++ b/README.md
@@ -95,7 +95,7 @@ link.
 
 
 Building FreeMarker
-===================
+-------------------
 
 If you haven't yet, download the source release, or checkout FreeMarker from
 the source code repository. See repository locations here:
@@ -123,7 +123,7 @@ To generate documentation, issue `ant javadoc` and `ant manualOffline`.
 
 
 Eclipse and other IDE setup
-===========================
+---------------------------
 
 Below you find the step-by-step setup for Eclipse Mars.1. If you are using a
 different version or an entierly different IDE, still read this, and try to


[03/50] incubator-freemarker git commit: Made README.md more plain-text-viewer friendly.

Posted by dd...@apache.org.
Made README.md more plain-text-viewer friendly.


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

Branch: refs/heads/2.3
Commit: 36fdc7ca2c7acf5b5f6ed34b2677924374c8efa5
Parents: fef04d8
Author: ddekany <dd...@apache.org>
Authored: Thu Apr 13 14:53:30 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Thu Apr 13 14:53:30 2017 +0200

----------------------------------------------------------------------
 README.md | 89 ++++++++++++++++++++++++++++------------------------------
 1 file changed, 43 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/36fdc7ca/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 7b1b039..e4ad314 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,4 @@
 ```
-
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
@@ -16,28 +15,29 @@
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-
 ```
 
 
-Apache FreeMarker {version}   [![Build Status](https://travis-ci.org/apache/incubator-freemarker.svg?branch=2.3-gae)](https://travis-ci.org/apache/incubator-freemarker)
+Apache FreeMarker {version}
 ===========================
- For the latest version or to report bugs visit:
 
- http://freemarker.org/
+[![Build Status](https://travis-ci.org/apache/incubator-freemarker.svg?branch=2.3-gae)](https://travis-ci.org/apache/incubator-freemarker)
 
+For the latest version or to report bugs visit:
+http://freemarker.org/
 
 
 DISCLAIMER
-==========
-  Apache FreeMarker is an effort undergoing incubation at The Apache
-  Software Foundation (ASF). Incubation is required of all newly accepted
-  projects until a further review indicates that the infrastructure,
-  communications, and decision making process have stabilized in a manner
-  consistent with other successful ASF projects. While incubation status is
-  not necessarily a reflection of the completeness or stability of the
-  code, it does indicate that the project has yet to be fully endorsed by
-  the ASF.
+----------
+
+Apache FreeMarker is an effort undergoing incubation at The Apache
+Software Foundation (ASF). Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure,
+communications, and decision making process have stabilized in a manner
+consistent with other successful ASF projects. While incubation status is
+not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by
+the ASF.
 
 
 What is Apache FreeMarker?
@@ -87,6 +87,7 @@ If you are using Maven, just add this dependency:
     <version>{version}</version>
   </dependency>
 ```
+
 Otherwise simply copy freemarker.jar to a location where your Java
 application's ClassLoader will find it. For example, if you are using
 FreeMarker in a web application, you probably want to put
@@ -116,56 +117,52 @@ link.
 Local setup
 ===========
 
-First of all, if you haven't yet, download the source release, or checkout FreeMarker from the source code repository.
+First of all, if you haven't yet, download the source release, or checkout
+FreeMarker from the source code repository.
 
-You need 
-1. JDK 8(!), 
-2. Apache Ant and 
-3. Ivy 
+You need JDK 8(!), Apache Ant and Ivy to be installed. (As of this writing
+it was tested with Ant 1.8.1 and Ivy 2.3.0.). 
 
-to be installed. (As of this writing it was tested with Ant 1.8.1 and Ivy 2.3.0.). 
 
 Ivy Installation
----------------------------
-To install Ivy (but be sure it's not already installed).
-Issue 
-```
-ant download-ivy
-``` 
-which will copy it under ~/.ant/lib. Alternatively, you can copy ivy-<version>.jar into your Ant home directory "lib" subfolder manually.
+----------------
+
+To install Ivy (but be sure it's not already installed). Issue
+`ant download-ivy` which will copy it under `~/.ant/lib`. Alternatively, you
+can copy `ivy-<version>.jar` into your Ant home directory `lib` subfolder
+manually.
 
 
 Building
----------------------------
+--------
 
-To build freemarker.jar, just issue 
-```
-ant
-```
-in the project root directory, and it should download all dependencies automatically and build freemarker.jar. 
+To build `freemarker.jar`, just issue `ant` in the project root directory, and
+it should download all dependencies automatically and build freemarker.jar. 
+
+It's recommended to copy `build.properties.sample` into `build.properties`,
+and edit its content to fit your system. (Although basic jar building should
+succeeds without the build.properties file too.)
 
-It's recommended to copy build.properties.sample into build.properties, and edit its content to fit your system. (Although basic jar building should succeeds without the build.properties file too.)
 
 Managing dependencies
----------------------------
-If later you change the dependencies in ivy.xml, or otherwise want to re-download some of them, it will not happen automatically anymore. Issue 
-```
-ant update-deps
-```
+---------------------
+
+If later you change the dependencies in `ivy.xml`, or otherwise want to
+re-download some of them, it will not happen automatically anymore, and you
+must issue `ant update-deps`.
 
 
 Eclipse and other IDE setup
 ===========================
 
-Below you find the step-by-step setup for Eclipse Mars.1. If you are using a different version or an entierly different IDE, still read this, and try to apply it to your development environment:
+Below you find the step-by-step setup for Eclipse Mars.1. If you are using a
+different version or an entierly different IDE, still read this, and try to
+apply it to your development environment:
 
 - Install Ant and Ivy, if you haven't yet; see earlier.
-- From the command line, run 
-  ```
-  ant clean jar ide-dependencies
-  ```
-   (Note that now the folders "ide-dependencies", "build/generated-sources" and "META-INF"
-  were created.)
+- From the command line, run  `ant clean jar ide-dependencies`
+  (Note that now the folders `ide-dependencies`, `build/generated-sources` and
+  `META-INF` were created.)
 - Start Eclipse
 - You may prefer to start a new workspace (File -> "Switch workspace"), but
   it's optional.


[35/50] incubator-freemarker git commit: Constants.EMPTY_HASH now implements TemplateHashModelEx2, so it can be listed with <#list ... as k, v>. Earlier it was only a TemplateHashModelEx. Added Constants.EMPTY_KEY_VALUE_PAIR_ITERATOR.

Posted by dd...@apache.org.
Constants.EMPTY_HASH now implements TemplateHashModelEx2, so it can be listed with <#list ... as k, v>. Earlier it was only a TemplateHashModelEx. Added Constants.EMPTY_KEY_VALUE_PAIR_ITERATOR.


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

Branch: refs/heads/2.3
Commit: 507ba1f4b73da433c3f3aa0176211fcc21713a42
Parents: c3672d9
Author: ddekany <dd...@apache.org>
Authored: Sun Jul 23 11:18:34 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Jul 23 11:18:34 2017 +0200

----------------------------------------------------------------------
 .../freemarker/template/utility/Constants.java  | 36 +++++++++++++++++++-
 src/manual/en_US/book.xml                       | 12 +++++++
 .../template/utility/ConstantsTest.java         | 21 ++++++++++++
 3 files changed, 68 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/507ba1f4/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 ac948a9..fd48e70 100644
--- a/src/main/java/freemarker/template/utility/Constants.java
+++ b/src/main/java/freemarker/template/utility/Constants.java
@@ -20,11 +20,14 @@
 package freemarker.template.utility;
 
 import java.io.Serializable;
+import java.util.NoSuchElementException;
 
 import freemarker.template.SimpleNumber;
 import freemarker.template.TemplateBooleanModel;
 import freemarker.template.TemplateCollectionModel;
 import freemarker.template.TemplateHashModelEx;
+import freemarker.template.TemplateHashModelEx2;
+import freemarker.template.TemplateHashModelEx2.KeyValuePairIterator;
 import freemarker.template.TemplateModel;
 import freemarker.template.TemplateModelException;
 import freemarker.template.TemplateModelIterator;
@@ -95,7 +98,11 @@ public class Constants {
     
     public static final TemplateHashModelEx EMPTY_HASH = new EmptyHashModel();
     
-    private static class EmptyHashModel implements TemplateHashModelEx, Serializable {
+    /**
+     * An empty hash. Since 2.3.27, it implements {@link TemplateHashModelEx2}, before that it was only
+     * {@link TemplateHashModelEx}.
+     */
+    private static class EmptyHashModel implements TemplateHashModelEx2, Serializable {
         
         public int size() throws TemplateModelException {
             return 0;
@@ -116,7 +123,34 @@ public class Constants {
         public boolean isEmpty() throws TemplateModelException {
             return true;
         }
+
+        public KeyValuePairIterator keyValuePairIterator() throws TemplateModelException {
+            return EMPTY_KEY_VALUE_PAIR_ITERATOR;
+        }
         
     }
     
+    /**
+     * @since 2.3.27
+     */
+    public static final KeyValuePairIterator EMPTY_KEY_VALUE_PAIR_ITERATOR = EmptyKeyValuePairIterator.INSTANCE;
+    
+    private static class EmptyKeyValuePairIterator implements TemplateHashModelEx2.KeyValuePairIterator {
+
+        static final EmptyKeyValuePairIterator INSTANCE = new EmptyKeyValuePairIterator();
+
+        private EmptyKeyValuePairIterator() {
+            //
+        }
+
+        public boolean hasNext() throws TemplateModelException {
+            return false;
+        }
+
+        public TemplateHashModelEx2.KeyValuePair next() throws TemplateModelException {
+            throw new NoSuchElementException("Can't retrieve element from empty key-value pair iterator.");
+        }
+
+    }    
+    
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/507ba1f4/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 3897385..e072d1a 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -26966,6 +26966,18 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
               <literal>output_format=freemarker.core.XHTMLOutputFormat()</literal>
               did).</para>
             </listitem>
+
+            <listitem>
+              <para><literal>Constants.EMPTY_HASH</literal> now implements
+              <literal>TemplateHashModelEx2</literal>, so it can be listed
+              with <literal>&lt;#list ... as k, v&gt;</literal>. Earlier it
+              was only a <literal>TemplateHashModelEx</literal>.</para>
+            </listitem>
+
+            <listitem>
+              <para>Added
+              <literal>Constants.EMPTY_KEY_VALUE_PAIR_ITERATOR</literal></para>
+            </listitem>
           </itemizedlist>
         </section>
       </section>

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/507ba1f4/src/test/java/freemarker/template/utility/ConstantsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/template/utility/ConstantsTest.java b/src/test/java/freemarker/template/utility/ConstantsTest.java
new file mode 100644
index 0000000..ec18114
--- /dev/null
+++ b/src/test/java/freemarker/template/utility/ConstantsTest.java
@@ -0,0 +1,21 @@
+package freemarker.template.utility;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import freemarker.template.TemplateException;
+import freemarker.test.TemplateTest;
+
+public final class ConstantsTest extends TemplateTest {
+    
+    @Test
+    public void testEmptyHash() throws IOException, TemplateException {
+        addToDataModel("h", Constants.EMPTY_HASH);
+        assertOutput("{<#list h as k ,v>x</#list>}", "{}"); 
+        assertOutput("{<#list h?keys as k>x</#list>}", "{}"); 
+        assertOutput("{<#list h?values as k>x</#list>}", "{}"); 
+        assertOutput("${h?size}", "0"); 
+    }
+    
+}


[02/50] incubator-freemarker git commit: Converted the README from plain txt to markdown, and added the build status from Travis

Posted by dd...@apache.org.
Converted the README from plain txt to markdown, and added the build status from Travis

Merge commit 'refs/pull/21/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/fef04d8c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/fef04d8c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/fef04d8c

Branch: refs/heads/2.3
Commit: fef04d8cd64966face55efb1b4cb1e4748a798c1
Parents: 93dea88 f871237
Author: ddekany <dd...@apache.org>
Authored: Thu Apr 13 14:34:04 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Thu Apr 13 14:41:32 2017 +0200

----------------------------------------------------------------------
 README    | 237 ----------------------------------------------------
 README.md | 256 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 build.xml |  10 +--
 3 files changed, 260 insertions(+), 243 deletions(-)
----------------------------------------------------------------------



[16/50] 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/7b35587e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/7b35587e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/7b35587e

Branch: refs/heads/2.3
Commit: 7b35587ebf34f94b9d378c70da6ab8cae130e246
Parents: a566847
Author: ddekany <dd...@apache.org>
Authored: Fri May 26 10:05:38 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Fri May 26 10:05:38 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/cache/TemplateNameFormat.java     | 4 ++--
 src/main/java/freemarker/core/_Java8Impl.java              | 2 +-
 src/main/java/freemarker/template/TemplateNodeModelEx.java | 4 +---
 3 files changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7b35587e/src/main/java/freemarker/cache/TemplateNameFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/cache/TemplateNameFormat.java b/src/main/java/freemarker/cache/TemplateNameFormat.java
index 99763d0..72126bf 100644
--- a/src/main/java/freemarker/cache/TemplateNameFormat.java
+++ b/src/main/java/freemarker/cache/TemplateNameFormat.java
@@ -26,8 +26,8 @@ import freemarker.template.Version;
 import freemarker.template.utility.StringUtil;
 
 /**
- * Symbolized template name format. The API of this class isn't exposed as it's too immature, so custom
- * template name formats aren't possible yet.
+ * Symbolizes a template name format, which defines the basic syntax of names through algorithms such as normalization.
+ * The API of this class isn't exposed as it's too immature, so custom template name formats aren't possible yet.
  *
  * @since 2.3.22
  */

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7b35587e/src/main/java/freemarker/core/_Java8Impl.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/_Java8Impl.java b/src/main/java/freemarker/core/_Java8Impl.java
index 40f0910..fa8b528 100644
--- a/src/main/java/freemarker/core/_Java8Impl.java
+++ b/src/main/java/freemarker/core/_Java8Impl.java
@@ -22,7 +22,7 @@ import java.lang.reflect.Method;
 
 /**
  * Used internally only, might changes without notice!
- * Used for accessing functionality that's only present in Java 6 or later.
+ * Used for accessing functionality that's only present in Java 8 or later.
  */
 // Compile this against Java 8
 @SuppressWarnings("Since15") // For IntelliJ inspection

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7b35587e/src/main/java/freemarker/template/TemplateNodeModelEx.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/TemplateNodeModelEx.java b/src/main/java/freemarker/template/TemplateNodeModelEx.java
index 16ef7d0..4d5f905 100644
--- a/src/main/java/freemarker/template/TemplateNodeModelEx.java
+++ b/src/main/java/freemarker/template/TemplateNodeModelEx.java
@@ -19,10 +19,8 @@
 
 package freemarker.template;
 
-import freemarker.ext.dom.NodeModel;
-
 /**
- * A {@link NodeModel} that supports navigating to the previous and next sibling nodes.
+ * A {@link TemplateNodeModel} that supports navigating to the previous and next sibling nodes.
  * 
  * @since 2.3.26
  */


[06/50] incubator-freemarker git commit: (Minor JavaDoc improvements)

Posted by dd...@apache.org.
(Minor 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/9a609744
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/9a609744
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/9a609744

Branch: refs/heads/2.3
Commit: 9a609744e0494df0bd90c36f4bc9af926619e946
Parents: 62e2678
Author: ddekany <dd...@apache.org>
Authored: Mon Apr 17 11:38:30 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Mon Apr 17 11:38:30 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/Configurable.java      | 4 ++--
 src/main/java/freemarker/template/Configuration.java | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9a609744/src/main/java/freemarker/core/Configurable.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java
index 3aff2a6..7262e4f 100644
--- a/src/main/java/freemarker/core/Configurable.java
+++ b/src/main/java/freemarker/core/Configurable.java
@@ -1427,7 +1427,7 @@ public class Configurable {
     }
     
     /**
-     * Sets the URL escaping charset. If not set ({@code null}), the output encoding
+     * Sets the URL escaping (URL encoding, percentage encoding) charset. If {@code null}, the output encoding
      * ({@link #setOutputEncoding(String)}) will be used for URL escaping.
      * 
      * Defaults to {@code null}.
@@ -1720,7 +1720,7 @@ public class Configurable {
      * set to 2.3.24 fixes a rarely surfacing bug with that).
      * 
      * <p>
-     * It's recommended to set the {@code auto_impots_lazy} setting ({@link Configuration#setLazyAutoImports(Boolean)})
+     * It's recommended to set the {@code lazy_auto_imports} setting ({@link Configuration#setLazyAutoImports(Boolean)})
      * to {@code true} when using this, so that auto-imports that are unused in a template won't degrade performance by
      * unnecessary loading and initializing the imported library.
      * 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9a609744/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 ca5ee72..ca6729c 100644
--- a/src/main/java/freemarker/template/Configuration.java
+++ b/src/main/java/freemarker/template/Configuration.java
@@ -2983,7 +2983,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
                     if (!(item instanceof OutputFormat)) {
                         throw new _MiscTemplateException(getEnvironment(),
                                 "Invalid value for setting ", new _DelayedJQuote(name), ": List items must be "
-                                + OutputFormat.class.getName() + " intances, in: ", value);
+                                + OutputFormat.class.getName() + " instances, in: ", value);
                     }
                 }
                 setRegisteredCustomOutputFormats(list);


[41/50] incubator-freemarker git commit: Documented the precision of arithmetical operations

Posted by dd...@apache.org.
Documented the precision of arithmetical operations


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

Branch: refs/heads/2.3
Commit: 2aebfe53331a6306481d44cee94eb45c6f42797b
Parents: e3d1bb8
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 11:05:32 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Aug 5 11:05:32 2017 +0200

----------------------------------------------------------------------
 .../java/freemarker/core/ArithmeticEngine.java    |  5 +++--
 src/manual/en_US/book.xml                         | 18 ++++++++++++++++--
 2 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2aebfe53/src/main/java/freemarker/core/ArithmeticEngine.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/ArithmeticEngine.java b/src/main/java/freemarker/core/ArithmeticEngine.java
index c07dc92..5e485b8 100644
--- a/src/main/java/freemarker/core/ArithmeticEngine.java
+++ b/src/main/java/freemarker/core/ArithmeticEngine.java
@@ -30,9 +30,10 @@ import freemarker.template.utility.OptimizerUtil;
 import freemarker.template.utility.StringUtil;
 
 /**
- * Class to perform arithmetic operations.
+ * Used for implementing the arithmetic operations and number comparisons in the template language. The concrete
+ * implementation is plugged into the configuration with the {@code arithmetical_engine} setting. 
+ * (See {@link Configurable#setArithmeticEngine(ArithmeticEngine)}.)
  */
-
 public abstract class ArithmeticEngine {
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2aebfe53/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index e072d1a..1288f8a 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -3304,8 +3304,6 @@ Slicing with right-unlimited ranges:
             </listitem>
           </itemizedlist>
 
-          <remark>Information about the precision?</remark>
-
           <para>Example:</para>
 
           <programlisting role="template">${100 - x * x}
@@ -3385,6 +3383,22 @@ ${12 % 6.9} &lt;#-- Prints 0 --&gt;</programlisting>
 ${-12 % 5} &lt;#-- Prints -2 --&gt;
 ${12 % -5} &lt;#-- Prints 2 --&gt;
 </programlisting>
+
+          <para role="forProgrammers">About the precision of the operations:
+          By default FreeMarker uses <literal>BigDecimal</literal>-s for all
+          arithmetical calculations, to avoid rounding and overflow/underflow
+          artifacts, and also keeps the result as
+          <literal>BigDecimal</literal>-s. So <literal>+</literal> (addition),
+          <literal>-</literal> (subtraction) and <literal>*</literal>
+          (multiplication) are <quote>lossless</quote>. Again by default,
+          <literal>/</literal> (division) results are calculated to 12
+          decimals with half-up rounding (unless some operands have even more
+          decimals, in which case it's calculated with that much decimals).
+          All this behavior depends on the
+          <literal>arithmetic_engine</literal> configuration setting
+          (<literal>Configurable.setArithmericEngine(ArithmericEngine)</literal>)
+          though, and some application might use a different value than the
+          default, although that's highly uncommon.</para>
         </section>
 
         <section xml:id="dgui_template_exp_comparison">


[32/50] incubator-freemarker git commit: Bug fixed: Comments were not allowed by the parser between the switch tag and the first case tag.

Posted by dd...@apache.org.
Bug fixed: Comments were not allowed by the parser between the switch tag and the first case tag.


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

Branch: refs/heads/2.3
Commit: 1dba510cc690898523e138385dd8eb4111b32453
Parents: 9b87988
Author: ddekany <dd...@apache.org>
Authored: Sat Jul 8 19:33:39 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Jul 8 19:33:39 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/Case.java        |  4 +-
 src/main/java/freemarker/core/SwitchBlock.java | 31 ++++++++--
 src/main/javacc/FTL.jj                         | 66 +++++++++++++++++++--
 src/manual/en_US/book.xml                      |  6 ++
 4 files changed, 95 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/1dba510c/src/main/java/freemarker/core/Case.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Case.java b/src/main/java/freemarker/core/Case.java
index c580c4d..6d23716 100644
--- a/src/main/java/freemarker/core/Case.java
+++ b/src/main/java/freemarker/core/Case.java
@@ -24,8 +24,8 @@ package freemarker.core;
  */
 final class Case extends TemplateElement {
 
-    final int TYPE_CASE = 0;
-    final int TYPE_DEFAULT = 1;
+    static final int TYPE_CASE = 0;
+    static final int TYPE_DEFAULT = 1;
     
     Expression condition;
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/1dba510c/src/main/java/freemarker/core/SwitchBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/SwitchBlock.java b/src/main/java/freemarker/core/SwitchBlock.java
index cfa354c..15a5eea 100644
--- a/src/main/java/freemarker/core/SwitchBlock.java
+++ b/src/main/java/freemarker/core/SwitchBlock.java
@@ -30,13 +30,20 @@ final class SwitchBlock extends TemplateElement {
 
     private Case defaultCase;
     private final Expression searched;
+    private int firstCaseIndex;
 
     /**
      * @param searched the expression to be tested.
      */
-    SwitchBlock(Expression searched) {
+    SwitchBlock(Expression searched, MixedContent ignoredSectionBeforeFirstCase) {
         this.searched = searched;
-        setChildBufferCapacity(4);
+        
+        int ignoredCnt = ignoredSectionBeforeFirstCase != null ? ignoredSectionBeforeFirstCase.getChildCount() : 0;
+        setChildBufferCapacity(ignoredCnt + 4);
+        for (int i = 0; i < ignoredCnt; i++) {
+            addChild(ignoredSectionBeforeFirstCase.getChild(i));
+        }
+        firstCaseIndex = ignoredCnt; // Note that normally postParseCleanup will overwrite this 
     }
 
     /**
@@ -55,7 +62,7 @@ final class SwitchBlock extends TemplateElement {
         boolean processedCase = false;
         int ln = getChildCount();
         try {
-            for (int i = 0; i < ln; i++) {
+            for (int i = firstCaseIndex; i < ln; i++) {
                 Case cas = (Case) getChild(i);
                 boolean processCase = false;
 
@@ -94,8 +101,7 @@ final class SwitchBlock extends TemplateElement {
             buf.append('>');
             int ln = getChildCount();
             for (int i = 0; i < ln; i++) {
-                Case cas = (Case) getChild(i);
-                buf.append(cas.getCanonicalForm());
+                buf.append(getChild(i).getCanonicalForm());
             }
             buf.append("</").append(getNodeTypeSymbol()).append('>');
         }
@@ -128,5 +134,20 @@ final class SwitchBlock extends TemplateElement {
     boolean isNestedBlockRepeater() {
         return false;
     }
+
+    @Override
+    TemplateElement postParseCleanup(boolean stripWhitespace) throws ParseException {
+        TemplateElement result = super.postParseCleanup(stripWhitespace);
+        
+        // The first #case might have shifted in the child array, so we have to find it again:
+        int ln = getChildCount();
+        int i = 0;
+        while (i < ln && !(getChildAt(i) instanceof Case)) {
+            i++;
+        }
+        firstCaseIndex = i;
+        
+        return result;
+    }
     
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/1dba510c/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index 94338af..fb6106d 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -3581,18 +3581,22 @@ TransformBlock Transform() :
 SwitchBlock Switch() :
 {
     SwitchBlock switchBlock;
+    MixedContent ignoredSectionBeforeFirstCase = null;
     Case caseIns;
     Expression switchExp;
     Token start, end;
     boolean defaultFound = false;
 }
 {
-    start = <SWITCH>
-    switchExp = Expression()
-    <DIRECTIVE_END>
+    (
+	    start = <SWITCH>
+	    switchExp = Expression()
+	    <DIRECTIVE_END>
+        [ ignoredSectionBeforeFirstCase = WhitespaceAndComments() ]
+    )
     {
         breakableDirectiveNesting++;
-        switchBlock = new SwitchBlock(switchExp);
+        switchBlock = new SwitchBlock(switchExp, ignoredSectionBeforeFirstCase);
     }
     (
         LOOKAHEAD(2)
@@ -3624,7 +3628,6 @@ Case Case() :
     Token start;
 }
 {
-    [<STATIC_TEXT_WS>]
     (
         start = <CASE> exp = Expression() <DIRECTIVE_END>
         |
@@ -3990,6 +3993,21 @@ TextBlock PCData() :
     }
 }
 
+TextBlock WhitespaceText() :
+{
+    Token t = null, start = null;
+}
+{
+    t = <STATIC_TEXT_WS>
+    {
+        if (stripText && mixedContentNesting == 1 && !preventStrippings) return null;
+
+        TextBlock result = new TextBlock(t.image, false);
+        result.setLocation(template, t, t);
+        return result;
+    }
+}
+
 /**
  * Production for dealing with unparsed content,
  * i.e. what is inside a comment or noparse tag.
@@ -4150,6 +4168,44 @@ TemplateElement FreeMarkerText() :
     }
 }
 
+/**
+ * To be used between tags that in theory has nothing between, such between #switch and the first #case.
+ */
+MixedContent WhitespaceAndComments() :
+{
+    MixedContent nodes = new MixedContent();
+    TemplateElement elem, begin = null;
+}
+{
+    (
+        (
+            elem = WhitespaceText()
+            |
+            elem = Comment()
+        )
+        {
+            if (elem != null) { // not removed by stripText
+	            if (begin == null) {
+	                begin = elem;
+	            }
+	            nodes.addChild(elem);
+            }
+        }
+    )+
+    {
+        if (begin == null // Was is removed by stripText?
+                // Nodes here won't be ever executed anyway, but whitespace stripping should still remove the
+                // lonely TextBlock from the AST, as that's purely source code formatting. If it's not lonely, then
+                // there must be a comment, in which case the generic whitespace stripping algorithm will kick in.
+                || stripWhitespace && !preventStrippings
+                        && nodes.getChildCount() == 1 && nodes.getChild(0) instanceof TextBlock) {
+            return null;
+        }
+        nodes.setLocation(template, begin, elem);
+        return nodes;
+    }
+}
+
 void HeaderElement() :
 {
     Token key;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/1dba510c/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index fbbee7e..3897385 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -26910,6 +26910,12 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
               and <literal>and</literal> without <literal>\</literal> is not
               recognized for backward compatibility.</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>
+            </listitem>
           </itemizedlist>
         </section>
 


[30/50] incubator-freemarker git commit: Updated version number

Posted by dd...@apache.org.
Updated version number


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

Branch: refs/heads/2.3
Commit: a36ea52359bd90fa45340537b66ec58216f8be41
Parents: 9b3d130
Author: ddekany <dd...@apache.org>
Authored: Sat Jul 8 00:51:20 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Jul 8 00:52:15 2017 +0200

----------------------------------------------------------------------
 src/main/resources/freemarker/version.properties         | 11 +++++------
 .../freemarker/template/DefaultObjectWrapperTest.java    |  1 +
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a36ea523/src/main/resources/freemarker/version.properties
----------------------------------------------------------------------
diff --git a/src/main/resources/freemarker/version.properties b/src/main/resources/freemarker/version.properties
index 4750d18..9a1a8c5 100644
--- a/src/main/resources/freemarker/version.properties
+++ b/src/main/resources/freemarker/version.properties
@@ -58,12 +58,11 @@
 # - When the major version number is increased, major backward
 #   compatibility violations are allowed, but still should be avoided.
 # During Apache Incubation, "-incubating" is added to this string.
-version=2.3.26-incubating
-# This exists as oss.sonatype only allows SNAPSHOT and final releases,
-# so instead 2.3.21-rc01 and such we have to use 2.3.21-SNAPSHOT there.
-# For final releases it's the same as "version".
-# During Apache Incubation, "-incubating" is added to this string.
-mavenVersion=2.3.26-incubating
+version=2.3.27-nightly_@timestampInVersion@-incubating
+# This exists as for Maven we use "-SNAPSHOT" for non-final releases.
+# For final releases it's the same as "version". During Apache
+# Incubation, "-incubating" is added *before* "-SNAPSHOT".
+mavenVersion=2.3.27-incubating-SNAPSHOT
 
 # Version string that conforms to OSGi
 # ------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a36ea523/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 dcbc659..9a9e283 100644
--- a/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
+++ b/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
@@ -93,6 +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
 
         List<Version> actual = new ArrayList<Version>();
         for (int i = _TemplateAPI.VERSION_INT_2_3_0; i <= Configuration.getVersion().intValue(); i++) {


[18/50] incubator-freemarker git commit: Configuration object builder expression: Slightly improved error message for something=NoSuchClass when the class name contains no dot

Posted by dd...@apache.org.
Configuration object builder expression: Slightly improved error message for something=NoSuchClass when the class name contains no dot


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

Branch: refs/heads/2.3
Commit: f0a6f4511e79d2e7aeb3d6ba5c7c2b12b96159b8
Parents: 017e9f5
Author: ddekany <dd...@apache.org>
Authored: Fri May 26 10:22:25 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Fri May 26 10:22:25 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f0a6f451/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java b/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java
index 2f91b55..ae99899 100644
--- a/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java
+++ b/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java
@@ -879,7 +879,7 @@ public class _ObjectBuilderSettingEvaluator {
                         throw new LegacyExceptionWrapperSettingEvaluationExpression(e);
                     }
                 } catch (LegacyExceptionWrapperSettingEvaluationExpression e) {
-                    if (!canBeStaticField) {
+                    if (!canBeStaticField || className.indexOf('.') == -1) {
                         throw e;
                     }
                     // Silently try to interpret className as static filed, throw the original exception if that fails. 


[17/50] incubator-freemarker git commit: FREEMARKER-52: When setting the output_format with Properties, the XHTML abbreviation wasn't recognized. Like in a .properties file, output_format=XHTML didn't work, only output_format=freemarker.core.XHTMLOutputF

Posted by dd...@apache.org.
FREEMARKER-52: When setting the output_format with Properties, the XHTML abbreviation wasn't recognized. Like in a .properties file, output_format=XHTML didn't work, only output_format=freemarker.core.XHTMLOutputFormat() did.


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

Branch: refs/heads/2.3
Commit: 017e9f58065043066bf3a3f27c8bafb86b55dec2
Parents: 7b35587
Author: ddekany <dd...@apache.org>
Authored: Fri May 26 10:07:25 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Fri May 26 10:07:52 2017 +0200

----------------------------------------------------------------------
 .../core/_ObjectBuilderSettingEvaluator.java    |  1 +
 src/manual/en_US/book.xml                       | 31 +++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/017e9f58/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java b/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java
index ed0849d..2f91b55 100644
--- a/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java
+++ b/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java
@@ -683,6 +683,7 @@ public class _ObjectBuilderSettingEvaluator {
             addWithSimpleName(SHORTHANDS, FirstMatchTemplateConfigurationFactory.class);
 
             addWithSimpleName(SHORTHANDS, HTMLOutputFormat.class);
+            addWithSimpleName(SHORTHANDS, XHTMLOutputFormat.class);
             addWithSimpleName(SHORTHANDS, XMLOutputFormat.class);
             addWithSimpleName(SHORTHANDS, RTFOutputFormat.class);
             addWithSimpleName(SHORTHANDS, PlainTextOutputFormat.class);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/017e9f58/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 3d68c65..a3656d1 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -30,7 +30,7 @@
 
     <titleabbrev>Manual</titleabbrev>
 
-    <productname>Freemarker 2.3.26</productname>
+    <productname>Freemarker 2.3.27</productname>
   </info>
 
   <preface role="index.html" xml:id="preface">
@@ -26840,6 +26840,35 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
     <appendix xml:id="app_versions">
       <title>Version history</title>
 
+      <section xml:id="versions_2_3_27">
+        <title>2.3.27 (incubating at Apache)</title>
+
+        <para>Release date: FIXME</para>
+
+        <para><emphasis role="bold">This is a stable, final
+        release.</emphasis> The <quote>incubating</quote> suffix is required
+        by the Apache Software Foundation until the project becomes a fully
+        accepted (graduated) Apache project.</para>
+
+        <section>
+          <title>Changes on the Java side</title>
+
+          <itemizedlist>
+            <listitem>
+              <para>Bug fixed (<link
+              xlink:href="https://issues.apache.org/jira/browse/FREEMARKER-52">FREEMARKER-52</link>):
+              When setting the <literal>output_format</literal> with
+              <literal>Properties</literal>, the <literal>XHTML</literal>
+              abbreviation wasn't recognized. Like in a
+              <literal>.properties</literal> file,
+              <literal>output_format=XHTML</literal> didn't work, only
+              <literal>output_format=freemarker.core.XHTMLOutputFormat()</literal>
+              did.</para>
+            </listitem>
+          </itemizedlist>
+        </section>
+      </section>
+
       <section xml:id="versions_2_3_26">
         <title>2.3.26 (incubating at Apache)</title>
 


[34/50] incubator-freemarker git commit: Additions to the recent #switch improvements.

Posted by dd...@apache.org.
Additions to the recent #switch 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/c3672d96
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/c3672d96
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/c3672d96

Branch: refs/heads/2.3
Commit: c3672d96544e1cb96454410cd76a737ec4cf80e5
Parents: 6f0283d
Author: ddekany <dd...@apache.org>
Authored: Sun Jul 9 17:12:52 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Jul 9 17:12:52 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/SwitchBlock.java                    | 2 +-
 .../resources/freemarker/test/templatesuite/expected/switch.txt   | 2 ++
 .../resources/freemarker/test/templatesuite/templates/switch.ftl  | 3 +++
 3 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c3672d96/src/main/java/freemarker/core/SwitchBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/SwitchBlock.java b/src/main/java/freemarker/core/SwitchBlock.java
index 15a5eea..3f8a320 100644
--- a/src/main/java/freemarker/core/SwitchBlock.java
+++ b/src/main/java/freemarker/core/SwitchBlock.java
@@ -142,7 +142,7 @@ final class SwitchBlock extends TemplateElement {
         // The first #case might have shifted in the child array, so we have to find it again:
         int ln = getChildCount();
         int i = 0;
-        while (i < ln && !(getChildAt(i) instanceof Case)) {
+        while (i < ln && !(getChild(i) instanceof Case)) {
             i++;
         }
         firstCaseIndex = i;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c3672d96/src/test/resources/freemarker/test/templatesuite/expected/switch.txt
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/expected/switch.txt b/src/test/resources/freemarker/test/templatesuite/expected/switch.txt
index 5d42785..d0dbd27 100644
--- a/src/test/resources/freemarker/test/templatesuite/expected/switch.txt
+++ b/src/test/resources/freemarker/test/templatesuite/expected/switch.txt
@@ -63,6 +63,8 @@
 
 []
 
+[]
+
   ""
   "1234"
   "234"

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c3672d96/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl b/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl
index 4404307..e9bd377 100644
--- a/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl
+++ b/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl
@@ -97,6 +97,7 @@
     <#case 3>
       3
       <#switch x*2>
+        <#--  Comment is allowed here since 2.3.27 -->
         <#case 1>
           i1
           <#break>
@@ -122,6 +123,8 @@
   <#case 1>sadas
 </#switch>]
 
+[<#switch 213></#switch>]
+
 <#-- Fall-through -->
 <#list [ 0, 1, 2, 3, 4 ] as x>
   "<#switch x><#case 1>1<#case 2>2<#case 3>3<#case 4>4</#switch>"


[38/50] incubator-freemarker git commit: Simplified (and faster) capturing assignment implementation (backported from FM3 branch)

Posted by dd...@apache.org.
Simplified (and faster) capturing assignment implementation (backported from FM3 branch)


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

Branch: refs/heads/2.3
Commit: 16ff17463762a18e9316814e53b1ad0e5eb09559
Parents: 77e877c
Author: ddekany <dd...@apache.org>
Authored: Thu Jul 27 18:54:01 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Thu Jul 27 19:14:57 2017 +0200

----------------------------------------------------------------------
 .../java/freemarker/core/BlockAssignment.java   | 84 +++++---------------
 src/main/java/freemarker/core/Environment.java  | 15 ++++
 .../core/CapturingAssignmentTest.java           | 55 +++++++++++++
 3 files changed, 89 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/16ff1746/src/main/java/freemarker/core/BlockAssignment.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/BlockAssignment.java b/src/main/java/freemarker/core/BlockAssignment.java
index 07ff070..8c9e403 100644
--- a/src/main/java/freemarker/core/BlockAssignment.java
+++ b/src/main/java/freemarker/core/BlockAssignment.java
@@ -21,14 +21,11 @@ package freemarker.core;
 
 import java.io.IOException;
 import java.io.StringWriter;
-import java.io.Writer;
-import java.util.Map;
 
 import freemarker.template.SimpleScalar;
 import freemarker.template.TemplateException;
 import freemarker.template.TemplateModel;
 import freemarker.template.TemplateModelException;
-import freemarker.template.TemplateTransformModel;
 
 /**
  * Like [#local x]...[/#local].
@@ -51,21 +48,28 @@ final class BlockAssignment extends TemplateElement {
     @Override
     TemplateElement[] accept(Environment env) throws TemplateException, IOException {
         TemplateElement[] children = getChildBuffer();
+        
+        TemplateModel value;
         if (children != null) {
-            env.visitAndTransform(children, new CaptureOutput(env), null);
+            StringWriter out = new StringWriter();
+            env.visit(children, out);
+            value = capturedStringToModel(out.toString());
+        } else {
+            value = capturedStringToModel("");
+        }
+        
+        if (namespaceExp != null) {
+            ((Environment.Namespace) namespaceExp.eval(env)).put(varName, value);
+        } else if (scope == Assignment.NAMESPACE) {
+            env.setVariable(varName, value);
+        } else if (scope == Assignment.GLOBAL) {
+            env.setGlobalVariable(varName, value);
+        } else if (scope == Assignment.LOCAL) {
+            env.setLocalVariable(varName, value);
         } else {
-            TemplateModel value = capturedStringToModel("");
-            if (namespaceExp != null) {
-                Environment.Namespace ns = (Environment.Namespace) namespaceExp.eval(env);
-                ns.put(varName, value);
-            } else if (scope == Assignment.NAMESPACE) {
-                env.setVariable(varName, value);
-            } else if (scope == Assignment.GLOBAL) {
-                env.setGlobalVariable(varName, value);
-            } else if (scope == Assignment.LOCAL) {
-                env.setLocalVariable(varName, value);
-            }
+            throw new BugException("Unhandled scope");
         }
+        
         return null;
     }
 
@@ -73,56 +77,6 @@ final class BlockAssignment extends TemplateElement {
         return markupOutputFormat == null ? new SimpleScalar(s) : markupOutputFormat.fromMarkup(s);
     }
 
-    private class CaptureOutput implements TemplateTransformModel {
-        private final Environment env;
-        private final Environment.Namespace fnsModel;
-        
-        CaptureOutput(Environment env) throws TemplateException {
-            this.env = env;
-            TemplateModel nsModel = null;
-            if (namespaceExp != null) {
-                nsModel = namespaceExp.eval(env);
-                if (!(nsModel instanceof Environment.Namespace)) {
-                    throw new NonNamespaceException(namespaceExp, nsModel, env);
-                }
-            }
-            fnsModel = (Environment.Namespace ) nsModel; 
-        }
-        
-        public Writer getWriter(Writer out, Map args) {
-            return new StringWriter() {
-                @Override
-                public void close() throws IOException {
-                    TemplateModel result;
-                    try {
-                        result = capturedStringToModel(toString());
-                    } catch (TemplateModelException e) {
-                        // [Java 1.6] e to cause
-                        throw new IOException("Failed to create FTL value from captured string: " + e);
-                    }
-                    switch(scope) {
-                        case Assignment.NAMESPACE: {
-                            if (fnsModel != null) {
-                                fnsModel.put(varName, result);
-                            } else {
-                                env.setVariable(varName, result);
-                            }
-                            break;
-                        }
-                        case Assignment.LOCAL: {
-                            env.setLocalVariable(varName, result);
-                            break;
-                        }
-                        case Assignment.GLOBAL: {
-                            env.setGlobalVariable(varName, result);
-                            break;
-                        }
-                    }
-                }
-            };
-        }
-    }
-    
     @Override
     protected String dump(boolean canonical) {
         StringBuilder sb = new StringBuilder();

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/16ff1746/src/main/java/freemarker/core/Environment.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Environment.java b/src/main/java/freemarker/core/Environment.java
index 1fa59a0..c826381 100644
--- a/src/main/java/freemarker/core/Environment.java
+++ b/src/main/java/freemarker/core/Environment.java
@@ -377,6 +377,21 @@ public final class Environment extends Configurable {
         }
     }
 
+    /**
+     * Visits the elements while temporarily using the parameter output {@link Writer}.
+     * 
+     * @since 2.3.27
+     */
+    final void visit(TemplateElement[] elementBuffer, Writer out) throws IOException, TemplateException {
+        Writer prevOut = this.out;
+        this.out = out;
+        try {
+            visit(elementBuffer);
+        } finally {
+            this.out = prevOut;
+        }
+    }
+    
     @SuppressFBWarnings(value = "RANGE_ARRAY_INDEX", justification = "Not called when stack is empty")
     private TemplateElement replaceTopElement(TemplateElement element) {
         return instructionStack[instructionStackSize - 1] = element;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/16ff1746/src/test/java/freemarker/core/CapturingAssignmentTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/CapturingAssignmentTest.java b/src/test/java/freemarker/core/CapturingAssignmentTest.java
new file mode 100644
index 0000000..2664dff
--- /dev/null
+++ b/src/test/java/freemarker/core/CapturingAssignmentTest.java
@@ -0,0 +1,55 @@
+package freemarker.core;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import freemarker.cache.StringTemplateLoader;
+import freemarker.template.Configuration;
+import freemarker.template.TemplateException;
+import freemarker.test.TemplateTest;
+
+public class CapturingAssignmentTest extends TemplateTest {
+
+    @Override
+    protected Configuration createConfiguration() throws Exception {
+        Configuration cfg = super.createConfiguration();
+        cfg.setTemplateLoader(new StringTemplateLoader());
+        return cfg;
+    }
+
+    @Test
+    public void testAssign() throws IOException, TemplateException {
+        assertOutput("<#assign x></#assign>[${x}]", "[]");
+        assertOutput("<#assign x><p>${1 + 1}</#assign>${x + '&'}", "<p>2&");
+        assertOutput("<#ftl outputFormat='HTML'><#assign x><p>${1 + 1}</#assign>${x + '&'}", "<p>2&amp;");
+    }
+
+    @Test
+    public void testAssignNs() throws IOException, TemplateException {
+        addTemplate("lib.ftl", "");
+        assertOutput("<#import 'lib.ftl' as lib>"
+                + "<#assign x in lib></#assign>[${lib.x}]", "[]");
+        assertOutput("<#import 'lib.ftl' as lib>"
+                + "<#assign x in lib><p>${1 + 1}</#assign>${lib.x + '&'}", "<p>2&");
+        assertOutput("<#ftl outputFormat='HTML'>"
+                + "<#import 'lib.ftl' as lib>"
+                + "<#assign x in lib><p>${1 + 1}</#assign>${lib.x + '&'}", "<p>2&amp;");
+    }
+    
+    @Test
+    public void testGlobal() throws IOException, TemplateException {
+        assertOutput("<#global x></#global>[${.globals.x}]", "[]");
+        assertOutput("<#global x><p>${1 + 1}</#global>${.globals.x + '&'}", "<p>2&");
+        assertOutput("<#ftl outputFormat='HTML'><#global x><p>${1 + 1}</#global>${.globals.x + '&'}", "<p>2&amp;");
+    }
+
+    @Test
+    public void testLocal() throws IOException, TemplateException {
+        assertOutput("<#macro m><#local x></#local>[${x}]</#macro><@m/>${x!}", "[]");
+        assertOutput("<#macro m><#local x><p>${1 + 1}</#local>${x + '&'}</#macro><@m/>${x!}", "<p>2&");
+        assertOutput("<#ftl outputFormat='HTML'>"
+                + "<#macro m><#local x><p>${1 + 1}</#local>${x + '&'}</#macro><@m/>${x!}", "<p>2&amp;");
+    }
+    
+}


[26/50] incubator-freemarker git commit: (JavaDoc improvement)

Posted by dd...@apache.org.
(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/c30c6996
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/c30c6996
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/c30c6996

Branch: refs/heads/2.3
Commit: c30c699635b830f7bd5c4a5523242641d454830a
Parents: 387dcd4
Author: ddekany <dd...@apache.org>
Authored: Sun Jul 2 19:11:20 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Jul 2 19:11:20 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/Configurable.java | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c30c6996/src/main/java/freemarker/core/Configurable.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java
index 9084956..4887dfe 100644
--- a/src/main/java/freemarker/core/Configurable.java
+++ b/src/main/java/freemarker/core/Configurable.java
@@ -1324,12 +1324,8 @@ public class Configurable {
      * output, or if you want to suppress certain exceptions. If you suppress an exception, and the
      * {@link Environment#getLogTemplateExceptions()} returns {@code false}, then it's the responsibility of the
      * {@link TemplateExceptionHandler} to log the exception (if you want it to be logged).  
-     *  
-     * <p>The {@link #setLogTemplateExceptions(boolean) log_template_exceptions} and
-     * {@link #setAttemptExceptionReporter(AttemptExceptionReporter) attempt_exception_reporter} settings take effect
-     * before the {@link TemplateExceptionHandler} is invoked, so these settings are technically independent, and deal
-     * with different aspects of exception handling.  
      * 
+     * @see #setLogTemplateExceptions(boolean)
      * @see #setAttemptExceptionReporter(AttemptExceptionReporter)
      */
     public void setTemplateExceptionHandler(TemplateExceptionHandler templateExceptionHandler) {
@@ -1366,6 +1362,8 @@ public class Configurable {
      * 
      * <p>The {@link AttemptExceptionReporter} is invoked regardless of the value of the
      * {@link #setLogTemplateExceptions(boolean) log_template_exceptions} setting.
+     * The {@link AttemptExceptionReporter} is not invoked if the {@link TemplateExceptionHandler} has suppressed the
+     * exception.
      * 
      * @since 2.3.27
      */


[05/50] incubator-freemarker git commit: Various smaller JavaDoc fixes

Posted by dd...@apache.org.
Various smaller 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/62e26785
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/62e26785
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/62e26785

Branch: refs/heads/2.3
Commit: 62e267859b0db0d23a0be7a7e2f348dcaef1fed0
Parents: 6ac622e
Author: ddekany <dd...@apache.org>
Authored: Fri Apr 14 14:28:08 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Fri Apr 14 14:28:08 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/Configurable.java | 39 ++++++++++----------
 1 file changed, 20 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/62e26785/src/main/java/freemarker/core/Configurable.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java
index 16beca8..3aff2a6 100644
--- a/src/main/java/freemarker/core/Configurable.java
+++ b/src/main/java/freemarker/core/Configurable.java
@@ -684,7 +684,7 @@ public class Configurable {
     /**
      * Sets the time zone used when dealing with {@link java.sql.Date java.sql.Date} and
      * {@link java.sql.Time java.sql.Time} values. It defaults to {@code null} for backward compatibility, but in most
-     * application this should be set to the JVM default time zone (server default time zone), because that's what
+     * applications this should be set to the JVM default time zone (server default time zone), because that's what
      * most JDBC drivers will use when constructing the {@link java.sql.Date java.sql.Date} and
      * {@link java.sql.Time java.sql.Time} values. If this setting is {@code null}, FreeMarker will use the value of
      * ({@link #getTimeZone()}) for {@link java.sql.Date java.sql.Date} and {@link java.sql.Time java.sql.Time} values,
@@ -695,7 +695,7 @@ public class Configurable {
      * 
      * <p>To decide what value you need, a few things has to be understood:
      * <ul>
-     *   <li>Date-only and time-only values in SQL-oriented databases are usually store calendar and clock field
+     *   <li>Date-only and time-only values in SQL-oriented databases usually store calendar and clock field
      *   values directly (year, month, day, or hour, minute, seconds (with decimals)), as opposed to a set of points
      *   on the physical time line. Thus, unlike SQL timestamps, these values usually aren't meant to be shown
      *   differently depending on the time zone of the audience.
@@ -709,7 +709,7 @@ public class Configurable {
      *   Then, 2014-07-12 in the database will be translated to physical time 2014-07-11 22:00:00 UTC, because that
      *   rendered in GMT+02:00 gives 2014-07-12 00:00:00. Similarly, 11:57:00 in the database will be translated to
      *   physical time 1970-01-01 09:57:00 UTC. Thus, the physical time stored in the returned value depends on the
-     *   default system time zone of the JDBC client, not just on the content in the database. (This used to be the
+     *   default system time zone of the JDBC client, not just on the content of the database. (This used to be the
      *   default behavior of ORM-s, like Hibernate, too.)
      *   
      *   <li>The value of the {@code time_zone} FreeMarker configuration setting sets the time zone used for the
@@ -725,11 +725,12 @@ public class Configurable {
      *   values from the earlier examples will be shown as 2014-07-11 (one day off) and 09:57:00 (2 hours off). While
      *   those are the time zone correct renderings, those values are probably meant to be shown "as is".
      *   
-     *   <li>You may wonder why this setting isn't simply "SQL time zone", since the time zone related behavior of JDBC
-     *   applies to {@link java.sql.Timestamp java.sql.Timestamp} too. FreeMarker assumes that you have set up your
-     *   application so that time stamps coming from the database go through the necessary conversion to store the
-     *   correct distance from the epoch (1970-01-01 00:00:00 UTC), as requested by {@link java.util.Date}. In that case
-     *   the time stamp can be safely rendered in different time zones, and thus it needs no special treatment.
+     *   <li>You may wonder why this setting isn't simply "SQL time zone", that is, why's this time zone not applied to
+     *   {@link java.sql.Timestamp java.sql.Timestamp} values as well. Timestamps in databases refer to a point on
+     *   the physical time line, and thus doesn't have the inherent problem of date-only and time-only values.
+     *   FreeMarker assumes that the JDBC driver converts time stamps coming from the database so that they store
+     *   the distance from the epoch (1970-01-01 00:00:00 UTC), as requested by the {@link java.util.Date} API.
+     *   Then time stamps can be safely rendered in different time zones, and thus need no special treatment.
      * </ul>
      * 
      * @param tz Maybe {@code null}, in which case {@link java.sql.Date java.sql.Date} and
@@ -779,8 +780,8 @@ public class Configurable {
      *   <li>{@code "currency"}: The number format returned by {@link NumberFormat#getCurrencyInstance(Locale)}</li>
      *   <li>{@code "percent"}: The number format returned by {@link NumberFormat#getPercentInstance(Locale)}</li>
      *   <li>{@code "computer"}: The number format used by FTL's {@code c} built-in (like in {@code someNumber?c}).</li>
-     *   <li>{@link java.text.DecimalFormat} pattern (like {@code "0.##"}). This syntax has a FreeMarker-specific
-     *       extension, so that you can specify options like the rounding mode and the symbols used in this string. For
+     *   <li>{@link java.text.DecimalFormat} pattern (like {@code "0.##"}). This syntax is extended by FreeMarker
+     *       so that you can specify options like the rounding mode and the symbols used after a 2nd semicolon. For
      *       example, {@code ",000;; roundingMode=halfUp groupingSeparator=_"} will format numbers like {@code ",000"}
      *       would, but with half-up rounding mode, and {@code _} as the group separator. See more about "extended Java
      *       decimal format" in the FreeMarker Manual.
@@ -1050,12 +1051,12 @@ public class Configurable {
     }
 
     /**
-     * Sets the format used to convert {@link java.util.Date}-s to string-s that are time (no date part) values,
-     * also the format that {@code someString?time} will use to parse strings.
-     * 
+     * Sets the format used to convert {@link java.util.Date}-s that are time (no date part) values to string-s, also
+     * the format that {@code someString?time} will use to parse strings.
+     *
      * <p>For the possible values see {@link #setDateTimeFormat(String)}.
-     *   
-     * <p>Defaults to {@code ""}, which means "use the FreeMarker default", which is currently {@code "medium"}.
+     *
+     * <p>Defaults to {@code ""}, which is equivalent to {@code "medium"}.
      */
     public void setTimeFormat(String timeFormat) {
         NullArgumentException.check("timeFormat", timeFormat);
@@ -1080,12 +1081,12 @@ public class Configurable {
     }
     
     /**
-     * Sets the format used to convert {@link java.util.Date}-s to string-s that are date (no time part) values,
+     * Sets the format used to convert {@link java.util.Date}-s that are date-only (no time part) values to string-s,
      * also the format that {@code someString?date} will use to parse strings.
      * 
      * <p>For the possible values see {@link #setDateTimeFormat(String)}.
      *   
-     * <p>Defaults to {@code ""}, which means "use the FreeMarker default", which is currently {@code "medium"}.
+     * <p>Defaults to {@code ""} which is equivalent to {@code "medium"}.
      */
     public void setDateFormat(String dateFormat) {
         NullArgumentException.check("dateFormat", dateFormat);
@@ -1110,7 +1111,7 @@ public class Configurable {
     }
     
     /**
-     * Sets the format used to convert {@link java.util.Date}-s to string-s that are date-time (timestamp) values,
+     * Sets the format used to convert {@link java.util.Date}-s that are date-time (timestamp) values to string-s,
      * also the format that {@code someString?datetime} will use to parse strings.
      * 
      * <p>The possible setting values are (the quotation marks aren't part of the value itself):
@@ -1193,7 +1194,7 @@ public class Configurable {
      *       
      * </ul> 
      * 
-     * <p>Defaults to {@code ""}, which means "use the FreeMarker default", which is currently {@code "medium_medium"}.
+     * <p>Defaults to {@code ""}, which is equivalent to {@code "medium_medium"}.
      */
     public void setDateTimeFormat(String dateTimeFormat) {
         NullArgumentException.check("dateTimeFormat", dateTimeFormat);