freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [08/11] incubator-freemarker git commit: Marked most static utility classes as internal, and renamed them to start with "_" (for example StringUtils was renamed to _StringUtil, thus people won't accidentally use it when they wanted to autocomplete to Apa
Date Fri, 17 Feb 2017 14:06:09 GMT
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/FileNameGlobMatcher.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/FileNameGlobMatcher.java b/src/main/java/org/apache/freemarker/core/templateresolver/FileNameGlobMatcher.java
index 1c7fad2..728057e 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/FileNameGlobMatcher.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/FileNameGlobMatcher.java
@@ -21,7 +21,7 @@ package org.apache.freemarker.core.templateresolver;
 import java.io.IOException;
 import java.util.regex.Pattern;
 
-import org.apache.freemarker.core.util.StringUtil;
+import org.apache.freemarker.core.util._StringUtil;
 
 /**
  * As opposed to {@link PathGlobMatcher}, it only compares the "file name" part (the part after the last {@code /}) of
@@ -40,7 +40,7 @@ public class FileNameGlobMatcher extends TemplateSourceMatcher {
     
     /**
      * @param glob
-     *            Glob with the syntax defined by {@link StringUtil#globToRegularExpression(String, boolean)}. Must not
+     *            Glob with the syntax defined by {@link _StringUtil#globToRegularExpression(String, boolean)}. Must not
      *            start with {@code /}.
      */
     public FileNameGlobMatcher(String glob) {
@@ -52,7 +52,7 @@ public class FileNameGlobMatcher extends TemplateSourceMatcher {
     }
 
     private void buildPattern() {
-        pattern = StringUtil.globToRegularExpression("**/" + glob, caseInsensitive);
+        pattern = _StringUtil.globToRegularExpression("**/" + glob, caseInsensitive);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/FirstMatchTemplateConfigurationFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/FirstMatchTemplateConfigurationFactory.java b/src/main/java/org/apache/freemarker/core/templateresolver/FirstMatchTemplateConfigurationFactory.java
index 6d3be05..60d1491 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/FirstMatchTemplateConfigurationFactory.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/FirstMatchTemplateConfigurationFactory.java
@@ -22,7 +22,7 @@ import java.io.IOException;
 
 import org.apache.freemarker.core.Configuration;
 import org.apache.freemarker.core.ast.TemplateConfiguration;
-import org.apache.freemarker.core.util.StringUtil;
+import org.apache.freemarker.core.util._StringUtil;
 
 /**
  * Returns the first non-{@code null} result of the child factories, ignoring all further child factories. The child
@@ -51,7 +51,7 @@ public class FirstMatchTemplateConfigurationFactory extends TemplateConfiguratio
             throw new TemplateConfigurationFactoryException(
                     FirstMatchTemplateConfigurationFactory.class.getSimpleName()
                     + " has found no matching choice for source name "
-                    + StringUtil.jQuote(sourceName) + ". "
+                    + _StringUtil.jQuote(sourceName) + ". "
                     + (noMatchErrorDetails != null
                             ? "Error details: " + noMatchErrorDetails 
                             : "(Set the noMatchErrorDetails property of the factory bean to give a more specific error "

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/MalformedTemplateNameException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/MalformedTemplateNameException.java b/src/main/java/org/apache/freemarker/core/templateresolver/MalformedTemplateNameException.java
index 689cf6e..dc0289f 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/MalformedTemplateNameException.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/MalformedTemplateNameException.java
@@ -25,7 +25,7 @@ import org.apache.freemarker.core.Configuration;
 import org.apache.freemarker.core.TemplateNotFoundException;
 import org.apache.freemarker.core.templateresolver.impl.DefaultTemplateNameFormat;
 import org.apache.freemarker.core.templateresolver.impl.DefaultTemplateNameFormatFM2;
-import org.apache.freemarker.core.util.StringUtil;
+import org.apache.freemarker.core.util._StringUtil;
 
 /**
  * Indicates that the template name given was malformed according the {@link TemplateNameFormat} in use. Note that for
@@ -44,7 +44,7 @@ public class MalformedTemplateNameException extends IOException {
     private final String malformednessDescription;
 
     public MalformedTemplateNameException(String templateName, String malformednessDescription) {
-        super("Malformed template name, " + StringUtil.jQuote(templateName) + ": " + malformednessDescription);
+        super("Malformed template name, " + _StringUtil.jQuote(templateName) + ": " + malformednessDescription);
         this.templateName = templateName;
         this.malformednessDescription = malformednessDescription;
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/PathGlobMatcher.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/PathGlobMatcher.java b/src/main/java/org/apache/freemarker/core/templateresolver/PathGlobMatcher.java
index 3771364..0538268 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/PathGlobMatcher.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/PathGlobMatcher.java
@@ -21,7 +21,7 @@ package org.apache.freemarker.core.templateresolver;
 import java.io.IOException;
 import java.util.regex.Pattern;
 
-import org.apache.freemarker.core.util.StringUtil;
+import org.apache.freemarker.core.util._StringUtil;
 
 /**
  * Matches the whole template source name (also known as template source path) with the given glob.
@@ -29,7 +29,7 @@ import org.apache.freemarker.core.util.StringUtil;
  * it's not the full path of a file on the file system.
  * 
  * <p>This glob implementation recognizes {@code **} (Ant-style directory wildcard) among others. For more details see
- * {@link StringUtil#globToRegularExpression(String, boolean)}.
+ * {@link _StringUtil#globToRegularExpression(String, boolean)}.
  * 
  * <p>About the usage of {@code /} (slash):
  * <ul>
@@ -54,7 +54,7 @@ public class PathGlobMatcher extends TemplateSourceMatcher {
     
     /**
      * @param glob
-     *            Glob with the syntax defined by {@link StringUtil#globToRegularExpression(String, boolean)}. Must not
+     *            Glob with the syntax defined by {@link _StringUtil#globToRegularExpression(String, boolean)}. Must not
      *            start with {@code /}.
      */
     public PathGlobMatcher(String glob) {
@@ -66,7 +66,7 @@ public class PathGlobMatcher extends TemplateSourceMatcher {
     }
 
     private void buildPattern() {
-        pattern = StringUtil.globToRegularExpression(glob, caseInsensitive);
+        pattern = _StringUtil.globToRegularExpression(glob, caseInsensitive);
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/PathRegexMatcher.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/PathRegexMatcher.java b/src/main/java/org/apache/freemarker/core/templateresolver/PathRegexMatcher.java
index 138d5ff..44a2260 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/PathRegexMatcher.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/PathRegexMatcher.java
@@ -21,7 +21,7 @@ package org.apache.freemarker.core.templateresolver;
 import java.io.IOException;
 import java.util.regex.Pattern;
 
-import org.apache.freemarker.core.util.StringUtil;
+import org.apache.freemarker.core.util._StringUtil;
 
 /**
  * Matches the whole template source name (also known as template source path) with the given regular expression.
@@ -36,7 +36,7 @@ public class PathRegexMatcher extends TemplateSourceMatcher {
     
     /**
      * @param regex
-     *            Glob with the syntax defined by {@link StringUtil#globToRegularExpression(String)}. Must not
+     *            Glob with the syntax defined by {@link _StringUtil#globToRegularExpression(String)}. Must not
      *            start with {@code /}.
      */
     public PathRegexMatcher(String regex) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/TemplateLoadingResult.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/TemplateLoadingResult.java b/src/main/java/org/apache/freemarker/core/templateresolver/TemplateLoadingResult.java
index 94844a4..b34b718 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/TemplateLoadingResult.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/TemplateLoadingResult.java
@@ -28,7 +28,7 @@ import java.util.Date;
 import org.apache.freemarker.core.Configuration;
 import org.apache.freemarker.core.ast.TemplateConfiguration;
 import org.apache.freemarker.core.templateresolver.impl.DefaultTemplateResolver;
-import org.apache.freemarker.core.util.NullArgumentException;
+import org.apache.freemarker.core.util._NullArgumentException;
 
 /**
  * Return value of {@link TemplateLoader#load(String, TemplateLoadingSource, Serializable, TemplateLoaderSession)}
@@ -67,8 +67,8 @@ public final class TemplateLoadingResult {
      */
     public TemplateLoadingResult(TemplateLoadingSource source, Serializable version, Reader reader,
             TemplateConfiguration templateConfiguration) {
-        NullArgumentException.check("templateSource", source);
-        NullArgumentException.check("reader", reader);
+        _NullArgumentException.check("templateSource", source);
+        _NullArgumentException.check("reader", reader);
         this.status = TemplateLoadingResultStatus.OPENED;
         this.source = source;
         this.version = version;
@@ -99,8 +99,8 @@ public final class TemplateLoadingResult {
      */
     public TemplateLoadingResult(TemplateLoadingSource source, Serializable version, InputStream inputStream,
             TemplateConfiguration templateConfiguration) {
-        NullArgumentException.check("templateSource", source);
-        NullArgumentException.check("inputStream", inputStream);
+        _NullArgumentException.check("templateSource", source);
+        _NullArgumentException.check("inputStream", inputStream);
         this.status = TemplateLoadingResultStatus.OPENED;
         this.source = source;
         this.version = version;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/impl/ByteArrayTemplateLoader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/impl/ByteArrayTemplateLoader.java b/src/main/java/org/apache/freemarker/core/templateresolver/impl/ByteArrayTemplateLoader.java
index f77de7c..d1e3322 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/impl/ByteArrayTemplateLoader.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/impl/ByteArrayTemplateLoader.java
@@ -34,7 +34,7 @@ import org.apache.freemarker.core.templateresolver.TemplateLoader;
 import org.apache.freemarker.core.templateresolver.TemplateLoaderSession;
 import org.apache.freemarker.core.templateresolver.TemplateLoadingResult;
 import org.apache.freemarker.core.templateresolver.TemplateLoadingSource;
-import org.apache.freemarker.core.util.StringUtil;
+import org.apache.freemarker.core.util._StringUtil;
 
 /**
  * A {@link TemplateLoader} that uses a {@link Map} with {@code byte[]} as its source of templates. This is similar to
@@ -131,7 +131,7 @@ public class ByteArrayTemplateLoader implements TemplateLoader {
                 sb.append("...");
                 break;
             }
-            sb.append(StringUtil.jQuote(name));
+            sb.append(_StringUtil.jQuote(name));
             sb.append("=...");
         }
         if (cnt != 0) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/impl/ClassTemplateLoader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/impl/ClassTemplateLoader.java b/src/main/java/org/apache/freemarker/core/templateresolver/impl/ClassTemplateLoader.java
index 9cd8ead..b84b600 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/impl/ClassTemplateLoader.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/impl/ClassTemplateLoader.java
@@ -25,8 +25,8 @@ import java.net.URLConnection;
 
 import org.apache.freemarker.core.templateresolver.TemplateLoader;
 import org.apache.freemarker.core.templateresolver.TemplateLoadingResult;
-import org.apache.freemarker.core.util.NullArgumentException;
-import org.apache.freemarker.core.util.StringUtil;
+import org.apache.freemarker.core.util._NullArgumentException;
+import org.apache.freemarker.core.util._StringUtil;
 
 /**
  * A {@link TemplateLoader} that can load templates from the "classpath". Naturally, it can load from jar files, or from
@@ -83,15 +83,15 @@ public class ClassTemplateLoader extends URLTemplateLoader {
     private ClassTemplateLoader(Class<?> resourceLoaderClass, boolean allowNullResourceLoaderClass,
             ClassLoader classLoader, String basePackagePath) {
         if (!allowNullResourceLoaderClass) {
-            NullArgumentException.check("resourceLoaderClass", resourceLoaderClass);
+            _NullArgumentException.check("resourceLoaderClass", resourceLoaderClass);
         }
-        NullArgumentException.check("basePackagePath", basePackagePath);
+        _NullArgumentException.check("basePackagePath", basePackagePath);
 
         // Either set a non-null resourceLoaderClass or a non-null classLoader, not both:
         this.resourceLoaderClass = classLoader == null ? (resourceLoaderClass == null ? this.getClass()
                 : resourceLoaderClass) : null;
         if (this.resourceLoaderClass == null && classLoader == null) {
-            throw new NullArgumentException("classLoader");
+            throw new _NullArgumentException("classLoader");
         }
         this.classLoader = classLoader;
 
@@ -128,10 +128,10 @@ public class ClassTemplateLoader extends URLTemplateLoader {
         return _TemplateLoaderUtils.getClassNameForToString(this) + "("
                 + (resourceLoaderClass != null
                         ? "resourceLoaderClass=" + resourceLoaderClass.getName()
-                        : "classLoader=" + StringUtil.jQuote(classLoader))
+                        : "classLoader=" + _StringUtil.jQuote(classLoader))
                 + ", basePackagePath"
                 + "="
-                + StringUtil.jQuote(basePackagePath)
+                + _StringUtil.jQuote(basePackagePath)
                 + (resourceLoaderClass != null
                         ? (basePackagePath.startsWith("/") ? "" : " /* relatively to resourceLoaderClass pkg */")
                         : ""

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateNameFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateNameFormat.java b/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateNameFormat.java
index 448f2af..c3fda79 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateNameFormat.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateNameFormat.java
@@ -24,7 +24,7 @@ import org.apache.freemarker.core.Version;
 import org.apache.freemarker.core.templateresolver.MalformedTemplateNameException;
 import org.apache.freemarker.core.templateresolver.TemplateLoader;
 import org.apache.freemarker.core.templateresolver.TemplateNameFormat;
-import org.apache.freemarker.core.util.StringUtil;
+import org.apache.freemarker.core.util._StringUtil;
 
 /**
  * The default template name format only when {@link Configuration#Configuration(Version) incompatible_improvements}
@@ -175,7 +175,7 @@ public final class DefaultTemplateNameFormat extends TemplateNameFormat {
         String prevName;
         do {
             prevName = path;
-            path = StringUtil.replace(path, "//", "/");
+            path = _StringUtil.replace(path, "//", "/");
         } while (prevName != path);
         return path.startsWith("/") ? path.substring(1) : path;
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateResolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateResolver.java b/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateResolver.java
index 456f944..45e3508 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateResolver.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateResolver.java
@@ -54,8 +54,8 @@ import org.apache.freemarker.core.templateresolver.TemplateLoadingSource;
 import org.apache.freemarker.core.templateresolver.TemplateLookupStrategy;
 import org.apache.freemarker.core.templateresolver.TemplateNameFormat;
 import org.apache.freemarker.core.templateresolver.TemplateResolver;
-import org.apache.freemarker.core.util.NullArgumentException;
-import org.apache.freemarker.core.util.StringUtil;
+import org.apache.freemarker.core.util._NullArgumentException;
+import org.apache.freemarker.core.util._StringUtil;
 import org.apache.freemarker.core.util.UndeclaredThrowableException;
 import org.slf4j.Logger;
 
@@ -166,21 +166,21 @@ public class DefaultTemplateResolver extends TemplateResolver {
         
         this.templateLoader = templateLoader;
         
-        NullArgumentException.check("cacheStorage", cacheStorage);
+        _NullArgumentException.check("cacheStorage", cacheStorage);
         this.cacheStorage = cacheStorage;
         isCacheStorageConcurrent = cacheStorage instanceof ConcurrentCacheStorage &&
                 ((ConcurrentCacheStorage) cacheStorage).isConcurrent();
         
-        NullArgumentException.check("templateLookupStrategy", templateLookupStrategy);
+        _NullArgumentException.check("templateLookupStrategy", templateLookupStrategy);
         this.templateLookupStrategy = templateLookupStrategy;
 
-        NullArgumentException.check("templateNameFormat", templateNameFormat);
+        _NullArgumentException.check("templateNameFormat", templateNameFormat);
         this.templateNameFormat = templateNameFormat;
 
         // Can be null
         this.templateConfigurations = templateConfigurations;
         
-        NullArgumentException.check("config", config);
+        _NullArgumentException.check("config", config);
         this.config = config;
     }
     
@@ -255,9 +255,9 @@ public class DefaultTemplateResolver extends TemplateResolver {
     public GetTemplateResult getTemplate(String name, Locale locale, Object customLookupCondition,
             String encoding, boolean parseAsFTL)
     throws IOException {
-        NullArgumentException.check("name", name);
-        NullArgumentException.check("locale", locale);
-        NullArgumentException.check("encoding", encoding);
+        _NullArgumentException.check("name", name);
+        _NullArgumentException.check("locale", locale);
+        _NullArgumentException.check("encoding", encoding);
         
         try {
             name = templateNameFormat.normalizeRootBasedName(name);
@@ -382,8 +382,8 @@ public class DefaultTemplateResolver extends TemplateResolver {
                             Object newSource = newTemplateLoaderResult.getSource();
                             if (!nullSafeEquals(newSource, oldCachedResult.source)) {
                                 debugMsg.append("the source has been changed: ")
-                                        .append("cached.source=").append(StringUtil.jQuoteNoXSS(oldCachedResult.source))
-                                        .append(", current.source=").append(StringUtil.jQuoteNoXSS(newSource));
+                                        .append("cached.source=").append(_StringUtil.jQuoteNoXSS(oldCachedResult.source))
+                                        .append(", current.source=").append(_StringUtil.jQuoteNoXSS(newSource));
                             } else {
                                 Serializable newVersion = newTemplateLoaderResult.getVersion();
                                 if (!nullSafeEquals(oldCachedResult.version, newVersion)) {
@@ -427,7 +427,7 @@ public class DefaultTemplateResolver extends TemplateResolver {
             // If we get here, then we need to (re)load the template
             if (debug) {
                 LOG.debug(debugPrefix + "Reading template content (source: "
-                        + StringUtil.jQuoteNoXSS(newCachedResult.source) + ")");
+                        + _StringUtil.jQuoteNoXSS(newCachedResult.source) + ")");
             }
             
             Template template = loadTemplate(
@@ -826,9 +826,9 @@ public class DefaultTemplateResolver extends TemplateResolver {
 
     private String getDebugPrefix(String operation, String name, Locale locale, Object customLookupCondition, String encoding,
             boolean parse) {
-        return operation + " " + StringUtil.jQuoteNoXSS(name) + "("
-                + StringUtil.jQuoteNoXSS(locale)
-                + (customLookupCondition != null ? ", cond=" + StringUtil.jQuoteNoXSS(customLookupCondition) : "")
+        return operation + " " + _StringUtil.jQuoteNoXSS(name) + "("
+                + _StringUtil.jQuoteNoXSS(locale)
+                + (customLookupCondition != null ? ", cond=" + _StringUtil.jQuoteNoXSS(customLookupCondition) : "")
                 + ", " + encoding
                 + (parse ? ", parsed)" : ", unparsed]")
                 + ": ";

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java b/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java
index 46998ab..d048070 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java
@@ -37,8 +37,8 @@ import org.apache.freemarker.core.templateresolver.TemplateLoader;
 import org.apache.freemarker.core.templateresolver.TemplateLoaderSession;
 import org.apache.freemarker.core.templateresolver.TemplateLoadingResult;
 import org.apache.freemarker.core.templateresolver.TemplateLoadingSource;
-import org.apache.freemarker.core.util.SecurityUtilities;
-import org.apache.freemarker.core.util.StringUtil;
+import org.apache.freemarker.core.util._SecurityUtil;
+import org.apache.freemarker.core.util._StringUtil;
 import org.slf4j.Logger;
 
 /**
@@ -58,11 +58,11 @@ public class FileTemplateLoader implements TemplateLoader {
             = "org.freemarker.emulateCaseSensitiveFileSystem";
     private static final boolean EMULATE_CASE_SENSITIVE_FILE_SYSTEM_DEFAULT;
     static {
-        final String s = SecurityUtilities.getSystemProperty(SYSTEM_PROPERTY_NAME_EMULATE_CASE_SENSITIVE_FILE_SYSTEM,
+        final String s = _SecurityUtil.getSystemProperty(SYSTEM_PROPERTY_NAME_EMULATE_CASE_SENSITIVE_FILE_SYSTEM,
                 "false");
         boolean emuCaseSensFS;
         try {
-            emuCaseSensFS = StringUtil.getYesNo(s);
+            emuCaseSensFS = _StringUtil.getYesNo(s);
         } catch (Exception e) {
             emuCaseSensFS = false;
         }
@@ -317,7 +317,7 @@ public class FileTemplateLoader implements TemplateLoader {
      */
     @Override
     public String toString() {
-        // We don't StringUtil.jQuote paths here, because on Windows there will be \\-s then that some may find
+        // We don't _StringUtil.jQuote paths here, because on Windows there will be \\-s then that some may find
         // confusing.
         return _TemplateLoaderUtils.getClassNameForToString(this) + "("
                 + "baseDir=\"" + baseDir + "\""

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/impl/MultiTemplateLoader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/impl/MultiTemplateLoader.java b/src/main/java/org/apache/freemarker/core/templateresolver/impl/MultiTemplateLoader.java
index f7841fb..d085aba 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/impl/MultiTemplateLoader.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/impl/MultiTemplateLoader.java
@@ -29,7 +29,7 @@ import org.apache.freemarker.core.templateresolver.TemplateLoaderSession;
 import org.apache.freemarker.core.templateresolver.TemplateLoadingResult;
 import org.apache.freemarker.core.templateresolver.TemplateLoadingResultStatus;
 import org.apache.freemarker.core.templateresolver.TemplateLoadingSource;
-import org.apache.freemarker.core.util.NullArgumentException;
+import org.apache.freemarker.core.util._NullArgumentException;
 
 /**
  * A {@link TemplateLoader} that uses a set of other loaders to load the templates. On every request, loaders are
@@ -56,7 +56,7 @@ public class MultiTemplateLoader implements TemplateLoader {
      *            (except where {@linkplain #setSticky(boolean) stickiness} says otherwise).
      */
     public MultiTemplateLoader(TemplateLoader... templateLoaders) {
-        NullArgumentException.check("templateLoaders", templateLoaders);
+        _NullArgumentException.check("templateLoaders", templateLoaders);
         this.templateLoaders = templateLoaders.clone();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/impl/StringTemplateLoader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/impl/StringTemplateLoader.java b/src/main/java/org/apache/freemarker/core/templateresolver/impl/StringTemplateLoader.java
index f56ac32..4f6d366 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/impl/StringTemplateLoader.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/impl/StringTemplateLoader.java
@@ -34,7 +34,7 @@ import org.apache.freemarker.core.templateresolver.TemplateLoader;
 import org.apache.freemarker.core.templateresolver.TemplateLoaderSession;
 import org.apache.freemarker.core.templateresolver.TemplateLoadingResult;
 import org.apache.freemarker.core.templateresolver.TemplateLoadingSource;
-import org.apache.freemarker.core.util.StringUtil;
+import org.apache.freemarker.core.util._StringUtil;
 
 /**
  * A {@link TemplateLoader} that uses a {@link Map} with {@code String} as its source of templates. This is similar to
@@ -131,7 +131,7 @@ public class StringTemplateLoader implements TemplateLoader {
                 sb.append("...");
                 break;
             }
-            sb.append(StringUtil.jQuote(name));
+            sb.append(_StringUtil.jQuote(name));
             sb.append("=...");
         }
         if (cnt != 0) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/impl/TemplateLoaderBasedTemplateLookupResult.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/impl/TemplateLoaderBasedTemplateLookupResult.java b/src/main/java/org/apache/freemarker/core/templateresolver/impl/TemplateLoaderBasedTemplateLookupResult.java
index 09a0324..89fd020 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/impl/TemplateLoaderBasedTemplateLookupResult.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/impl/TemplateLoaderBasedTemplateLookupResult.java
@@ -22,7 +22,7 @@ import org.apache.freemarker.core.templateresolver.TemplateLoader;
 import org.apache.freemarker.core.templateresolver.TemplateLoadingResult;
 import org.apache.freemarker.core.templateresolver.TemplateLoadingResultStatus;
 import org.apache.freemarker.core.templateresolver.TemplateLookupResult;
-import org.apache.freemarker.core.util.NullArgumentException;
+import org.apache.freemarker.core.util._NullArgumentException;
 
 /**
  * Class of {@link TemplateLookupResult} instances created by {@link TemplateLoaderBasedTemplateLookupContext}. To
@@ -73,8 +73,8 @@ public abstract class TemplateLoaderBasedTemplateLookupResult extends TemplateLo
          *            {@code null}.
          */
         private PositiveTemplateLookupResult(String templateSourceName, TemplateLoadingResult templateLoaderResult) {
-            NullArgumentException.check("templateName", templateSourceName);
-            NullArgumentException.check("templateLoaderResult", templateLoaderResult);
+            _NullArgumentException.check("templateName", templateSourceName);
+            _NullArgumentException.check("templateLoaderResult", templateLoaderResult);
 
             this.templateSourceName = templateSourceName;
             this.templateLoaderResult = templateLoaderResult;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoadingSource.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoadingSource.java b/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoadingSource.java
index 13ebe4d..f644904 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoadingSource.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoadingSource.java
@@ -21,7 +21,7 @@ package org.apache.freemarker.core.templateresolver.impl;
 import java.net.URL;
 
 import org.apache.freemarker.core.templateresolver.TemplateLoadingSource;
-import org.apache.freemarker.core.util.NullArgumentException;
+import org.apache.freemarker.core.util._NullArgumentException;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
@@ -31,7 +31,7 @@ public class URLTemplateLoadingSource implements TemplateLoadingSource {
     private final URL url;
 
     public URLTemplateLoadingSource(URL url) {
-        NullArgumentException.check("url", url);
+        _NullArgumentException.check("url", url);
         this.url = url;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/util/ClassUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/util/ClassUtil.java b/src/main/java/org/apache/freemarker/core/util/ClassUtil.java
deleted file mode 100644
index febabca..0000000
--- a/src/main/java/org/apache/freemarker/core/util/ClassUtil.java
+++ /dev/null
@@ -1,385 +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.
- */
-
-package org.apache.freemarker.core.util;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.freemarker.core.ast.Environment;
-import org.apache.freemarker.core.ast.Macro;
-import org.apache.freemarker.core.ast.TemplateMarkupOutputModel;
-import org.apache.freemarker.core.model.AdapterTemplateModel;
-import org.apache.freemarker.core.model.TemplateBooleanModel;
-import org.apache.freemarker.core.model.TemplateCollectionModel;
-import org.apache.freemarker.core.model.TemplateCollectionModelEx;
-import org.apache.freemarker.core.model.TemplateDateModel;
-import org.apache.freemarker.core.model.TemplateDirectiveModel;
-import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateHashModelEx;
-import org.apache.freemarker.core.model.TemplateMethodModel;
-import org.apache.freemarker.core.model.TemplateMethodModelEx;
-import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelIterator;
-import org.apache.freemarker.core.model.TemplateNodeModel;
-import org.apache.freemarker.core.model.TemplateNodeModelEx;
-import org.apache.freemarker.core.model.TemplateNumberModel;
-import org.apache.freemarker.core.model.TemplateScalarModel;
-import org.apache.freemarker.core.model.TemplateSequenceModel;
-import org.apache.freemarker.core.model.TemplateTransformModel;
-import org.apache.freemarker.core.model.WrapperTemplateModel;
-import org.apache.freemarker.core.model.impl.beans.BeanModel;
-import org.apache.freemarker.core.model.impl.beans.BooleanModel;
-import org.apache.freemarker.core.model.impl.beans.CollectionModel;
-import org.apache.freemarker.core.model.impl.beans.DateModel;
-import org.apache.freemarker.core.model.impl.beans.EnumerationModel;
-import org.apache.freemarker.core.model.impl.beans.IteratorModel;
-import org.apache.freemarker.core.model.impl.beans.MapModel;
-import org.apache.freemarker.core.model.impl.beans.NumberModel;
-import org.apache.freemarker.core.model.impl.beans.OverloadedMethodsModel;
-import org.apache.freemarker.core.model.impl.beans.SimpleMethodModel;
-import org.apache.freemarker.core.model.impl.beans.StringModel;
-
-public class ClassUtil {
-    
-    private static final String ORG_APACHE_FREEMARKER = "org.apache.freemarker.";
-    private static final String ORG_APACHE_FREEMARKER_CORE = "org.apache.freemarker.core.";
-    private static final String ORG_APACHE_FREEMARKER_CORE_TEMPLATERESOLVER
-            = "org.apache.freemarker.core.templateresolver.";
-    private static final String ORG_APACHE_FREEMARKER_CORE_MODEL = "org.apache.freemarker.core.model.";
-
-    private ClassUtil() {
-    }
-    
-    /**
-     * Similar to {@link Class#forName(java.lang.String)}, but attempts to load
-     * through the thread context class loader. Only if thread context class
-     * loader is inaccessible, or it can't find the class will it attempt to
-     * fall back to the class loader that loads the FreeMarker classes.
-     */
-    public static Class forName(String className)
-    throws ClassNotFoundException {
-        try {
-            ClassLoader ctcl = Thread.currentThread().getContextClassLoader();
-            if (ctcl != null) {  // not null: we don't want to fall back to the bootstrap class loader
-                return Class.forName(className, true, ctcl);
-            }
-        } catch (ClassNotFoundException e) {
-            ;// Intentionally ignored
-        } catch (SecurityException e) {
-            ;// Intentionally ignored
-        }
-        // Fall back to the defining class loader of the FreeMarker classes 
-        return Class.forName(className);
-    }
-    
-    /**
-     * Same as {@link #getShortClassName(Class, boolean) getShortClassName(pClass, false)}.
-     * 
-     * @since 2.3.20
-     */
-    public static String getShortClassName(Class pClass) {
-        return getShortClassName(pClass, false);
-    }
-    
-    /**
-     * Returns a class name without "java.lang." and "java.util." prefix, also shows array types in a format like
-     * {@code int[]}; useful for printing class names in error messages.
-     * 
-     * @param pClass can be {@code null}, in which case the method returns {@code null}.
-     * @param shortenFreeMarkerClasses if {@code true}, it will also shorten FreeMarker class names. The exact rules
-     *     aren't specified and might change over time, but right now, {@code org.apache.freemarker.core.model.impl.beans.NumberModel} for
-     *     example becomes to {@code f.e.b.NumberModel}. 
-     * 
-     * @since 2.3.20
-     */
-    public static String getShortClassName(Class pClass, boolean shortenFreeMarkerClasses) {
-        if (pClass == null) {
-            return null;
-        } else if (pClass.isArray()) {
-            return getShortClassName(pClass.getComponentType()) + "[]";
-        } else {
-            String cn = pClass.getName();
-            if (cn.startsWith("java.lang.") || cn.startsWith("java.util.")) {
-                return cn.substring(10);
-            } else {
-                if (shortenFreeMarkerClasses) {
-                    if (cn.startsWith(ORG_APACHE_FREEMARKER_CORE_MODEL)) {
-                        return "o.a.f.c.m." + cn.substring(ORG_APACHE_FREEMARKER_CORE_MODEL.length());
-                    } else if (cn.startsWith(ORG_APACHE_FREEMARKER_CORE_TEMPLATERESOLVER)) {
-                        return "o.a.f.c.t." + cn.substring(ORG_APACHE_FREEMARKER_CORE_TEMPLATERESOLVER.length());
-                    } else if (cn.startsWith(ORG_APACHE_FREEMARKER_CORE)) {
-                        return "o.a.f.c." + cn.substring(ORG_APACHE_FREEMARKER_CORE.length());
-                    } else if (cn.startsWith(ORG_APACHE_FREEMARKER)) {
-                        return "o.a.f." + cn.substring(ORG_APACHE_FREEMARKER.length());
-                    }
-                    // Falls through
-                }
-                return cn;
-            }
-        }
-    }
-
-    /**
-     * Same as {@link #getShortClassNameOfObject(Object, boolean) getShortClassNameOfObject(pClass, false)}.
-     * 
-     * @since 2.3.20
-     */
-    public static String getShortClassNameOfObject(Object obj) {
-        return getShortClassNameOfObject(obj, false);
-    }
-    
-    /**
-     * {@link #getShortClassName(Class, boolean)} called with {@code object.getClass()}, but returns the fictional
-     * class name {@code Null} for a {@code null} value.
-     * 
-     * @since 2.3.20
-     */
-    public static String getShortClassNameOfObject(Object obj, boolean shortenFreeMarkerClasses) {
-        if (obj == null) {
-            return "Null";
-        } else {
-            return ClassUtil.getShortClassName(obj.getClass(), shortenFreeMarkerClasses);
-        }
-    }
-
-    /**
-     * Returns the {@link TemplateModel} interface that is the most characteristic of the object, or {@code null}.
-     */
-    private static Class getPrimaryTemplateModelInterface(TemplateModel tm) {
-        if (tm instanceof BeanModel) {
-            if (tm instanceof CollectionModel) {
-                return TemplateSequenceModel.class;
-            } else if (tm instanceof IteratorModel || tm instanceof EnumerationModel) {
-                return TemplateCollectionModel.class;
-            } else if (tm instanceof MapModel) {
-                return TemplateHashModelEx.class;
-            } else if (tm instanceof NumberModel) {
-                return TemplateNumberModel.class;
-            } else if (tm instanceof BooleanModel) {
-                return TemplateBooleanModel.class;
-            } else if (tm instanceof DateModel) {
-                return TemplateDateModel.class;
-            } else if (tm instanceof StringModel) {
-                Object wrapped = ((BeanModel) tm).getWrappedObject();
-                return wrapped instanceof String
-                        ? TemplateScalarModel.class
-                        : (tm instanceof TemplateHashModelEx ? TemplateHashModelEx.class : null);
-            } else {
-                return null;
-            }
-        } else if (tm instanceof SimpleMethodModel || tm instanceof OverloadedMethodsModel) {
-            return TemplateMethodModelEx.class;
-        } else {
-            return null;
-        }
-    }
-
-    private static void appendTemplateModelTypeName(StringBuilder sb, Set typeNamesAppended, Class cl) {
-        int initalLength = sb.length();
-        
-        if (TemplateNodeModelEx.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "extended node");
-        } else if (TemplateNodeModel.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "node");
-        }
-        
-        if (TemplateDirectiveModel.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "directive");
-        } else if (TemplateTransformModel.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "transform");
-        }
-        
-        if (TemplateSequenceModel.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "sequence");
-        } else if (TemplateCollectionModel.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended,
-                    TemplateCollectionModelEx.class.isAssignableFrom(cl) ? "extended_collection" : "collection");
-        } else if (TemplateModelIterator.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "iterator");
-        }
-        
-        if (TemplateMethodModel.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "method");
-        }
-        
-        if (Environment.Namespace.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "namespace");
-        } else if (TemplateHashModelEx.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "extended_hash");
-        } else if (TemplateHashModel.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "hash");
-        }
-        
-        if (TemplateNumberModel.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "number");
-        }
-        
-        if (TemplateDateModel.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "date_or_time_or_datetime");
-        }
-        
-        if (TemplateBooleanModel.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "boolean");
-        }
-        
-        if (TemplateScalarModel.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "string");
-        }
-        
-        if (TemplateMarkupOutputModel.class.isAssignableFrom(cl)) {
-            appendTypeName(sb, typeNamesAppended, "markup_output");
-        }
-        
-        if (sb.length() == initalLength) {
-            appendTypeName(sb, typeNamesAppended, "misc_template_model");
-        }
-    }
-    
-    private static Class getUnwrappedClass(TemplateModel tm) {
-        Object unwrapped;
-        try {
-            if (tm instanceof WrapperTemplateModel) {
-                unwrapped = ((WrapperTemplateModel) tm).getWrappedObject();
-            } else if (tm instanceof AdapterTemplateModel) {
-                unwrapped = ((AdapterTemplateModel) tm).getAdaptedObject(Object.class);
-            } else {
-                unwrapped = null;
-            }
-        } catch (Throwable e) {
-            unwrapped = null;
-        }
-        return unwrapped != null ? unwrapped.getClass() : null;
-    }
-
-    private static void appendTypeName(StringBuilder sb, Set typeNamesAppended, String name) {
-        if (!typeNamesAppended.contains(name)) {
-            if (sb.length() != 0) sb.append("+");
-            sb.append(name);
-            typeNamesAppended.add(name);
-        }
-    }
-
-    /**
-     * Returns the type description of a value with FTL terms (not plain class name), as it should be used in
-     * type-related error messages and for debugging purposes. The exact format is not specified and might change over
-     * time, but currently it's something like {@code "string (wrapper: f.t.SimpleScalar)"} or
-     * {@code "sequence+hash+string (ArrayList wrapped into f.e.b.CollectionModel)"}.
-     * 
-     * @since 2.3.20
-     */
-    public static String getFTLTypeDescription(TemplateModel tm) {
-        if (tm == null) {
-            return "Null";
-        } else {
-            Set typeNamesAppended = new HashSet();
-            
-            StringBuilder sb = new StringBuilder();
-    
-            Class primaryInterface = getPrimaryTemplateModelInterface(tm);
-            if (primaryInterface != null) {
-                appendTemplateModelTypeName(sb, typeNamesAppended, primaryInterface);
-            }
-    
-            if (tm instanceof Macro) {
-                appendTypeName(sb, typeNamesAppended, ((Macro) tm).isFunction() ? "function" : "macro");
-            }
-            
-            appendTemplateModelTypeName(sb, typeNamesAppended, tm.getClass());
-            
-            String javaClassName;
-            Class unwrappedClass = getUnwrappedClass(tm);
-            if (unwrappedClass != null) {
-                javaClassName = getShortClassName(unwrappedClass, true);
-            } else {
-                javaClassName = null;
-            }
-            
-            sb.append(" (");
-            String modelClassName = getShortClassName(tm.getClass(), true);
-            if (javaClassName == null) {
-                sb.append("wrapper: ");
-                sb.append(modelClassName);
-            } else {
-                sb.append(javaClassName);
-                sb.append(" wrapped into ");
-                sb.append(modelClassName);
-            }
-            sb.append(")");
-    
-            return sb.toString();
-        }
-    }
-    
-    /**
-     * Gets the wrapper class for a primitive class, like {@link Integer} for {@code int}, also returns {@link Void}
-     * for {@code void}. 
-     * 
-     * @param primitiveClass A {@link Class} like {@code int.type}, {@code boolean.type}, etc. If it's not a primitive
-     *     class, or it's {@code null}, then the parameter value is returned as is. Note that performance-wise the
-     *     method assumes that it's a primitive class.
-     *     
-     * @since 2.3.21
-     */
-    public static Class primitiveClassToBoxingClass(Class primitiveClass) {
-        // Tried to sort these with decreasing frequency in API-s:
-        if (primitiveClass == int.class) return Integer.class;
-        if (primitiveClass == boolean.class) return Boolean.class;
-        if (primitiveClass == long.class) return Long.class;
-        if (primitiveClass == double.class) return Double.class;
-        if (primitiveClass == char.class) return Character.class;
-        if (primitiveClass == float.class) return Float.class;
-        if (primitiveClass == byte.class) return Byte.class;
-        if (primitiveClass == short.class) return Short.class;
-        if (primitiveClass == void.class) return Void.class;  // not really a primitive, but we normalize it
-        return primitiveClass;
-    }
-
-    /**
-     * The exact reverse of {@link #primitiveClassToBoxingClass}.
-     *     
-     * @since 2.3.21
-     */
-    public static Class boxingClassToPrimitiveClass(Class boxingClass) {
-        // Tried to sort these with decreasing frequency in API-s:
-        if (boxingClass == Integer.class) return int.class;
-        if (boxingClass == Boolean.class) return boolean.class;
-        if (boxingClass == Long.class) return long.class;
-        if (boxingClass == Double.class) return double.class;
-        if (boxingClass == Character.class) return char.class;
-        if (boxingClass == Float.class) return float.class;
-        if (boxingClass == Byte.class) return byte.class;
-        if (boxingClass == Short.class) return short.class;
-        if (boxingClass == Void.class) return void.class;  // not really a primitive, but we normalize to it
-        return boxingClass;
-    }
-    
-    /**
-     * Tells if a type is numerical; works both for primitive types and classes.
-     * 
-     * @param type can't be {@code null}
-     * 
-     * @since 2.3.21
-     */
-    public static boolean isNumerical(Class type) {
-        return Number.class.isAssignableFrom(type)
-                || type.isPrimitive() && type != Boolean.TYPE && type != Character.TYPE && type != Void.TYPE;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/util/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/util/CollectionUtils.java b/src/main/java/org/apache/freemarker/core/util/CollectionUtils.java
deleted file mode 100644
index 39a88a9..0000000
--- a/src/main/java/org/apache/freemarker/core/util/CollectionUtils.java
+++ /dev/null
@@ -1,36 +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.
- */
-
-package org.apache.freemarker.core.util;
-
-/** @since 2.3.21 */
-public class CollectionUtils {
-    
-    private CollectionUtils() { }
-
-    public static final Object[] EMPTY_OBJECT_ARRAY = new Object[] { };
-
-    public static final Class[] EMPTY_CLASS_ARRAY = new Class[] { };
-
-    /**
-     * @since 2.3.22
-     */
-    public static final char[] EMPTY_CHAR_ARRAY = new char[] { };
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/util/Constants.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/util/Constants.java b/src/main/java/org/apache/freemarker/core/util/Constants.java
deleted file mode 100644
index 32f62e3..0000000
--- a/src/main/java/org/apache/freemarker/core/util/Constants.java
+++ /dev/null
@@ -1,122 +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.
- */
-
-package org.apache.freemarker.core.util;
-
-import java.io.Serializable;
-
-import org.apache.freemarker.core.model.TemplateBooleanModel;
-import org.apache.freemarker.core.model.TemplateCollectionModel;
-import org.apache.freemarker.core.model.TemplateHashModelEx;
-import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
-import org.apache.freemarker.core.model.TemplateModelIterator;
-import org.apache.freemarker.core.model.TemplateNumberModel;
-import org.apache.freemarker.core.model.TemplateScalarModel;
-import org.apache.freemarker.core.model.TemplateSequenceModel;
-import org.apache.freemarker.core.model.impl.SimpleNumber;
-
-/**
- * Frequently used constant {@link TemplateModel} values.
- * 
- * <p>These constants should be stored in the {@link TemplateModel}
- * sub-interfaces, but for bacward compatibility they are stored here instead.
- * Starting from FreeMarker 2.4 they should be copyed (not moved!) into the
- * {@link TemplateModel} sub-interfaces, and this class should be marked as
- * deprecated.</p>
- */
-public class Constants {
-
-    public static final TemplateBooleanModel TRUE = TemplateBooleanModel.TRUE;
-
-    public static final TemplateBooleanModel FALSE = TemplateBooleanModel.FALSE;
-    
-    public static final TemplateScalarModel EMPTY_STRING = (TemplateScalarModel) TemplateScalarModel.EMPTY_STRING;
-
-    public static final TemplateNumberModel ZERO = new SimpleNumber(0);
-    
-    public static final TemplateNumberModel ONE = new SimpleNumber(1);
-    
-    public static final TemplateNumberModel MINUS_ONE = new SimpleNumber(-1);
-    
-    public static final TemplateModelIterator EMPTY_ITERATOR = new EmptyIteratorModel();
-    
-    private static class EmptyIteratorModel implements TemplateModelIterator, Serializable {
-
-        public TemplateModel next() throws TemplateModelException {
-            throw new TemplateModelException("The collection has no more elements.");
-        }
-
-        public boolean hasNext() throws TemplateModelException {
-            return false;
-        }
-        
-    }
-
-    public static final TemplateCollectionModel EMPTY_COLLECTION = new EmptyCollectionModel();
-    
-    private static class EmptyCollectionModel implements TemplateCollectionModel, Serializable {
-
-        public TemplateModelIterator iterator() throws TemplateModelException {
-            return EMPTY_ITERATOR;
-        }
-        
-    }
-    
-    public static final TemplateSequenceModel EMPTY_SEQUENCE = new EmptySequenceModel();
-    
-    private static class EmptySequenceModel implements TemplateSequenceModel, Serializable {
-        
-        public TemplateModel get(int index) throws TemplateModelException {
-            return null;
-        }
-    
-        public int size() throws TemplateModelException {
-            return 0;
-        }
-        
-    }
-    
-    public static final TemplateHashModelEx EMPTY_HASH = new EmptyHashModel();
-    
-    private static class EmptyHashModel implements TemplateHashModelEx, Serializable {
-        
-        public int size() throws TemplateModelException {
-            return 0;
-        }
-
-        public TemplateCollectionModel keys() throws TemplateModelException {
-            return EMPTY_COLLECTION;
-        }
-
-        public TemplateCollectionModel values() throws TemplateModelException {
-            return EMPTY_COLLECTION;
-        }
-
-        public TemplateModel get(String key) throws TemplateModelException {
-            return null;
-        }
-
-        public boolean isEmpty() throws TemplateModelException {
-            return true;
-        }
-        
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/main/java/org/apache/freemarker/core/util/DOMNodeModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/util/DOMNodeModel.java b/src/main/java/org/apache/freemarker/core/util/DOMNodeModel.java
deleted file mode 100644
index 82480fa..0000000
--- a/src/main/java/org/apache/freemarker/core/util/DOMNodeModel.java
+++ /dev/null
@@ -1,267 +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.
- */
-
-package org.apache.freemarker.core.util;
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.freemarker.core.model.TemplateBooleanModel;
-import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateMethodModel;
-import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
-import org.apache.freemarker.core.model.TemplateSequenceModel;
-import org.apache.freemarker.core.model.impl.SimpleHash;
-import org.apache.freemarker.core.model.impl.SimpleScalar;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-
-/**
- * A convenient wrapper class for wrapping a Node in the W3C DOM_WRAPPER API.
- */
-
-public class DOMNodeModel implements TemplateHashModel {
-
-    static private HashMap equivalenceTable = new HashMap();
-    static {
-        equivalenceTable.put("*", "children");
-        equivalenceTable.put("@*", "attributes");
-    }
-
-    private Node node;
-    private HashMap cache = new HashMap();
-
-    public DOMNodeModel(Node node) {
-        this.node = node;
-    }
-
-    public TemplateModel get(String key) throws TemplateModelException {
-        TemplateModel result = null;
-        if (equivalenceTable.containsKey(key)) {
-            key = (String) equivalenceTable.get(key);
-        }
-        if (cache.containsKey(key)) {
-            result = (TemplateModel) cache.get(key);
-        }
-        if (result == null) {
-            if ("attributes".equals(key)) {
-                NamedNodeMap attributes = node.getAttributes();
-                if (attributes != null) {
-                    SimpleHash hash = new SimpleHash();
-                    for (int i = 0; i < attributes.getLength(); i++) {
-                        Attr att = (Attr) attributes.item(i);
-                        hash.put(att.getName(), att.getValue());
-                    }
-                    result = hash;
-                }
-            } else if (key.charAt(0) == '@') {
-                if (node instanceof Element) {
-                    String attValue = ((Element) node).getAttribute(key.substring(1));
-                    result = new SimpleScalar(attValue);
-                } else {
-                    throw new TemplateModelException("Trying to get an attribute value for a non-element node");
-                }
-            } else if ("is_element".equals(key)) {
-                result = (node instanceof Element) ?
-                    TemplateBooleanModel.TRUE : TemplateBooleanModel.FALSE;
-            } else if ("is_text".equals(key)) {
-                result = (node instanceof Text) ?
-                    TemplateBooleanModel.TRUE : TemplateBooleanModel.FALSE;
-            } else if ("name".equals(key)) {
-                result = new SimpleScalar(node.getNodeName());
-            } else if ("children".equals(key)) {
-                result = new NodeListTM(node.getChildNodes());
-            } else if ("parent".equals(key)) {
-                Node parent = node.getParentNode();
-                result = (parent == null) ? null : new DOMNodeModel(parent);
-            } else if ("ancestorByName".equals(key)) {
-                result = new AncestorByName();
-            } else if ("nextSibling".equals(key)) {
-                Node next = node.getNextSibling();
-                result = (next == null) ? null : new DOMNodeModel(next);
-            } else if ("previousSibling".equals(key)) {
-                Node previous = node.getPreviousSibling();
-                result = (previous == null) ? null : new DOMNodeModel(previous);
-            } else if ("nextSiblingElement".equals(key)) {
-                Node next = nextSiblingElement(node);
-                result = (next == null) ? null : new DOMNodeModel(next);
-            } else if ("previousSiblingElement".equals(key)) {
-                Node previous = previousSiblingElement(node);
-                result = (previous == null) ? null : new DOMNodeModel(previous);
-            } else if ("nextElement".equals(key)) {
-                Node next = nextElement(node);
-                result = (next == null) ? null : new DOMNodeModel(next);
-            } else if ("previousElement".equals(key)) {
-                Node previous = previousElement(node);
-                result = (previous == null) ? null : new DOMNodeModel(previous);
-            } else if ("text".equals(key)) {
-                result = new SimpleScalar(getText(node));
-            }
-            cache.put(key, result);
-        }
-        return result;
-    }
-
-    public boolean isEmpty() {
-        return false;
-    }
-
-    static private String getText(Node node) {
-        String result = "";
-        if (node instanceof Text) {
-            result = ((Text) node).getData();
-        } else if (node instanceof Element) {
-            NodeList children = node.getChildNodes();
-            for (int i = 0; i < children.getLength(); i++) {
-                result += getText(children.item(i));
-            }
-        }
-        return result;
-    }
-
-    static private Element nextSiblingElement(Node node) {
-        Node next = node;
-        while (next != null) {
-            next = next.getNextSibling();
-            if (next instanceof Element) {
-                return (Element) next;
-            }
-        }
-        return null;
-    }
-
-    static private Element previousSiblingElement(Node node) {
-        Node previous = node;
-        while (previous != null) {
-            previous = previous.getPreviousSibling();
-            if (previous instanceof Element) {
-                return (Element) previous;
-            }
-        }
-        return null;
-    }
-
-    static private Element nextElement(Node node) {
-        if (node.hasChildNodes()) {
-            NodeList children = node.getChildNodes();
-            for (int i = 0; i < children.getLength(); i++) {
-                Node child = children.item(i);
-                if (child instanceof Element) {
-                    return (Element) child;
-                }
-            }
-        }
-        Element nextSiblingElement = nextSiblingElement(node);
-        if (nextSiblingElement != null) {
-            return nextSiblingElement;
-        }
-        Node parent = node.getParentNode();
-        while (parent instanceof Element) {
-            Element next = nextSiblingElement(parent);
-            if (next != null) {
-                return next;
-            }
-            parent = parent.getParentNode();
-        }
-        return null;
-    }
-
-    static private Element previousElement(Node node) {
-        Element result = previousSiblingElement(node);
-        if (result != null) {
-            return result;
-        }
-        Node parent = node.getParentNode();
-        if (parent instanceof Element) {
-            return (Element) parent;
-        }
-        return null;
-    }
-
-    void setParent(DOMNodeModel parent) {
-        if (parent != null) {
-            cache.put("parent", parent);
-        }
-    }
-
-    String getNodeName() {
-        return node.getNodeName();
-    }
-
-
-    class AncestorByName implements TemplateMethodModel {
-        public Object exec(List arguments) throws TemplateModelException {
-            if (arguments.size() != 1) {
-                throw new TemplateModelException("Expecting exactly one string argument here");
-            }
-            String nodeName = (String) arguments.get(0);
-            DOMNodeModel ancestor = (DOMNodeModel) DOMNodeModel.this.get("parent");
-            while (ancestor != null) {
-                if (nodeName.equals(ancestor.getNodeName())) {
-                    return ancestor;
-                }
-                ancestor = (DOMNodeModel) ancestor.get("parent");
-            }
-            return null;
-        }
-    }
-
-
-    class NodeListTM implements TemplateSequenceModel, TemplateMethodModel {
-
-        private NodeList nodeList;
-        private TemplateModel[] nodes;
-
-        NodeListTM(NodeList nodeList) {
-            this.nodeList = nodeList;
-            nodes = new TemplateModel[nodeList.getLength()];
-        }
-
-        public TemplateModel get(int index) {
-            DOMNodeModel result = (DOMNodeModel) nodes[index];
-            if (result == null) {
-                result = new DOMNodeModel(nodeList.item(index));
-                nodes[index] = result;
-                result.setParent(DOMNodeModel.this);
-            }
-            return result;
-        }
-
-        public int size() {
-            return nodes.length;
-        }
-
-        public Object exec(List arguments) throws TemplateModelException {
-            if (arguments.size() != 1) {
-                throw new TemplateModelException("Expecting exactly one string argument here");
-            }
-            if (!(node instanceof Element)) {
-                throw new TemplateModelException("Expecting element here.");
-            }
-            Element elem = (Element) node;
-            return new NodeListTM(elem.getElementsByTagName((String) arguments.get(0)));
-        }
-    }
-}
-


Mime
View raw message