freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject incubator-freemarker git commit: Forward ported from 2.3-gae: Java 9 compatibility adjustments
Date Wed, 04 Oct 2017 21:57:38 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/3 ef4674e84 -> 121b11b51


Forward ported from 2.3-gae: Java 9 compatibility adjustments


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

Branch: refs/heads/3
Commit: 121b11b51e9e992cb294300e54a83b5cfd0eb345
Parents: ef4674e
Author: ddekany <ddekany@apache.org>
Authored: Wed Oct 4 23:57:28 2017 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Wed Oct 4 23:57:28 2017 +0200

----------------------------------------------------------------------
 .../apache/freemarker/core/SQLTimeZoneTest.java |  8 +--
 .../templatesuite/templates/dateformat-java.ftl | 56 +++++++++++---------
 .../org/apache/freemarker/dom/NodeModel.java    | 23 ++++++--
 freemarker-servlet/build.gradle                 |  2 +
 4 files changed, 55 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/121b11b5/freemarker-core-test/src/test/java/org/apache/freemarker/core/SQLTimeZoneTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/SQLTimeZoneTest.java
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/SQLTimeZoneTest.java
index 869167b..b91a020 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/SQLTimeZoneTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/SQLTimeZoneTest.java
@@ -214,10 +214,10 @@ public class SQLTimeZoneTest extends TemplateTest {
         setConfiguration(testCacheFlushing_createBuilder().build());
         assertOutput(
                 "${sqlDate}, ${sqlTime}, ${sqlTimestamp}, ${javaDate?dateTime}, ${javaDate?date},
${javaDate?time}\n"
-                + "<#setting locale='de'>\n"
+                + "<#setting locale='hu'>\n"
                 + "${sqlDate}, ${sqlTime}, ${sqlTimestamp}, ${javaDate?dateTime}, ${javaDate?date},
${javaDate?time}\n",
                 "2014-07-11 Fri, 10:30:05 Thu, 2014-07-12T10:30:05 Sat, 2014-07-12T10:30:05
Sat, 2014-07-12 Sat, 10:30:05 Sat\n"
-                + "2014-07-11 Fr, 10:30:05 Do, 2014-07-12T10:30:05 Sa, 2014-07-12T10:30:05
Sa, 2014-07-12 Sa, 10:30:05 Sa\n");
+                + "2014-07-11 P, 10:30:05 Cs, 2014-07-12T10:30:05 Szo, 2014-07-12T10:30:05
Szo, 2014-07-12 Szo, 10:30:05 Szo\n");
         assertOutput(
                 "${sqlDate}, ${sqlTime}, ${sqlTimestamp}, ${javaDate?dateTime}, ${javaDate?date},
${javaDate?time}\n"
                 + "<#setting dateFormat='yyyy-MM-dd'>\n"
@@ -240,10 +240,10 @@ public class SQLTimeZoneTest extends TemplateTest {
         setConfiguration(testCacheFlushing_createBuilder().sqlDateAndTimeTimeZone(GMT_P02).build());
         assertOutput(
                 "${sqlDate}, ${sqlTime}, ${sqlTimestamp}, ${javaDate?dateTime}, ${javaDate?date},
${javaDate?time}\n"
-                + "<#setting locale='de'>\n"
+                + "<#setting locale='hu'>\n"
                 + "${sqlDate}, ${sqlTime}, ${sqlTimestamp}, ${javaDate?dateTime}, ${javaDate?date},
${javaDate?time}\n",
                 "2014-07-12 Sat, 12:30:05 Thu, 2014-07-12T10:30:05 Sat, 2014-07-12T10:30:05
Sat, 2014-07-12 Sat, 10:30:05 Sat\n"
-                + "2014-07-12 Sa, 12:30:05 Do, 2014-07-12T10:30:05 Sa, 2014-07-12T10:30:05
Sa, 2014-07-12 Sa, 10:30:05 Sa\n");
+                + "2014-07-12 Szo, 12:30:05 Cs, 2014-07-12T10:30:05 Szo, 2014-07-12T10:30:05
Szo, 2014-07-12 Szo, 10:30:05 Szo\n");
         assertOutput(
                 "${sqlDate}, ${sqlTime}, ${sqlTimestamp}, ${javaDate?dateTime}, ${javaDate?date},
${javaDate?time}\n"
                 + "<#setting dateFormat='yyyy-MM-dd'>\n"

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/121b11b5/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-java.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-java.ftl
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-java.ftl
index 955be00..ead21ff 100644
--- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-java.ftl
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-java.ftl
@@ -16,35 +16,39 @@
   specific language governing permissions and limitations
   under the License.
 -->
+<#-- Removes US format differences introduced in Java 9: -->
+<#function n(s)>
+  <#return s?replace('2002,', '2002')?replace('/02,', '/02')?replace(' at', '')>
+</#function>
 <#setting locale="en_US">
 <#setting timeZone="GMT">
 <#setting dateTimeFormat="">
-${date}
-${unknownDate?dateTime}
-${date?string}
-${date?string[""]}
-${date?string.short}
-${date?string.medium}
-${date?string.long}
-${date?string.short_short}
-${date?string.short_medium}
-${date?string.short_long}
-${date?string.medium_short}
-${date?string.medium_medium}
-${date?string.medium_long}
-${date?string.long_short}
-${date?string.long_medium}
-${date?string.long_long}
-${unknownDate?date}
-${date?date?string[""]}
-${date?date?string.short}
-${date?date?string.medium}
-${date?date?string.long}
-${unknownDate?time}
-${date?time?string[""]}
-${date?time?string.short}
-${date?time?string.medium}
-${date?time?string.long}
+${n(date)}
+${n(unknownDate?dateTime)}
+${n(date?string)}
+${n(date?string[""])}
+${n(date?string.short)}
+${n(date?string.medium)}
+${n(date?string.long)}
+${n(date?string.short_short)}
+${n(date?string.short_medium)}
+${n(date?string.short_long)}
+${n(date?string.medium_short)}
+${n(date?string.medium_medium)}
+${n(date?string.medium_long)}
+${n(date?string.long_short)}
+${n(date?string.long_medium)}
+${n(date?string.long_long)}
+${n(unknownDate?date)}
+${n(date?date?string[""])}
+${n(date?date?string.short)}
+${n(date?date?string.medium)}
+${n(date?date?string.long)}
+${n(unknownDate?time)}
+${n(date?time?string[""])}
+${n(date?time?string.short)}
+${n(date?time?string.medium)}
+${n(date?time?string.long)}
 <#setting locale="hu_hu">
 <#setting dateTimeFormat="long_long">
 ${date}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/121b11b5/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeModel.java
----------------------------------------------------------------------
diff --git a/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeModel.java b/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeModel.java
index 030005c..ac4494a 100644
--- a/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeModel.java
+++ b/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeModel.java
@@ -458,20 +458,35 @@ abstract public class NodeModel implements TemplateNodeModelEx, TemplateHashMode
         synchronized (STATIC_LOCK) {
             xpathSupportClass = null;
             jaxenXPathSupport = null;
+            
             try {
                 useXalanXPathSupport();
+            } catch (ClassNotFoundException e) {
+                // Expected
             } catch (Exception e) {
-                // ignore
+                LOG.debug("Failed to use Xalan XPath support.", e);
+            } catch (IllegalAccessError e) {
+                LOG.debug("Failed to use Xalan internal XPath support.", e);
             }
+            
             if (xpathSupportClass == null) try {
-            	useSunInternalXPathSupport();
+                useSunInternalXPathSupport();
             } catch (Exception e) {
-                // ignore
+                LOG.debug("Failed to use Sun internal XPath support.", e);
+            } catch (IllegalAccessError e) {
+                // Happens on OpenJDK 9 (but not on Oracle Java 9)
+                LOG.debug("Failed to use Sun internal XPath support. "
+                        + "Tip: On Java 9+, you may need Xalan or Jaxen+Saxpath.", e);
             }
+            
             if (xpathSupportClass == null) try {
                 useJaxenXPathSupport();
+            } catch (ClassNotFoundException e) {
+                // Expected
             } catch (Exception e) {
-                // ignore
+                LOG.debug("Failed to use Jaxen XPath support.", e);
+            } catch (IllegalAccessError e) {
+                LOG.debug("Failed to use Jaxen XPath support.", e);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/121b11b5/freemarker-servlet/build.gradle
----------------------------------------------------------------------
diff --git a/freemarker-servlet/build.gradle b/freemarker-servlet/build.gradle
index 2d0aa3b..04ae805 100644
--- a/freemarker-servlet/build.gradle
+++ b/freemarker-servlet/build.gradle
@@ -55,6 +55,8 @@ dependencies {
         exclude group: "org.slf4j", module: "jcl104-over-slf4j"
         exclude group: "log4j", module: "log4j"
     }
+    // Override Java 9 incompatible version (coming from displaytag):
+    testCompile("commons-lang:commons-lang:2.6")
 
     def springVersion = "2.5.6.SEC03"
     testCompile("org.springframework:spring-core:$springVersion") {


Mime
View raw message