freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [1/2] incubator-freemarker git commit: Removed some deprecated methods...
Date Mon, 20 Feb 2017 23:11:02 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/3 ddc907ddf -> 4bffe5284


Removed some deprecated methods...


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

Branch: refs/heads/3
Commit: 45ebfe3d736a01e0aa9f9eb434c5491c1853cd1a
Parents: ddc907d
Author: ddekany <ddekany@apache.org>
Authored: Mon Feb 20 22:55:03 2017 +0100
Committer: ddekany <ddekany@apache.org>
Committed: Mon Feb 20 22:59:41 2017 +0100

----------------------------------------------------------------------
 .../apache/freemarker/core/Configuration.java   | 29 +-------------------
 .../freemarker/core/ast/BuiltinVariable.java    |  2 +-
 .../core/templateresolver/TemplateResolver.java |  2 +-
 .../impl/URLTemplateLoader.java                 |  2 +-
 .../freemarker/servlet/FreemarkerServlet.java   |  3 +-
 .../freemarker/core/ConfigurationTest.java      |  7 +----
 .../DefaultTemplateResolverTest.java            |  4 +--
 7 files changed, 9 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/45ebfe3d/src/main/java/org/apache/freemarker/core/Configuration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/Configuration.java b/src/main/java/org/apache/freemarker/core/Configuration.java
index 2d15987..679d074 100644
--- a/src/main/java/org/apache/freemarker/core/Configuration.java
+++ b/src/main/java/org/apache/freemarker/core/Configuration.java
@@ -1066,23 +1066,6 @@ public class Configuration extends Configurable implements Cloneable,
ParserConf
     }
 
     /**
-     * Sets the time in seconds that must elapse before checking whether there is a newer
version of a template "file"
-     * than the cached one.
-     * 
-     * <p>
-     * Historical note: Despite what the API documentation said earlier, this method is <em>not</em>
thread-safe. While
-     * it works well on most hardware, it's not guaranteed that FreeMarker will see the update
in all threads, and
-     * theoretically it's also possible that it will see a value that's a binary mixture
of the new and the old one.
-     * 
-     * @deprecated Use {@link #setTemplateUpdateDelayMilliseconds(long)} instead, because
the time granularity of this method
-     *             is often misunderstood to be milliseconds.
-     */
-    @Deprecated
-    public void setTemplateUpdateDelay(int seconds) {
-        templateResolver.setTemplateUpdateDelayMilliseconds(1000L * seconds);
-    }
-
-    /**
      * 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.
      * 
@@ -2296,7 +2279,7 @@ public class Configuration extends Configurable implements Cloneable,
ParserConf
     /**
      * Removes a template from the template templateResolver, hence forcing the re-loading
      * of it when it's next time requested. This is to give the application
-     * finer control over templateResolver updating than {@link #setTemplateUpdateDelay(int)}
+     * finer control over templateResolver updating than {@link #setTemplateUpdateDelayMilliseconds(long)}
      * alone does.
      * 
      * <p>For the meaning of the parameters, see
@@ -2645,16 +2628,6 @@ public class Configuration extends Configurable implements Cloneable,
ParserConf
             }
         }
     }
-
-    /**
-     * Returns FreeMarker version number string. 
-     * 
-     * @deprecated Use {@link #getVersion()} instead.
-     */
-    @Deprecated
-    public static String getVersionNumber() {
-        return VERSION.toString();
-    }
     
     /**
      * Returns the FreeMarker version information, most importantly the major.minor.micro
version numbers.

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/45ebfe3d/src/main/java/org/apache/freemarker/core/ast/BuiltinVariable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/BuiltinVariable.java b/src/main/java/org/apache/freemarker/core/ast/BuiltinVariable.java
index 8cd22e5..bfa4c15 100644
--- a/src/main/java/org/apache/freemarker/core/ast/BuiltinVariable.java
+++ b/src/main/java/org/apache/freemarker/core/ast/BuiltinVariable.java
@@ -226,7 +226,7 @@ final class BuiltinVariable extends Expression {
             return new SimpleDate(new Date(), TemplateDateModel.DATETIME);
         }
         if (name == VERSION) {
-            return new SimpleScalar(Configuration.getVersionNumber());
+            return new SimpleScalar(Configuration.getVersion().toString());
         }
         if (name == INCOMPATIBLE_IMPROVEMENTS || name == INCOMPATIBLE_IMPROVEMENTS_CC) {
             return new SimpleScalar(env.getConfiguration().getIncompatibleImprovements().toString());

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/45ebfe3d/src/main/java/org/apache/freemarker/core/templateresolver/TemplateResolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/TemplateResolver.java
b/src/main/java/org/apache/freemarker/core/templateresolver/TemplateResolver.java
index 800b1b8..6bdacd7 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/TemplateResolver.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/TemplateResolver.java
@@ -105,7 +105,7 @@ public abstract class TemplateResolver {
     /**
      * Removes a template from the template cache, hence forcing the re-loading of it when
it's next time requested;
      * this is an optional operation. This is to give the application finer control over
cache updating than
-     * {@link Configuration#setTemplateUpdateDelay(int)} alone does.
+     * {@link Configuration#setTemplateUpdateDelayMilliseconds(long)} alone does.
      * 
      * <p>
      * For the meaning of the parameters, see {@link #getTemplate(String, Locale, Object,
String, boolean)}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/45ebfe3d/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoader.java
b/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoader.java
index fdb56b1..ee143e3 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoader.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoader.java
@@ -61,7 +61,7 @@ public abstract class URLTemplateLoader implements TemplateLoader {
     /**
      * Sets if {@link URLConnection#setUseCaches(boolean)} will be called, and with what
value. By default this is
      * {@code false}, because FreeMarker has its own template cache with its own update delay
setting
-     * ({@link Configuration#setTemplateUpdateDelay(int)}). If this is set to {@code null},
+     * ({@link Configuration#setTemplateUpdateDelayMilliseconds(long)}). If this is set to
{@code null},
      * {@link URLConnection#setUseCaches(boolean)} won't be called.
      */
     public void setURLConnectionUsesCaches(Boolean urlConnectionUsesCaches) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/45ebfe3d/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java b/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java
