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 2019/01/17 10:00:44 UTC

[freemarker] branch 3 updated (69c2f71 -> 86ca4d3)

This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a change to branch 3
in repository https://gitbox.apache.org/repos/asf/freemarker.git.


    from 69c2f71  Forward ported from 2.3-gae: Added ?truncate built-in and related setting
     new cb7328d  Updated IntelliJ setup instructions. Some other README adjustments.
     new c74794d  _NullArgumentException.check now returns its parameter
     new fd4507b  (JavaDoc content fix)
     new 86ca4d3  To investigate odd cinit NPE occurring on Travis

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 README.md                                          | 28 ++++++++++++----------
 .../org/apache/freemarker/core/Configuration.java  |  8 ++++++-
 .../freemarker/core/DefaultTemplateLanguage.java   |  4 ++--
 .../core/UnsupportedFM2TemplateLanguage.java       |  8 ++++++-
 .../core/util/_NullArgumentException.java          |  6 +++--
 5 files changed, 35 insertions(+), 19 deletions(-)


[freemarker] 01/04: Updated IntelliJ setup instructions. Some other README adjustments.

Posted by dd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch 3
in repository https://gitbox.apache.org/repos/asf/freemarker.git

commit cb7328d2b6535bd6f833661f966ec75bdc2ca173
Author: ddekany <dd...@apache.org>
AuthorDate: Thu Jan 17 10:56:31 2019 +0100

    Updated IntelliJ setup instructions. Some other README adjustments.
---
 README.md | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md
index 5154293..1433aa1 100644
--- a/README.md
+++ b/README.md
@@ -98,7 +98,7 @@ Building FreeMarker
 
 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
+https://freemarker.apache.org/sourcecode.html
 
 You need JDK 8 to be installed.
 
@@ -115,11 +115,11 @@ etc.). You can also install the jar-s into your local Maven repository with
 
 Note for Windows users: If you are using an Apache source release (as opposed
 to checking the project out from the Git repository), ./gradlew will fail as
-`gradle\wrapper\gradle-wrapper.jar` is missing. Due to Apache policy restricton
-we can't include that file in distributions, so you have to download that very
-common artifact from somewhere manually (like from Git repository of
-FreeMarker). (On UN*X-like systems you don't need that jar, as our custom
-`gradlew` shell script does everything itself.)
+`gradle\wrapper\gradle-wrapper.jar` is missing. Due to Apache policy we can't
+include that file in distributions, so you have to download that very common
+artifact from somewhere manually (like from the Git repository of FreeMarker).
+(On UN*X-like systems you don't need that jar, as our custom `gradlew` shell
+script does everything itself.)
 
 To test your build, issue `./gradlew test`. Issued from the top directory,
 this will run the tests of all modules.
@@ -210,19 +210,21 @@ Last tested Eclipse Oxygen (4.7.0)
 Last tested on IntelliJ IDEA Community 2017.1.5.
     
 - First, build the project with Gradle if you haven't yet (see earlier how).
-- "New..." -> "Project from existing source"
+- "New..." -> "Project from existing source" (or if you start on the Welcome screen: "Import project")
   - Point to the project root directory
   - On the next screen, select "Import project from external model" and "Gradle"
