freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [1/3] incubator-freemarker git commit: Added public Environment methods for getting TemplateDateFormat objects. Other formatting code clean up and JavaDoc comments.
Date Sun, 06 Sep 2015 22:54:43 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae 0eccad5c1 -> 52dcb9773


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/src/main/java/freemarker/core/ISOTemplateDateFormatFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/ISOTemplateDateFormatFactory.java b/src/main/java/freemarker/core/ISOTemplateDateFormatFactory.java
index 44e5e00..4d82bfd 100644
--- a/src/main/java/freemarker/core/ISOTemplateDateFormatFactory.java
+++ b/src/main/java/freemarker/core/ISOTemplateDateFormatFactory.java
@@ -22,8 +22,6 @@ package freemarker.core;
 import java.util.Locale;
 import java.util.TimeZone;
 
-import freemarker.template.TemplateModelException;
-
 class ISOTemplateDateFormatFactory extends ISOLikeTemplateDateFormatFactory {
     
     static final ISOTemplateDateFormatFactory INSTANCE = new ISOTemplateDateFormatFactory();
@@ -33,9 +31,8 @@ class ISOTemplateDateFormatFactory extends ISOLikeTemplateDateFormatFactory
{
     }
 
     @Override
-    public TemplateDateFormat get(int dateType, boolean zonelessInput, String params, Locale
locale, TimeZone timeZone,
-            Environment env) throws TemplateModelException, UnknownDateTypeFormattingUnsupportedException,
-                    InvalidFormatParametersException {
+    public TemplateDateFormat get(String params, int dateType, Locale locale, TimeZone timeZone,
boolean zonelessInput,
+            Environment env) throws UnknownDateTypeFormattingUnsupportedException, InvalidFormatParametersException
{
         // We don't cache these as creating them is cheap (only 10% speedup of ${d?string.xs}
with caching)
         return new ISOTemplateDateFormat(
                 params, 3,

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/src/main/java/freemarker/core/JavaTemplateDateFormatFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/JavaTemplateDateFormatFactory.java b/src/main/java/freemarker/core/JavaTemplateDateFormatFactory.java
index b60ee2e..286eeff 100644
--- a/src/main/java/freemarker/core/JavaTemplateDateFormatFactory.java
+++ b/src/main/java/freemarker/core/JavaTemplateDateFormatFactory.java
@@ -28,7 +28,6 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import freemarker.log.Logger;
 import freemarker.template.TemplateDateModel;
-import freemarker.template.TemplateModelException;
 
 class JavaTemplateDateFormatFactory extends TemplateDateFormatFactory {
     
@@ -49,9 +48,8 @@ class JavaTemplateDateFormatFactory extends TemplateDateFormatFactory {
      *            Has no effect in this implementation.
      */
     @Override
-    public TemplateDateFormat get(int dateType, boolean zonelessInput, String params, Locale
locale, TimeZone timeZone,
-            Environment env) throws TemplateModelException, UnknownDateTypeFormattingUnsupportedException,
-                    InvalidFormatParametersException {
+    public TemplateDateFormat get(String params, int dateType, Locale locale, TimeZone timeZone,
boolean zonelessInput,
+            Environment env) throws UnknownDateTypeFormattingUnsupportedException, InvalidFormatParametersException
{
         return new JavaTemplateDateFormat(getJavaDateFormat(dateType, params, locale, timeZone));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/src/main/java/freemarker/core/TemplateDateFormatFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/TemplateDateFormatFactory.java b/src/main/java/freemarker/core/TemplateDateFormatFactory.java
index d3af368..e9fb2fe 100644
--- a/src/main/java/freemarker/core/TemplateDateFormatFactory.java
+++ b/src/main/java/freemarker/core/TemplateDateFormatFactory.java
@@ -25,7 +25,6 @@ import java.util.TimeZone;
 
 import freemarker.template.Configuration;
 import freemarker.template.TemplateDateModel;
-import freemarker.template.TemplateModelException;
 
 /**
  * Factory for a certain type of date/time/dateTime formatting ({@link TemplateDateFormat}).
Usually a singleton
@@ -45,10 +44,21 @@ public abstract class TemplateDateFormatFactory {
      * template execution. So caching on the factory level is still useful, unless creating
the formatters is
      * sufficiently cheap.
      * 
+     * @param params
+     *            The string that further describes how the format should look. For example,
when the
+     *            {@link Configurable#getDateFormat() dateFormat} is {@code "@fooBar 1, 2"},
then it will be
+     *            {@code "1, 2"} (and {@code "@fooBar"} selects the factory). The format
of this string is up to the
+     *            {@link TemplateDateFormatFactory} implementation. Not {@code null}, often
an empty string.
      * @param dateType
      *            {@link TemplateDateModel#DATE}, {@link TemplateDateModel#TIME}, {@link
TemplateDateModel#DATETIME} or
      *            {@link TemplateDateModel#UNKNOWN}. Supporting {@link TemplateDateModel#UNKNOWN}
is not necessary, in
      *            which case the method should throw an {@link UnknownDateTypeFormattingUnsupportedException}
exception.
+     * @param locale
+     *            The locale to format for. Not {@code null}. The resulting format should
be bound to this locale
+     *            forever (i.e. locale changes in the {@link Environment} shouldn't be followed).
+     * @param timeZone
+     *            The time zone to format for. Not {@code null}. The resulting format should
be bound to this time zone
+     *            forever (i.e. time zone changes in the {@link Environment} shouldn't be
followed).
      * @param zonelessInput
      *            Indicates that the input Java {@link Date} is not from a time zone aware
source. When this is
      *            {@code true}, the formatters shouldn't override the time zone provided
to its constructor (most
@@ -62,32 +72,20 @@ public abstract class TemplateDateFormatFactory {
      *            {@link java.sql.Time java.sql.Time}, although this rule can change in future,
depending on
      *            configuration settings and such, so you should rely on this rule, just
accept what this parameter
      *            says.
-     * @param params
-     *            The string that further describes how the format should look. For example,
when the
-     *            {@link Configurable#getDateFormat() dateFormat} is {@code "@fooBar 1, 2"},
then it will be
-     *            {@code "1, 2"} (and {@code "@fooBar"} selects the factory). The format
of this string is up to the
-     *            {@link TemplateDateFormatFactory} implementation. Not {@code null}, often
an empty string.
-     * @param locale
-     *            The locale to format for. Not {@code null}. The resulting format should
be bound to this locale
-     *            forever (i.e. locale changes in the {@link Environment} shouldn't be followed).
-     * @param timeZone
-     *            The time zone to format for. Not {@code null}. The resulting format should
be bound to this time zone
-     *            forever (i.e. time zone changes in the {@link Environment} shouldn't be
followed).
      * @param env
      *            The runtime environment from which the formatting was called. This is mostly
meant to be used for
      *            {@link Environment#setCustomState(Object, Object)}/{@link Environment#getCustomState(Object)}.
      * 
      * @throws InvalidFormatParametersException
      *             if the {@code params} is malformed
-     * @throws TemplateModelException
-     *             if the {@code dateType} is unsupported by the formatter
      * @throws UnknownDateTypeFormattingUnsupportedException
      *             if {@code dateType} is {@link TemplateDateModel#UNKNOWN}, and that's unsupported
by the formatter
      *             implementation.
      */
-    public abstract TemplateDateFormat get(int dateType, boolean zonelessInput, String params,
-            Locale locale, TimeZone timeZone, Environment env)
-                    throws TemplateModelException, UnknownDateTypeFormattingUnsupportedException,
-                    InvalidFormatParametersException;
+    public abstract TemplateDateFormat get(
+            String params,
+            int dateType, Locale locale, TimeZone timeZone, boolean zonelessInput,
+            Environment env)
+                    throws UnknownDateTypeFormattingUnsupportedException, InvalidFormatParametersException;
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/src/main/java/freemarker/core/XSTemplateDateFormatFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/XSTemplateDateFormatFactory.java b/src/main/java/freemarker/core/XSTemplateDateFormatFactory.java
index 01026c2..b273a4d 100644
--- a/src/main/java/freemarker/core/XSTemplateDateFormatFactory.java
+++ b/src/main/java/freemarker/core/XSTemplateDateFormatFactory.java
@@ -22,8 +22,6 @@ package freemarker.core;
 import java.util.Locale;
 import java.util.TimeZone;
 
-import freemarker.template.TemplateModelException;
-
 class XSTemplateDateFormatFactory extends ISOLikeTemplateDateFormatFactory {
     
     static final XSTemplateDateFormatFactory INSTANCE = new XSTemplateDateFormatFactory();
@@ -33,9 +31,8 @@ class XSTemplateDateFormatFactory extends ISOLikeTemplateDateFormatFactory
{
     }
 
     @Override
-    public TemplateDateFormat get(int dateType, boolean zonelessInput, String params, Locale
locale, TimeZone timeZone,
-            Environment env) throws TemplateModelException, UnknownDateTypeFormattingUnsupportedException,
-                    InvalidFormatParametersException {
+    public TemplateDateFormat get(String params, int dateType, Locale locale, TimeZone timeZone,
boolean zonelessInput,
+            Environment env) throws UnknownDateTypeFormattingUnsupportedException, InvalidFormatParametersException
{
         // We don't cache these as creating them is cheap (only 10% speedup of ${d?string.xs}
with caching)
         return new XSTemplateDateFormat(
                 params, 2,

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/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 861301e..03429c8 100644
--- a/src/main/java/freemarker/core/_CoreAPI.java
+++ b/src/main/java/freemarker/core/_CoreAPI.java
@@ -27,6 +27,10 @@ import java.util.TreeSet;
 
 import freemarker.template.Template;
 import freemarker.template.TemplateDirectiveBody;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateModel;
+import freemarker.template.TemplateModelException;
+import freemarker.template._TemplateAPI;
 import freemarker.template.utility.ClassUtil;
 
 
@@ -156,4 +160,17 @@ public class _CoreAPI {
         }
     }
     
+    /**
+     * The work around the problematic cases where we should throw a {@link TemplateException},
but we are inside
+     * a {@link TemplateModel} method and so we can only throw {@link TemplateModelException}-s.
 
+     */
+    public static TemplateModelException convertToTemplateModelException(TemplateException
e) {
+        if (e instanceof TemplateModelException) {
+            return (TemplateModelException) e;
+        } else {
+            return new _TemplateModelException(
+                    _TemplateAPI.getBlamedExpression(e), e.getCause(), e.getEnvironment(),
e.getMessage());
+        }
+    }
+    
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/src/main/java/freemarker/template/TemplateException.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/TemplateException.java b/src/main/java/freemarker/template/TemplateException.java
index 3b391b7..7845bf8 100644
--- a/src/main/java/freemarker/template/TemplateException.java
+++ b/src/main/java/freemarker/template/TemplateException.java
@@ -569,6 +569,10 @@ public class TemplateException extends Exception {
             return blamedExpressionString;
         }
     }
+    
+    Expression getBlamedExpression() {
+        return blamedExpression;
+    }
 
     private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException
{
         // These are calculated from transient fields, so this is the last chance to calculate
them: 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/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 43f2011..765383e 100644
--- a/src/main/java/freemarker/template/_TemplateAPI.java
+++ b/src/main/java/freemarker/template/_TemplateAPI.java
@@ -25,6 +25,7 @@ import freemarker.cache.CacheStorage;
 import freemarker.cache.TemplateLoader;
 import freemarker.cache.TemplateLookupStrategy;
 import freemarker.cache.TemplateNameFormat;
+import freemarker.core.Expression;
 import freemarker.core.OutputFormat;
 import freemarker.core.TemplateObject;
 import freemarker.template.utility.NullArgumentException;
@@ -143,4 +144,8 @@ public class _TemplateAPI {
         }
     }
     
+    public static Expression getBlamedExpression(TemplateException e) {
+        return e.getBlamedExpression();
+    }
+    
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/src/manual/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/book.xml b/src/manual/book.xml
index a576c30..cf7416d 100644
--- a/src/manual/book.xml
+++ b/src/manual/book.xml
@@ -25378,9 +25378,11 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
       <title>Version history</title>
 
       <section xml:id="versions_2_3_24">
-        <title>2.3.24 Preview 1</title>
+        <title>2.3.24 Release Candidate 1</title>
 
-        <para>Date of release: 2015-09-01 for preview release 1</para>
+        <para>Date of release for Release Candidate 1: [FIXME]</para>
+
+        <para>Date of release for Preview 1: 2015-09-01</para>
 
         <para>Date of release for final is not yet known (end of
         October?).</para>
@@ -25667,12 +25669,13 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
                 <listitem>
                   <para>Added new <literal>Environment</literal> methods
                   returning <literal>TemplateNumberFormat</literal> and
-                  <literal>TemplateDateFormat</literal> objects:
-                  <literal>getTemplateNumberFormat()</literal>,
-                  <literal>getTemplateNumberFormat(String
-                  formatString)</literal>,
-                  <literal>getTemplateNumberFormat(String formatString, Locale
-                  locale)</literal>.</para>
+                  <literal>TemplateDateFormat</literal> objects. See
+                  <literal>getTemplateNumberFormat(<replaceable>...</replaceable>)</literal>
+                  and
+                  <literal>getTemplateDateFormat(<replaceable>...</replaceable>)</literal>
+                  variations. (Only since RC1: public
+                  <literal>TemplateDateFormat</literal> returning
+                  methods)</para>
                 </listitem>
 
                 <listitem>

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/src/test/java/freemarker/core/DateFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/DateFormatTest.java b/src/test/java/freemarker/core/DateFormatTest.java
index 13b3e96..4b6d996 100644
--- a/src/test/java/freemarker/core/DateFormatTest.java
+++ b/src/test/java/freemarker/core/DateFormatTest.java
@@ -21,6 +21,8 @@ package freemarker.core;
 import static org.hamcrest.Matchers.*;
 import static org.junit.Assert.*;
 
+import java.sql.Time;
+import java.sql.Timestamp;
 import java.util.Date;
 import java.util.Locale;
 import java.util.TimeZone;
@@ -32,6 +34,7 @@ import com.google.common.collect.ImmutableMap;
 
 import freemarker.template.Configuration;
 import freemarker.template.SimpleDate;
+import freemarker.template.Template;
 import freemarker.template.TemplateDateModel;
 import freemarker.template.TemplateModelException;
 import freemarker.test.TemplateTest;
@@ -39,12 +42,17 @@ import freemarker.test.TemplateTest;
 @SuppressWarnings("boxing")
 public class DateFormatTest extends TemplateTest {
     
+    /** 2015-09-06T12:00:00Z */
+    private static long T = 1441540800000L;
+    private static TemplateDateModel TM = new SimpleDate(new Date(T), TemplateDateModel.DATETIME);
+    
     @Before
     public void setup() {
         Configuration cfg = getConfiguration();
         cfg.setIncompatibleImprovements(Configuration.VERSION_2_3_24);
         cfg.setLocale(Locale.US);
         cfg.setTimeZone(TimeZone.getTimeZone("GMT+01:00"));
+        cfg.setSQLDateAndTimeTimeZone(TimeZone.getTimeZone("UTC"));
         
         cfg.setCustomDateFormats(ImmutableMap.of(
                 "epoch", EpochMillisTemplateDateFormatFactory.INSTANCE,
@@ -196,6 +204,106 @@ public class DateFormatTest extends TemplateTest {
         assertErrorContains("${d}", "\"@epoch\"");
     }
     
+    @Test
+    public void testEnvironmentGetters() throws Exception {
+        Template t = new Template(null, "", getConfiguration());
+        Environment env = t.createProcessingEnvironment(null, null);
+        
+        Configuration cfg = getConfiguration();
+        
+        String dateFormatStr = "yyyy.MM.dd. (Z)";
+        String timeFormatStr = "HH:mm";
+        String dateTimeFormatStr = "yyyy.MM.dd. HH:mm";
+        cfg.setDateFormat(dateFormatStr);
+        cfg.setTimeFormat(timeFormatStr);
+        cfg.setDateTimeFormat(dateTimeFormatStr);
+        
+        // Test that values are coming from the cache if possible 
+        for (Class dateClass : new Class[] { Date.class, Timestamp.class, java.sql.Date.class,
Time.class } ) {
+            for (int dateType
+                    : new int[] { TemplateDateModel.DATE, TemplateDateModel.TIME, TemplateDateModel.DATETIME
}) {
+                String formatString =
+                        dateType == TemplateDateModel.DATE ? cfg.getDateFormat() :
+                        (dateType == TemplateDateModel.TIME ? cfg.getTimeFormat()
+                        : cfg.getDateTimeFormat());
+                TemplateDateFormat expectedF = env.getTemplateDateFormat(formatString, dateType,
dateClass);
+                assertSame(expectedF, env.getTemplateDateFormat(dateType, dateClass)); //
Note: Only reads the cache
+                assertSame(expectedF, env.getTemplateDateFormat(formatString, dateType, dateClass));
+                assertSame(expectedF, env.getTemplateDateFormat(formatString, dateType, dateClass,
cfg.getLocale()));
+                assertSame(expectedF, env.getTemplateDateFormat(formatString, dateType, dateClass,
cfg.getLocale(),
+                        cfg.getTimeZone(), cfg.getSQLDateAndTimeTimeZone()));
+            }
+        }
+
+        String dateFormatStr2 = dateFormatStr + "'!'";
+        String timeFormatStr2 = timeFormatStr + "'!'";
+        String dateTimeFormatStr2 = dateTimeFormatStr + "'!'";
+        
+        assertEquals("2015.09.06. 13:00",
+                env.getTemplateDateFormat(TemplateDateModel.DATETIME, Date.class).format(TM));
+        assertEquals("2015.09.06. 13:00!",
+                env.getTemplateDateFormat(dateTimeFormatStr2, TemplateDateModel.DATETIME,
Date.class).format(TM));
+        
+        assertEquals("2015.09.06. (+0100)",
+                env.getTemplateDateFormat(TemplateDateModel.DATE, Date.class).format(TM));
+        assertEquals("2015.09.06. (+0100)!",
+                env.getTemplateDateFormat(dateFormatStr2, TemplateDateModel.DATE, Date.class).format(TM));
+        
+        assertEquals("13:00",
+                env.getTemplateDateFormat(TemplateDateModel.TIME, Date.class).format(TM));
+        assertEquals("13:00!",
+                env.getTemplateDateFormat(timeFormatStr2, TemplateDateModel.TIME, Date.class).format(TM));
+        
+        assertEquals("2015.09.06. 13:00",
+                env.getTemplateDateFormat(TemplateDateModel.DATETIME, Timestamp.class).format(TM));
+        assertEquals("2015.09.06. 13:00!",
+                env.getTemplateDateFormat(dateTimeFormatStr2, TemplateDateModel.DATETIME,
Timestamp.class).format(TM));
+
+        assertEquals("2015.09.06. (+0000)",
+                env.getTemplateDateFormat(TemplateDateModel.DATE, java.sql.Date.class).format(TM));
+        assertEquals("2015.09.06. (+0000)!",
+                env.getTemplateDateFormat(dateFormatStr2, TemplateDateModel.DATE, java.sql.Date.class).format(TM));
+
+        assertEquals("12:00",
+                env.getTemplateDateFormat(TemplateDateModel.TIME, Time.class).format(TM));
+        assertEquals("12:00!",
+                env.getTemplateDateFormat(timeFormatStr2, TemplateDateModel.TIME, Time.class).format(TM));
+
+        {
+            String dateTimeFormatStrLoc = dateTimeFormatStr + " EEEE";
+            // Gets into cache:
+            TemplateDateFormat format1
+                    = env.getTemplateDateFormat(dateTimeFormatStrLoc, TemplateDateModel.DATETIME,
Date.class);
+            assertEquals("2015.09.06. 13:00 Sunday", format1.format(TM));
+            // Different locale (not cached):
+            assertEquals("2015.09.06. 13:00 Sonntag",
+                    env.getTemplateDateFormat(dateTimeFormatStrLoc, TemplateDateModel.DATETIME,
Date.class,
+                            Locale.GERMANY).format(TM));
+            // Different locale and zone (not cached):
+            assertEquals("2015.09.06. 14:00 Sonntag",
+                    env.getTemplateDateFormat(dateTimeFormatStrLoc, TemplateDateModel.DATETIME,
Date.class,
+                            Locale.GERMANY, TimeZone.getTimeZone("GMT+02"), TimeZone.getTimeZone("GMT+03")).format(TM));
+            // Different locale and zone (not cached):
+            assertEquals("2015.09.06. 15:00 Sonntag",
+                    env.getTemplateDateFormat(dateTimeFormatStrLoc, TemplateDateModel.DATETIME,
java.sql.Date.class,
+                            Locale.GERMANY, TimeZone.getTimeZone("GMT+02"), TimeZone.getTimeZone("GMT+03")).format(TM));
+            // Check for corrupted cache:
+            TemplateDateFormat format2
+                    = env.getTemplateDateFormat(dateTimeFormatStrLoc, TemplateDateModel.DATETIME,
Date.class);
+            assertEquals("2015.09.06. 13:00 Sunday", format2.format(TM));
+            assertSame(format1, format2);
+        }
+        
+        addToDataModel("d", TM);
+        assertErrorContains("${d?string('[wrong]')}", "format string", "[wrong]");
+        cfg.setDateFormat("[wrong d]");
+        cfg.setDateTimeFormat("[wrong dt]");
+        cfg.setTimeFormat("[wrong t]");
+        assertErrorContains("${d?date}", "\"date_format\"", "[wrong d]");
+        assertErrorContains("${d?datetime}", "\"datetime_format\"", "[wrong dt]");
+        assertErrorContains("${d?time}", "\"time_format\"", "[wrong t]");
+    }
+    
     private static class MutableTemplateDateModel implements TemplateDateModel {
         
         private Date date;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/src/test/java/freemarker/core/EpochMillisDivTemplateDateFormatFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/EpochMillisDivTemplateDateFormatFactory.java b/src/test/java/freemarker/core/EpochMillisDivTemplateDateFormatFactory.java
index 8dd3ce3..0181452 100644
--- a/src/test/java/freemarker/core/EpochMillisDivTemplateDateFormatFactory.java
+++ b/src/test/java/freemarker/core/EpochMillisDivTemplateDateFormatFactory.java
@@ -38,9 +38,8 @@ public class EpochMillisDivTemplateDateFormatFactory extends TemplateDateFormatF
     }
     
     @Override
-    public TemplateDateFormat get(int dateType, boolean zonelessInput, String params, Locale
locale, TimeZone timeZone,
-            Environment env) throws TemplateModelException, UnknownDateTypeFormattingUnsupportedException,
-                    InvalidFormatParametersException {
+    public TemplateDateFormat get(String params, int dateType, Locale locale, TimeZone timeZone,
boolean zonelessInput,
+            Environment env) throws UnknownDateTypeFormattingUnsupportedException, InvalidFormatParametersException
{
         int divisor;
         try {
             divisor = Integer.parseInt(params);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/src/test/java/freemarker/core/EpochMillisTemplateDateFormatFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/EpochMillisTemplateDateFormatFactory.java b/src/test/java/freemarker/core/EpochMillisTemplateDateFormatFactory.java
index 547a926..d2e8a0a 100644
--- a/src/test/java/freemarker/core/EpochMillisTemplateDateFormatFactory.java
+++ b/src/test/java/freemarker/core/EpochMillisTemplateDateFormatFactory.java
@@ -37,9 +37,8 @@ public class EpochMillisTemplateDateFormatFactory extends TemplateDateFormatFact
     }
     
     @Override
-    public TemplateDateFormat get(int dateType, boolean zonelessInput, String params, Locale
locale, TimeZone timeZone,
-            Environment env) throws TemplateModelException, UnknownDateTypeFormattingUnsupportedException,
-                    InvalidFormatParametersException {
+    public TemplateDateFormat get(String params, int dateType, Locale locale, TimeZone timeZone,
boolean zonelessInput,
+            Environment env) throws UnknownDateTypeFormattingUnsupportedException, InvalidFormatParametersException
{
         TemplateFormatUtil.checkHasNoParameters(params);
         return EpochMillisTemplateDateFormat.INSTANCE;
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/src/test/java/freemarker/core/LocAndTZSensitiveTemplateDateFormatFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/LocAndTZSensitiveTemplateDateFormatFactory.java
b/src/test/java/freemarker/core/LocAndTZSensitiveTemplateDateFormatFactory.java
index 6c9da59..a5e4d89 100644
--- a/src/test/java/freemarker/core/LocAndTZSensitiveTemplateDateFormatFactory.java
+++ b/src/test/java/freemarker/core/LocAndTZSensitiveTemplateDateFormatFactory.java
@@ -37,9 +37,8 @@ public class LocAndTZSensitiveTemplateDateFormatFactory extends TemplateDateForm
     }
     
     @Override
-    public TemplateDateFormat get(int dateType, boolean zonelessInput, String params, Locale
locale, TimeZone timeZone,
-            Environment env) throws TemplateModelException, UnknownDateTypeFormattingUnsupportedException,
-                    InvalidFormatParametersException {
+    public TemplateDateFormat get(String params, int dateType, Locale locale, TimeZone timeZone,
boolean zonelessInput,
+            Environment env) throws UnknownDateTypeFormattingUnsupportedException, InvalidFormatParametersException
{
         TemplateFormatUtil.checkHasNoParameters(params);
         return new LocAndTZSensitiveTemplateDateFormat(locale, timeZone);
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52dcb977/src/test/java/freemarker/core/NumberFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/NumberFormatTest.java b/src/test/java/freemarker/core/NumberFormatTest.java
index 1fa50b9..22fe5c2 100644
--- a/src/test/java/freemarker/core/NumberFormatTest.java
+++ b/src/test/java/freemarker/core/NumberFormatTest.java
@@ -138,7 +138,7 @@ public class NumberFormatTest extends TemplateTest {
     }
 
     @Test
-    public void testExplicitLocale() throws Exception {
+    public void testEnvironmentGetters() throws Exception {
         Template t = new Template(null, "", getConfiguration());
         Environment env = t.createProcessingEnvironment(null, null);
         


Mime
View raw message