index 7a7aeab..1d8bfa2 100644
--- a/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java
+++ b/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java
@@ -321,6 +321,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
  * 
  * </ul>
  */
+// [FM3] Lot of things are marked here with "BC" and deprecated
 public class FreemarkerServlet extends HttpServlet {
     
     private static final Logger LOG = _ServletLogs.SERVLET;
@@ -635,7 +636,7 @@ public class FreemarkerServlet extends HttpServlet {
                                 Configuration.TEMPLATE_UPDATE_DELAY_KEY, DEPR_INITPARAM_TEMPLATE_DELAY);
                     }
                     try {
-                        config.setTemplateUpdateDelay(Integer.parseInt(value));
+                        config.setTemplateUpdateDelayMilliseconds(Integer.parseInt(value)
* 1000L);
                     } catch (NumberFormatException e) {
                         // Intentionally ignored
                     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/45ebfe3d/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/ConfigurationTest.java b/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
index 07da39c..7ebcef5 100644
--- a/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
+++ b/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
@@ -224,14 +224,9 @@ public class ConfigurationTest extends TestCase {
                 ((DefaultObjectWrapper) cfg.getObjectWrapper()).getIncompatibleImprovements());
     }
     
-    private void assertUsesNewTemplateLoader(Configuration cfg) {
-        assertNull(cfg.getTemplateLoader());
-    }
-    
     public void testVersion() {
         Version v = Configuration.getVersion();
         assertTrue(v.intValue() >= _TemplateAPI.VERSION_INT_3_0_0);
-        assertSame(v.toString(), Configuration.getVersionNumber());
         
         try {
             new Configuration(new Version(999, 1, 2));
@@ -1149,7 +1144,7 @@ public class ConfigurationTest extends TestCase {
 
         assertEquals(DefaultTemplateResolver.DEFAULT_TEMPLATE_UPDATE_DELAY_MILLIS, cfg.getTemplateUpdateDelayMilliseconds());
         
-        cfg.setTemplateUpdateDelay(4);
+        cfg.setTemplateUpdateDelayMilliseconds(4000);
         assertEquals(4000L, cfg.getTemplateUpdateDelayMilliseconds());
         
         cfg.setTemplateUpdateDelayMilliseconds(100);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/45ebfe3d/src/test/java/org/apache/freemarker/core/templateresolver/DefaultTemplateResolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/templateresolver/DefaultTemplateResolverTest.java
b/src/test/java/org/apache/freemarker/core/templateresolver/DefaultTemplateResolverTest.java
index a604b33..6a0e5e2 100644
--- a/src/test/java/org/apache/freemarker/core/templateresolver/DefaultTemplateResolverTest.java
+++ b/src/test/java/org/apache/freemarker/core/templateresolver/DefaultTemplateResolverTest.java
@@ -148,7 +148,7 @@ public class DefaultTemplateResolverTest {
         cfg.setCacheStorage(new StrongCacheStorage());
         StringTemplateLoader loader = new StringTemplateLoader();
         cfg.setTemplateLoader(loader);
-        cfg.setTemplateUpdateDelay(Integer.MAX_VALUE);
+        cfg.setTemplateUpdateDelayMilliseconds(Integer.MAX_VALUE);
         
         loader.putTemplate("1.ftl", "1 v1");
         loader.putTemplate("2.ftl", "2 v1");
@@ -176,7 +176,7 @@ public class DefaultTemplateResolverTest {
         cfg.setLocale(Locale.US);
         StringTemplateLoader loader = new StringTemplateLoader();
         cfg.setTemplateLoader(loader);
-        cfg.setTemplateUpdateDelay(Integer.MAX_VALUE);
+        cfg.setTemplateUpdateDelayMilliseconds(Integer.MAX_VALUE);
         
         loader.putTemplate("1_en_US.ftl", "1_en_US v1");
         loader.putTemplate("1_en.ftl", "1_en v1");


Mime
View raw message