Repository: incubator-freemarker Updated Branches: refs/heads/3 4e2f45147 -> a5d9575f3
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeAccessorTag.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeAccessorTag.java b/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeAccessorTag.java index ba0926f..fe2e2a6 100644 --- a/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeAccessorTag.java +++ b/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeAccessorTag.java @@ -22,7 +22,7 @@ package org.apache.freemarker.servlet.jsp.taglibmembers; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.SimpleTagSupport; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; public abstract class AttributeAccessorTag extends SimpleTagSupport { @@ -62,7 +62,7 @@ public abstract class AttributeAccessorTag extends SimpleTagSupport { if (scope.equals("application")) { return PageContext.APPLICATION_SCOPE; } - throw new IllegalArgumentException("Invalid scope name: " + StringUtil.jQuote(scope)); + throw new IllegalArgumentException("Invalid scope name: " + _StringUtil.jQuote(scope)); } } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeInfoTag.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeInfoTag.java b/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeInfoTag.java index 1d0aafc..e7be311 100644 --- a/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeInfoTag.java +++ b/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeInfoTag.java @@ -26,8 +26,8 @@ import javax.servlet.jsp.JspContext; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; -import org.apache.freemarker.core.util.DateUtil; -import org.apache.freemarker.core.util.DateUtil.TrivialDateToISO8601CalendarFactory; +import org.apache.freemarker.core.util._DateUtil; +import org.apache.freemarker.core.util._DateUtil.TrivialDateToISO8601CalendarFactory; public class AttributeInfoTag extends AttributeAccessorTag { @@ -41,8 +41,8 @@ public class AttributeInfoTag extends AttributeAccessorTag { final String formattedVal; if (attrVal instanceof Date) { - formattedVal = DateUtil.dateToISO8601String((Date) attrVal, true, true, true, DateUtil.ACCURACY_SECONDS, - DateUtil.UTC, + formattedVal = _DateUtil.dateToISO8601String((Date) attrVal, true, true, true, _DateUtil.ACCURACY_SECONDS, + _DateUtil.UTC, new TrivialDateToISO8601CalendarFactory()); } else { formattedVal = String.valueOf(attrVal); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/GetAndSetTag.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/GetAndSetTag.java b/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/GetAndSetTag.java index 8d53139..522084e 100644 --- a/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/GetAndSetTag.java +++ b/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/GetAndSetTag.java @@ -25,7 +25,7 @@ import javax.servlet.jsp.JspContext; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; -import org.apache.freemarker.core.util.NullArgumentException; +import org.apache.freemarker.core.util._NullArgumentException; public class GetAndSetTag extends AttributeAccessorTag { @@ -34,7 +34,7 @@ public class GetAndSetTag extends AttributeAccessorTag { @SuppressWarnings("boxing") @Override public void doTag() throws JspException, IOException { - NullArgumentException.check("name", name); + _NullArgumentException.check("name", name); Integer scopeInt = getScopeAsInteger(); JspContext ctx = getJspContext(); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/ResourcesExtractor.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/ResourcesExtractor.java b/src/test/java/org/apache/freemarker/test/ResourcesExtractor.java index 0a6cff1..03afa2c 100644 --- a/src/test/java/org/apache/freemarker/test/ResourcesExtractor.java +++ b/src/test/java/org/apache/freemarker/test/ResourcesExtractor.java @@ -31,7 +31,7 @@ import java.util.zip.ZipEntry; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -141,8 +141,8 @@ public final class ResourcesExtractor { int arrowIdx = contLine.indexOf(ARROW); if (arrowIdx != -1) { if (!contLine.startsWith("/")) { - throw new IOException("In " + StringUtil.jQuote(contResource) + ", this line must start with " - + "\"/\" as it uses the " + StringUtil.jQuote(ARROW) + " operator : " + throw new IOException("In " + _StringUtil.jQuote(contResource) + ", this line must start with " + + "\"/\" as it uses the " + _StringUtil.jQuote(ARROW) + " operator : " + contLine); } contSrcPath = contLine.substring(0, arrowIdx).trim(); @@ -150,7 +150,7 @@ public final class ResourcesExtractor { contSrcPathRelative = false; } else { if (contLine.startsWith("/")) { - throw new IOException("In " + StringUtil.jQuote(contResource) + throw new IOException("In " + _StringUtil.jQuote(contResource) + ", this line can't start with \"/\": " + contLine); } contSrcPathRelative = true; @@ -171,7 +171,7 @@ public final class ResourcesExtractor { try { if (dstFile.exists()) { throw new IOException( - "Destination already exists; check if " + StringUtil.jQuote(contDstPath) + "Destination already exists; check if " + _StringUtil.jQuote(contDstPath) + " occurs for multiple times in \"" + CONTENTS_TXT + "\"."); } FileUtils.copyInputStreamToFile(entryIn, dstFile); @@ -179,8 +179,8 @@ public final class ResourcesExtractor { File parent = dstFile; while ((parent = dstFile.getParentFile()) != null) { if (parent.isFile()) { - throw new IOException("An ancestor directory of " + StringUtil.jQuote(dstFile) + ", " - + StringUtil.jQuote(parent) + " already exists, but as a file, not as a directory. " + throw new IOException("An ancestor directory of " + _StringUtil.jQuote(dstFile) + ", " + + _StringUtil.jQuote(parent) + " already exists, but as a file, not as a directory. " + "Check if you have accidentally added the directory itself to \"" + CONTENTS_TXT + "\". Only files should be listed there."); } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/TemplateTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/TemplateTest.java b/src/test/java/org/apache/freemarker/test/TemplateTest.java index 8017467..3957ee8 100644 --- a/src/test/java/org/apache/freemarker/test/TemplateTest.java +++ b/src/test/java/org/apache/freemarker/test/TemplateTest.java @@ -40,7 +40,7 @@ import org.apache.freemarker.core.ast.ParseException; import org.apache.freemarker.core.templateresolver.TemplateLoader; import org.apache.freemarker.core.templateresolver.impl.ByteArrayTemplateLoader; import org.apache.freemarker.core.templateresolver.impl.MultiTemplateLoader; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; import org.apache.freemarker.test.templatesuite.TemplateTestSuite; import org.apache.freemarker.test.util.TestUtil; import org.junit.Ignore; @@ -270,16 +270,16 @@ public abstract class TemplateTest { if (needle.startsWith("\\!")) { String netNeedle = needle.substring(2); if (msg.contains(netNeedle)) { - fail("The message shouldn't contain substring " + StringUtil.jQuote(netNeedle) + ":\n" + msg); + fail("The message shouldn't contain substring " + _StringUtil.jQuote(netNeedle) + ":\n" + msg); } } else if (!msg.contains(needle)) { - fail("The message didn't contain substring " + StringUtil.jQuote(needle) + ":\n" + msg); + fail("The message didn't contain substring " + _StringUtil.jQuote(needle) + ":\n" + msg); } } } private String normalizeNewLines(String s) { - return StringUtil.replace(s, "\r\n", "\n").replace('\r', '\n'); + return _StringUtil.replace(s, "\r\n", "\n").replace('\r', '\n'); } public static class TestBean { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/servlet/Model2TesterServlet.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/servlet/Model2TesterServlet.java b/src/test/java/org/apache/freemarker/test/servlet/Model2TesterServlet.java index 5953d64..4506ff3 100644 --- a/src/test/java/org/apache/freemarker/test/servlet/Model2TesterServlet.java +++ b/src/test/java/org/apache/freemarker/test/servlet/Model2TesterServlet.java @@ -28,7 +28,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; import org.apache.freemarker.servlet.FreemarkerServlet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -108,7 +108,7 @@ public class Model2TesterServlet extends HttpServlet { final RequestDispatcher requestDispatcher = getServletContext().getNamedDispatcher(paramViewServlet); if (requestDispatcher == null) { throw new ServletException("Can't find request dispatched for servlet name " - + StringUtil.jQuote(paramViewServlet) + "."); + + _StringUtil.jQuote(paramViewServlet) + "."); } final HttpServletRequestWrapper viewReq = new HttpServletRequestWrapper(req) { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/templatesuite/TemplateTestCase.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/templatesuite/TemplateTestCase.java b/src/test/java/org/apache/freemarker/test/templatesuite/TemplateTestCase.java index 9e7ecab..d31a83f 100644 --- a/src/test/java/org/apache/freemarker/test/templatesuite/TemplateTestCase.java +++ b/src/test/java/org/apache/freemarker/test/templatesuite/TemplateTestCase.java @@ -67,9 +67,9 @@ import org.apache.freemarker.core.model.impl.beans.Java7MembersOnlyBeansWrapper; import org.apache.freemarker.core.model.impl.beans.ResourceBundleModel; import org.apache.freemarker.core.model.impl.dom.NodeModel; import org.apache.freemarker.core.templateresolver.impl.FileTemplateLoader; -import org.apache.freemarker.core.util.NullArgumentException; -import org.apache.freemarker.core.util.NullWriter; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._NullArgumentException; +import org.apache.freemarker.core.util._NullWriter; +import org.apache.freemarker.core.util._StringUtil; import org.apache.freemarker.test.CopyrightCommentRemoverTemplateLoader; import org.apache.freemarker.test.templatesuite.models.BooleanAndStringTemplateModel; import org.apache.freemarker.test.templatesuite.models.BooleanHash1; @@ -124,15 +124,15 @@ public class TemplateTestCase extends FileTestCase { public TemplateTestCase(String testName, String simpleTestName, String templateName, String expectedFileName, boolean noOutput, Version incompatibleImprovements) { super(testName); - NullArgumentException.check("testName", testName); + _NullArgumentException.check("testName", testName); - NullArgumentException.check("simpleTestName", simpleTestName); + _NullArgumentException.check("simpleTestName", simpleTestName); this.simpleTestName = simpleTestName; - NullArgumentException.check("templateName", templateName); + _NullArgumentException.check("templateName", templateName); this.templateName = templateName; - NullArgumentException.check("expectedFileName", expectedFileName); + _NullArgumentException.check("expectedFileName", expectedFileName); this.expectedFileName = expectedFileName; this.noOutput = noOutput; @@ -152,7 +152,7 @@ public class TemplateTestCase extends FileTestCase { String alias = st.nextToken(); conf.addAutoImport(alias, libname); } else if ("clear_encoding_map".equals(param)) { - if (StringUtil.getYesNo(value)) { + if (_StringUtil.getYesNo(value)) { conf.clearEncodingMap(); } } else if ("input_encoding".equals(param)) { @@ -164,8 +164,8 @@ public class TemplateTestCase extends FileTestCase { } catch (TemplateException e) { throw new RuntimeException( "Failed to set setting " + - StringUtil.jQuote(param) + " to " + - StringUtil.jQuote(value) + "; see cause exception.", + _StringUtil.jQuote(param) + " to " + + _StringUtil.jQuote(value) + "; see cause exception.", e); } } @@ -453,15 +453,15 @@ public class TemplateTestCase extends FileTestCase { template = conf.getTemplate(templateName); } catch (IOException e) { throw new AssertionFailedError( - "Could not load template " + StringUtil.jQuote(templateName) + ":\n" + getStackTrace(e)); + "Could not load template " + _StringUtil.jQuote(templateName) + ":\n" + getStackTrace(e)); } ASTPrinter.validateAST(template); StringWriter out = noOutput ? null : new StringWriter(); try { - template.process(dataModel, out != null ? out : NullWriter.INSTANCE); + template.process(dataModel, out != null ? out : _NullWriter.INSTANCE); } catch (TemplateException e) { - throw new AssertionFailedError("Template " + StringUtil.jQuote(templateName) + " has stopped with error:\n" + throw new AssertionFailedError("Template " + _StringUtil.jQuote(templateName) + " has stopped with error:\n" + getStackTrace(e)); } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/templatesuite/TemplateTestSuite.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/templatesuite/TemplateTestSuite.java b/src/test/java/org/apache/freemarker/test/templatesuite/TemplateTestSuite.java index 3329564..2733b79 100644 --- a/src/test/java/org/apache/freemarker/test/templatesuite/TemplateTestSuite.java +++ b/src/test/java/org/apache/freemarker/test/templatesuite/TemplateTestSuite.java @@ -37,7 +37,7 @@ import junit.framework.TestSuite; import org.apache.freemarker.core.Configuration; import org.apache.freemarker.core.Version; import org.apache.freemarker.core.model.impl.dom.NodeModel; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -97,7 +97,7 @@ public class TemplateTestSuite extends TestSuite { String filterStr = System.getProperty(TEST_FILTER_PROPERTY_NAME); testCaseNameFilter = filterStr != null ? Pattern.compile(filterStr) : null; if (testCaseNameFilter != null) { - System.out.println("Note: " + TEST_FILTER_PROPERTY_NAME + " is " + StringUtil.jQuote(testCaseNameFilter)); + System.out.println("Note: " + TEST_FILTER_PROPERTY_NAME + " is " + _StringUtil.jQuote(testCaseNameFilter)); } testSuiteIcis = new ArrayList<Version>(); @@ -177,7 +177,7 @@ public class TemplateTestSuite extends TestSuite { */ private List<TemplateTestCase> createTestCasesFromElement(Element testCaseElem) throws Exception { - final String caseName = StringUtil.emptyToNull(testCaseElem.getAttribute("name")); + final String caseName = _StringUtil.emptyToNull(testCaseElem.getAttribute("name")); if (caseName == null) throw new Exception("Invalid XML: the \"name\" attribute is mandatory."); if (testCaseNameFilter != null @@ -198,20 +198,20 @@ public class TemplateTestSuite extends TestSuite { } { - String s = StringUtil.emptyToNull(testCaseElem.getAttribute(ATTR_TEMPLATE)); + String s = _StringUtil.emptyToNull(testCaseElem.getAttribute(ATTR_TEMPLATE)); templateName = s != null ? s : beforeEndTN + ".ftl"; } { - String s = StringUtil.emptyToNull(testCaseElem.getAttribute(ATTR_EXPECTED)); + String s = _StringUtil.emptyToNull(testCaseElem.getAttribute(ATTR_EXPECTED)); expectedFileName = s != null ? s : beforeEndTN + afterEndTN + ".txt"; } } final boolean noOutput; { - String s = StringUtil.emptyToNull(testCaseElem.getAttribute(ATTR_NO_OUTPUT)); - noOutput = s == null ? false : StringUtil.getYesNo(s); + String s = _StringUtil.emptyToNull(testCaseElem.getAttribute(ATTR_NO_OUTPUT)); + noOutput = s == null ? false : _StringUtil.getYesNo(s); } final Map<String, String> testCaseSettings = getCaseFMSettings(testCaseElem); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/templatesuite/models/JavaObjectInfo.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/templatesuite/models/JavaObjectInfo.java b/src/test/java/org/apache/freemarker/test/templatesuite/models/JavaObjectInfo.java index 23fbc64..6aa6ac2 100644 --- a/src/test/java/org/apache/freemarker/test/templatesuite/models/JavaObjectInfo.java +++ b/src/test/java/org/apache/freemarker/test/templatesuite/models/JavaObjectInfo.java @@ -19,7 +19,7 @@ package org.apache.freemarker.test.templatesuite.models; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; public class JavaObjectInfo { @@ -29,7 +29,7 @@ public class JavaObjectInfo { public String info(Object o) { if (o == null) return "null"; - return o.getClass().getName() + " " + StringUtil.jQuote(o.toString()); + return o.getClass().getName() + " " + _StringUtil.jQuote(o.toString()); } } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/templatesuite/models/Listables.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/templatesuite/models/Listables.java b/src/test/java/org/apache/freemarker/test/templatesuite/models/Listables.java index 86eb8ab..65172c8 100644 --- a/src/test/java/org/apache/freemarker/test/templatesuite/models/Listables.java +++ b/src/test/java/org/apache/freemarker/test/templatesuite/models/Listables.java @@ -18,42 +18,30 @@ */ package org.apache.freemarker.test.templatesuite.models; -import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.SortedMap; import java.util.TreeSet; import org.apache.freemarker.core.Configuration; -import org.apache.freemarker.core.ast._DelayedJQuote; -import org.apache.freemarker.core.ast._TemplateModelException; -import org.apache.freemarker.core.model.AdapterTemplateModel; import org.apache.freemarker.core.model.ObjectWrapper; import org.apache.freemarker.core.model.TemplateCollectionModel; import org.apache.freemarker.core.model.TemplateHashModelEx; import org.apache.freemarker.core.model.TemplateHashModelEx2; import org.apache.freemarker.core.model.TemplateModel; import org.apache.freemarker.core.model.TemplateModelException; -import org.apache.freemarker.core.model.TemplateModelWithAPISupport; -import org.apache.freemarker.core.model.WrapperTemplateModel; import org.apache.freemarker.core.model.WrappingTemplateModel; -import org.apache.freemarker.core.model.TemplateHashModelEx2.KeyValuePairIterator; import org.apache.freemarker.core.model.impl.DefaultMapAdapter; import org.apache.freemarker.core.model.impl.DefaultObjectWrapperBuilder; -import org.apache.freemarker.core.model.impl.MapKeyValuePairIterator; import org.apache.freemarker.core.model.impl.SimpleCollection; import org.apache.freemarker.core.model.impl.SimpleHash; import org.apache.freemarker.core.model.impl.beans.BeansWrapperBuilder; -import org.apache.freemarker.core.util.ObjectWrapperWithAPISupport; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @SuppressWarnings("boxing") http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/templatesuite/models/OverloadedMethods.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/templatesuite/models/OverloadedMethods.java b/src/test/java/org/apache/freemarker/test/templatesuite/models/OverloadedMethods.java index 4ae1d37..6732d31 100644 --- a/src/test/java/org/apache/freemarker/test/templatesuite/models/OverloadedMethods.java +++ b/src/test/java/org/apache/freemarker/test/templatesuite/models/OverloadedMethods.java @@ -26,7 +26,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; /** * For testing overloaded method selection. @@ -149,9 +149,9 @@ public class OverloadedMethods { if (value == null) { return "null"; } else if (value instanceof Character) { - return "'" + StringUtil.FTLStringLiteralEnc(value.toString()) + "'"; + return "'" + _StringUtil.FTLStringLiteralEnc(value.toString()) + "'"; } else if (value instanceof String) { - return "\"" + StringUtil.FTLStringLiteralEnc((String) value) + "\""; + return "\"" + _StringUtil.FTLStringLiteralEnc((String) value) + "\""; } else if (value instanceof Map) { StringBuilder sb = new StringBuilder(); sb.append("{"); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/templatesuite/models/OverloadedMethods2.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/templatesuite/models/OverloadedMethods2.java b/src/test/java/org/apache/freemarker/test/templatesuite/models/OverloadedMethods2.java index f36a85f..497631c 100644 --- a/src/test/java/org/apache/freemarker/test/templatesuite/models/OverloadedMethods2.java +++ b/src/test/java/org/apache/freemarker/test/templatesuite/models/OverloadedMethods2.java @@ -38,7 +38,7 @@ import org.apache.freemarker.core.model.TemplateModelException; import org.apache.freemarker.core.model.TemplateNumberModel; import org.apache.freemarker.core.model.WrapperTemplateModel; import org.apache.freemarker.core.model.impl.beans.RationalNumber; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; import org.apache.freemarker.test.util.TestUtil; public class OverloadedMethods2 { @@ -321,15 +321,15 @@ public class OverloadedMethods2 { } public String varargs1(String s, int... xs) { - return "varargs1(String s = " + StringUtil.jQuote(s) + ", int... xs = " + TestUtil.arrayToString(xs) + ")"; + return "varargs1(String s = " + _StringUtil.jQuote(s) + ", int... xs = " + TestUtil.arrayToString(xs) + ")"; } public String varargs1(String s, double... xs) { - return "varargs1(String s = " + StringUtil.jQuote(s) + ", double... xs = " + TestUtil.arrayToString(xs) + ")"; + return "varargs1(String s = " + _StringUtil.jQuote(s) + ", double... xs = " + TestUtil.arrayToString(xs) + ")"; } public String varargs1(String s, Object... xs) { - return "varargs1(String s = " + StringUtil.jQuote(s) + ", Object... xs = " + TestUtil.arrayToString(xs) + ")"; + return "varargs1(String s = " + _StringUtil.jQuote(s) + ", Object... xs = " + TestUtil.arrayToString(xs) + ")"; } public String varargs1(Object s, Object... xs) { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/util/AssertDirective.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/util/AssertDirective.java b/src/test/java/org/apache/freemarker/test/util/AssertDirective.java index 59c7069..21eae28 100644 --- a/src/test/java/org/apache/freemarker/test/util/AssertDirective.java +++ b/src/test/java/org/apache/freemarker/test/util/AssertDirective.java @@ -29,7 +29,7 @@ import org.apache.freemarker.core.model.TemplateBooleanModel; import org.apache.freemarker.core.model.TemplateDirectiveBody; import org.apache.freemarker.core.model.TemplateDirectiveModel; import org.apache.freemarker.core.model.TemplateModel; -import org.apache.freemarker.core.util.ClassUtil; +import org.apache.freemarker.core.util._ClassUtil; public class AssertDirective implements TemplateDirectiveModel { @@ -58,7 +58,7 @@ public class AssertDirective implements TemplateDirectiveModel { if (!(test instanceof TemplateBooleanModel)) { throw new AssertationFailedInTemplateException("Assertion failed:\n" - + "The value had to be boolean, but it was of type" + ClassUtil.getFTLTypeDescription(test), + + "The value had to be boolean, but it was of type" + _ClassUtil.getFTLTypeDescription(test), env); } if (!((TemplateBooleanModel) test).getAsBoolean()) { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/util/AssertEqualsDirective.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/util/AssertEqualsDirective.java b/src/test/java/org/apache/freemarker/test/util/AssertEqualsDirective.java index c6a038f..6db7315 100644 --- a/src/test/java/org/apache/freemarker/test/util/AssertEqualsDirective.java +++ b/src/test/java/org/apache/freemarker/test/util/AssertEqualsDirective.java @@ -33,7 +33,7 @@ import org.apache.freemarker.core.model.TemplateModel; import org.apache.freemarker.core.model.TemplateModelException; import org.apache.freemarker.core.model.TemplateNumberModel; import org.apache.freemarker.core.model.TemplateScalarModel; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; public class AssertEqualsDirective implements TemplateDirectiveModel { @@ -81,7 +81,7 @@ public class AssertEqualsDirective implements TemplateDirectiveModel { // This is the same order as comparison goes: else if (value instanceof TemplateNumberModel) return ((TemplateNumberModel) value).getAsNumber().toString(); else if (value instanceof TemplateDateModel) return ((TemplateDateModel) value).getAsDate().toString(); - else if (value instanceof TemplateScalarModel) return StringUtil.jQuote(((TemplateScalarModel) value).getAsString()); + else if (value instanceof TemplateScalarModel) return _StringUtil.jQuote(((TemplateScalarModel) value).getAsString()); else if (value instanceof TemplateBooleanModel) return String.valueOf(((TemplateBooleanModel) value).getAsBoolean()); // This shouldn't be reached, as the comparison should have failed earlier: else return value.toString(); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/util/AssertFailsDirective.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/util/AssertFailsDirective.java b/src/test/java/org/apache/freemarker/test/util/AssertFailsDirective.java index 44dff17..6fba620 100644 --- a/src/test/java/org/apache/freemarker/test/util/AssertFailsDirective.java +++ b/src/test/java/org/apache/freemarker/test/util/AssertFailsDirective.java @@ -31,8 +31,8 @@ import org.apache.freemarker.core.model.TemplateModel; import org.apache.freemarker.core.model.TemplateModelException; import org.apache.freemarker.core.model.TemplateNumberModel; import org.apache.freemarker.core.model.TemplateScalarModel; -import org.apache.freemarker.core.util.NullWriter; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._NullWriter; +import org.apache.freemarker.core.util._StringUtil; public class AssertFailsDirective implements TemplateDirectiveModel { @@ -72,7 +72,7 @@ public class AssertFailsDirective implements TemplateDirectiveModel { if (body != null) { boolean blockFailed; try { - body.render(NullWriter.INSTANCE); + body.render(_NullWriter.INSTANCE); blockFailed = false; } catch (Throwable e) { blockFailed = true; @@ -93,7 +93,7 @@ public class AssertFailsDirective implements TemplateDirectiveModel { if (e.getMessage() == null) { throw new AssertationFailedInTemplateException( "Failure is not like expected. The exception message was null, " - + "and thus it doesn't contain:\n" + StringUtil.jQuote(message) + ".", + + "and thus it doesn't contain:\n" + _StringUtil.jQuote(message) + ".", env); } if (message != null) { @@ -101,16 +101,16 @@ public class AssertFailsDirective implements TemplateDirectiveModel { ? ((TemplateException) e).getMessageWithoutStackTop() : e.getMessage(); if (actualMessage.toLowerCase().indexOf(message.toLowerCase()) == -1) { throw new AssertationFailedInTemplateException( - "Failure is not like expected. The exception message:\n" + StringUtil.jQuote(actualMessage) - + "\ndoesn't contain:\n" + StringUtil.jQuote(message) + ".", + "Failure is not like expected. The exception message:\n" + _StringUtil.jQuote(actualMessage) + + "\ndoesn't contain:\n" + _StringUtil.jQuote(message) + ".", env); } } if (messageRegexp != null) { if (!messageRegexp.matcher(e.getMessage()).find()) { throw new AssertationFailedInTemplateException( - "Failure is not like expected. The exception message:\n" + StringUtil.jQuote(e.getMessage()) - + "\ndoesn't match this regexp:\n" + StringUtil.jQuote(messageRegexp.toString()) + "Failure is not like expected. The exception message:\n" + _StringUtil.jQuote(e.getMessage()) + + "\ndoesn't match this regexp:\n" + _StringUtil.jQuote(messageRegexp.toString()) + ".", env); } @@ -118,8 +118,8 @@ public class AssertFailsDirective implements TemplateDirectiveModel { } if (exception != null && e.getClass().getName().indexOf(exception) == -1) { throw new AssertationFailedInTemplateException( - "Failure is not like expected. The exception class name " + StringUtil.jQuote(e.getClass().getName()) - + " doesn't contain " + StringUtil.jQuote(message) + ".", + "Failure is not like expected. The exception class name " + _StringUtil.jQuote(e.getClass().getName()) + + " doesn't contain " + _StringUtil.jQuote(message) + ".", env); } } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/util/BadParameterTypeException.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/util/BadParameterTypeException.java b/src/test/java/org/apache/freemarker/test/util/BadParameterTypeException.java index 149b04e..dbdd77e 100644 --- a/src/test/java/org/apache/freemarker/test/util/BadParameterTypeException.java +++ b/src/test/java/org/apache/freemarker/test/util/BadParameterTypeException.java @@ -21,7 +21,7 @@ package org.apache.freemarker.test.util; import org.apache.freemarker.core.ast.Environment; import org.apache.freemarker.core.model.TemplateModel; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; /** * Indicates that a named directive/function parameter is not of the expected type. @@ -46,9 +46,9 @@ public class BadParameterTypeException extends ParameterException { public BadParameterTypeException( String parameterName, String expectedType, TemplateModel value, String description, Exception cause, Environment env) { super(parameterName, - "The type of the parameter " + StringUtil.jQuote(parameterName) + " should be " + expectedType + "The type of the parameter " + _StringUtil.jQuote(parameterName) + " should be " + expectedType + ", but the actual value was " + getTypeDescription(value) + "." - + (description != null ? " " + StringUtil.jQuote(description) : ""), + + (description != null ? " " + _StringUtil.jQuote(description) : ""), cause, env); } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/util/FileTestCase.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/util/FileTestCase.java b/src/test/java/org/apache/freemarker/test/util/FileTestCase.java index bc4a0f7..ac8c86d 100644 --- a/src/test/java/org/apache/freemarker/test/util/FileTestCase.java +++ b/src/test/java/org/apache/freemarker/test/util/FileTestCase.java @@ -31,7 +31,7 @@ import java.io.Reader; import java.io.Writer; import java.net.URL; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import junit.framework.AssertionFailedError; @@ -102,7 +102,7 @@ public abstract class FileTestCase extends TestCase { } private String normalizeNewLines(String s) { - return StringUtil.replace(s, "\r\n", "\n").replace('\r', '\n'); + return _StringUtil.replace(s, "\r\n", "\n").replace('\r', '\n'); } private void saveString(File actualFile, String actualContents) throws IOException { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/util/MissingRequiredParameterException.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/util/MissingRequiredParameterException.java b/src/test/java/org/apache/freemarker/test/util/MissingRequiredParameterException.java index 8b3c306..cdd818f 100644 --- a/src/test/java/org/apache/freemarker/test/util/MissingRequiredParameterException.java +++ b/src/test/java/org/apache/freemarker/test/util/MissingRequiredParameterException.java @@ -20,7 +20,7 @@ package org.apache.freemarker.test.util; import org.apache.freemarker.core.ast.Environment; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; /** * Indicates that a named directive/function parameter is missing. @@ -42,9 +42,9 @@ class MissingRequiredParameterException extends ParameterException { public MissingRequiredParameterException(String parameterName, String description, Exception cause, Environment env) { super(parameterName, - "Required parameter " + StringUtil.jQuote(parameterName) + " is missing, " + "Required parameter " + _StringUtil.jQuote(parameterName) + " is missing, " + "or the parameter value was null." - + (description != null ? " " + StringUtil.jQuote(description) : ""), + + (description != null ? " " + _StringUtil.jQuote(description) : ""), cause, env); } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/util/NoOutputDirective.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/util/NoOutputDirective.java b/src/test/java/org/apache/freemarker/test/util/NoOutputDirective.java index c40cd62..9e047ab 100644 --- a/src/test/java/org/apache/freemarker/test/util/NoOutputDirective.java +++ b/src/test/java/org/apache/freemarker/test/util/NoOutputDirective.java @@ -28,7 +28,7 @@ import org.apache.freemarker.core.model.TemplateDirectiveBody; import org.apache.freemarker.core.model.TemplateDirectiveModel; import org.apache.freemarker.core.model.TemplateModel; import org.apache.freemarker.core.model.TemplateModelException; -import org.apache.freemarker.core.util.NullWriter; +import org.apache.freemarker.core.util._NullWriter; public class NoOutputDirective implements TemplateDirectiveModel { @@ -43,7 +43,7 @@ public class NoOutputDirective implements TemplateDirectiveModel { if (!params.isEmpty()) { throw new TemplateModelException("This directivey doesn't support any parameters."); } - body.render(NullWriter.INSTANCE); + body.render(_NullWriter.INSTANCE); } } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5d9575f/src/test/java/org/apache/freemarker/test/util/UnsupportedParameterException.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/freemarker/test/util/UnsupportedParameterException.java b/src/test/java/org/apache/freemarker/test/util/UnsupportedParameterException.java index 81744ce..0ec1ea7 100644 --- a/src/test/java/org/apache/freemarker/test/util/UnsupportedParameterException.java +++ b/src/test/java/org/apache/freemarker/test/util/UnsupportedParameterException.java @@ -20,7 +20,7 @@ package org.apache.freemarker.test.util; import org.apache.freemarker.core.ast.Environment; -import org.apache.freemarker.core.util.StringUtil; +import org.apache.freemarker.core.util._StringUtil; /** * Indicates that a named directive/function parameter is unsupported (like a typo). @@ -42,8 +42,8 @@ class UnsupportedParameterException extends ParameterException { public UnsupportedParameterException(String parameterName, String description, Exception cause, Environment env) { super(parameterName, - "Unsuppored parameter: " + StringUtil.jQuote(parameterName) - + (description == null ? "." : ". " + StringUtil.jQuote(description)), + "Unsuppored parameter: " + _StringUtil.jQuote(parameterName) + + (description == null ? "." : ". " + _StringUtil.jQuote(description)), cause, env); }