-  - On the next screen, select "Use gradle wrapper task configuration" [TODO: or keep default?].
-    Be sure at least Java 8 is selected for Gradle. Other defaults should be fine.
-  - On the next window, all modules will be selected, that's fine, go on
-  - On the next window, it will prompt to remove the `freemarker` from the project.
+  - On the next screen, ensure that at least Java 8 is selected for Gradle. Other defaults
+    ("Use default gradle wrapper", etc.) should be fine.
+  - On the next window (if there's one), all modules will be selected, that's fine, go on
+  - On the next window (if there's one), it will prompt to remove `freemarker` from the project.
     Let it do it (as it's an incorrect duplication of the `freemarker` root project).
   - At the end of this process you should have all modules in the Project tree view.
 - "File" -> "Project Structure..."
   Under "Project", set the SDK to 1.7, and the language level to 7.
-  Under "Modules", for "freemarker-core-test-java8" / "freemarker-core-test-java8_main" and
-  "freemarker-core-test-java8_test", change the "Module SDK" to 1.8 (on the "Dependencies" tab).
+  Under "Modules", expand the "freemarker" module in the tree view, and select
+  "freemarker-core-test-java8", and change the "Module SDK" to 1.8 (on the "Dependencies" tab).
+  Do the same with the "main" and "test" submodules under that (they are maybe shown as
+  "freemarker-core-test-java8_main" and "freemarker-core-test-java8_test" instead). 
 - "File" -> "Settings"
   - Under "Editor" / "Code style", import and use
     freemarker/src/ide-settings/IntelliJ-IDEA/Java-code-style-FreeMarker.xml


[freemarker] 02/04: _NullArgumentException.check now returns its parameter

Posted by dd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch 3
in repository https://gitbox.apache.org/repos/asf/freemarker.git

commit c74794d34d56c775caad9e38f58216f01faa63af
Author: ddekany <dd...@apache.org>
AuthorDate: Thu Jan 17 10:57:31 2019 +0100

    _NullArgumentException.check now returns its parameter
---
 .../org/apache/freemarker/core/util/_NullArgumentException.java     | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_NullArgumentException.java b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_NullArgumentException.java
index d9cdad9..5ee2eba 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_NullArgumentException.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_NullArgumentException.java
@@ -40,19 +40,21 @@ public class _NullArgumentException extends IllegalArgumentException {
     /**
      * Convenience method to protect against a {@code null} argument.
      */
-    public static void check(String argumentName, Object argumentValue) {
+    public static <T> T check(String argumentName, T argumentValue) {
         if (argumentValue == null) {
             throw new _NullArgumentException(argumentName);
         }
+        return argumentValue;
     }
 
     /**
      * Convenience method to protect against a {@code null} argument.
      */
-    public static void check(Object argumentValue) {
+    public static <T> T check(T argumentValue) {
         if (argumentValue == null) {
             throw new _NullArgumentException();
         }
+        return argumentValue;
     }
     
 }


[freemarker] 04/04: To investigate odd cinit NPE occurring on Travis

Posted by dd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch 3
in repository https://gitbox.apache.org/repos/asf/freemarker.git

commit 86ca4d31eeb5d8f9c210d1d4c9b0377e37d0e87b
Author: ddekany <dd...@apache.org>
AuthorDate: Thu Jan 17 10:58:45 2019 +0100

    To investigate odd cinit NPE occurring on Travis
---
 .../src/main/java/org/apache/freemarker/core/Configuration.java   | 8 +++++++-
 .../apache/freemarker/core/UnsupportedFM2TemplateLanguage.java    | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java
index 03a8a55..5f57c26 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java
@@ -792,9 +792,15 @@ public final class Configuration implements TopLevelConfiguration, CustomStateSc
         PREDEFINED_TEMPLATE_LANGUAGES_BY_EXTENSION = new HashMap<String, TemplateLanguage>(32);
         
         for (TemplateLanguage tl : DefaultTemplateLanguage.STANDARD_INSTANCES) {
-            PREDEFINED_TEMPLATE_LANGUAGES_BY_EXTENSION.put(tl.getFileExtension(), tl);            
+            if (tl == null) {
+                throw new AssertionError("tl was null");
+            }
+            PREDEFINED_TEMPLATE_LANGUAGES_BY_EXTENSION.put(tl.getFileExtension(), tl);
         }
         for (TemplateLanguage tl : UnsupportedFM2TemplateLanguage.INSTANCES) {
+            if (tl == null) {
+                throw new AssertionError("tl was null");
+            }
             PREDEFINED_TEMPLATE_LANGUAGES_BY_EXTENSION.put(tl.getFileExtension(), tl);            
         }
         PREDEFINED_TEMPLATE_LANGUAGES_BY_EXTENSION.put(
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/UnsupportedFM2TemplateLanguage.java b/freemarker-core/src/main/java/org/apache/freemarker/core/UnsupportedFM2TemplateLanguage.java
index e67091d..073d4e6 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/UnsupportedFM2TemplateLanguage.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/UnsupportedFM2TemplateLanguage.java
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import java.io.Reader;
 
 import org.apache.freemarker.core.outputformat.OutputFormat;
+import org.apache.freemarker.core.util._NullArgumentException;
 
 /**
  * FreeMarker 2 template language, which we don't support. To avoid confusion we ban loading such templates. 
@@ -37,7 +38,12 @@ class UnsupportedFM2TemplateLanguage extends TemplateLanguage {
     private static final UnsupportedFM2TemplateLanguage FTLX = new UnsupportedFM2TemplateLanguage(
             "ftlx", null, AutoEscapingPolicy.ENABLE_IF_DEFAULT);
     
-    static final UnsupportedFM2TemplateLanguage[] INSTANCES = new UnsupportedFM2TemplateLanguage[] { FTL, FTLH, FTLX };
+    static final UnsupportedFM2TemplateLanguage[] INSTANCES =
+            new UnsupportedFM2TemplateLanguage[] {
+                    _NullArgumentException.check(FTL),
+                    _NullArgumentException.check(FTLH),
+                    _NullArgumentException.check(FTLX)
+    };
     
     private UnsupportedFM2TemplateLanguage(String fileExtension, OutputFormat outputFormat,
             AutoEscapingPolicy autoEscapingPolicy) {


[freemarker] 03/04: (JavaDoc content fix)

Posted by dd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch 3
in repository https://gitbox.apache.org/repos/asf/freemarker.git

commit fd4507b2cf23f47672f2fabbf3ddc6e562586931
Author: ddekany <dd...@apache.org>
AuthorDate: Thu Jan 17 10:57:52 2019 +0100

    (JavaDoc content fix)
---
 .../main/java/org/apache/freemarker/core/DefaultTemplateLanguage.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/DefaultTemplateLanguage.java b/freemarker-core/src/main/java/org/apache/freemarker/core/DefaultTemplateLanguage.java
index df61532..a8f5427 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/DefaultTemplateLanguage.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/DefaultTemplateLanguage.java
@@ -37,8 +37,8 @@ public final class DefaultTemplateLanguage extends TemplateLanguage {
     private final InterpolationSyntax interpolationSyntax;
     
     /**
-     * For the case when the file extension doesn't specify the exact syntax and the output format, instead both comes
-     * from the {@link Configuration} (or {@link TemplateConfiguration}). Avoid it, as it's problematic for tooling.
+     * For the case when the file extension doesn't specify the output format, instead it comes from the
+     * {@link Configuration} (or {@link TemplateConfiguration}). Avoid it, as it's problematic for tooling.
      */
     public static final DefaultTemplateLanguage F3AC = new DefaultTemplateLanguage("f3ac", true,
             DefaultDialect.INSTANCE,