You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2017/08/08 17:56:52 UTC
[02/17] incubator-freemarker git commit: Renamed XxxUtil classes to
XxxUtils, as this convention is more widespread nowadays.
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-dom/src/main/java/org/apache/freemarker/dom/DomStringUtil.java
----------------------------------------------------------------------
diff --git a/freemarker-dom/src/main/java/org/apache/freemarker/dom/DomStringUtil.java b/freemarker-dom/src/main/java/org/apache/freemarker/dom/DomStringUtil.java
deleted file mode 100644
index f5b58f8..0000000
--- a/freemarker-dom/src/main/java/org/apache/freemarker/dom/DomStringUtil.java
+++ /dev/null
@@ -1,67 +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.dom;
-
-/**
- * For internal use only; don't depend on this, there's no backward compatibility guarantee at all!
- * This class is to work around the lack of module system in Java, i.e., so that other FreeMarker packages can
- * access things inside this package that users shouldn't.
- */
-final class DomStringUtil {
-
- private DomStringUtil() {
- // Not meant to be instantiated
- }
-
- static boolean isXMLNameLike(String name) {
- return isXMLNameLike(name, 0);
- }
-
- /**
- * Check if the name looks like an XML element name.
- *
- * @param firstCharIdx The index of the character in the string parameter that we treat as the beginning of the
- * string to check. This is to spare substringing that has become more expensive in Java 7.
- *
- * @return whether the name is a valid XML element name. (This routine might only be 99% accurate. REVISIT)
- */
- static boolean isXMLNameLike(String name, int firstCharIdx) {
- int ln = name.length();
- for (int i = firstCharIdx; i < ln; i++) {
- char c = name.charAt(i);
- if (i == firstCharIdx && (c == '-' || c == '.' || Character.isDigit(c))) {
- return false;
- }
- if (!Character.isLetterOrDigit(c) && c != '_' && c != '-' && c != '.') {
- if (c == ':') {
- if (i + 1 < ln && name.charAt(i + 1) == ':') {
- // "::" is used in XPath
- return false;
- }
- // We don't return here, as a lonely ":" is allowed.
- } else {
- return false;
- }
- }
- }
- return true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-dom/src/main/java/org/apache/freemarker/dom/DomStringUtils.java
----------------------------------------------------------------------
diff --git a/freemarker-dom/src/main/java/org/apache/freemarker/dom/DomStringUtils.java b/freemarker-dom/src/main/java/org/apache/freemarker/dom/DomStringUtils.java
new file mode 100644
index 0000000..b796c1e
--- /dev/null
+++ b/freemarker-dom/src/main/java/org/apache/freemarker/dom/DomStringUtils.java
@@ -0,0 +1,67 @@
+/*
+ * 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.dom;
+
+/**
+ * For internal use only; don't depend on this, there's no backward compatibility guarantee at all!
+ * This class is to work around the lack of module system in Java, i.e., so that other FreeMarker packages can
+ * access things inside this package that users shouldn't.
+ */
+final class DomStringUtils {
+
+ private DomStringUtils() {
+ // Not meant to be instantiated
+ }
+
+ static boolean isXMLNameLike(String name) {
+ return isXMLNameLike(name, 0);
+ }
+
+ /**
+ * Check if the name looks like an XML element name.
+ *
+ * @param firstCharIdx The index of the character in the string parameter that we treat as the beginning of the
+ * string to check. This is to spare substringing that has become more expensive in Java 7.
+ *
+ * @return whether the name is a valid XML element name. (This routine might only be 99% accurate. REVISIT)
+ */
+ static boolean isXMLNameLike(String name, int firstCharIdx) {
+ int ln = name.length();
+ for (int i = firstCharIdx; i < ln; i++) {
+ char c = name.charAt(i);
+ if (i == firstCharIdx && (c == '-' || c == '.' || Character.isDigit(c))) {
+ return false;
+ }
+ if (!Character.isLetterOrDigit(c) && c != '_' && c != '-' && c != '.') {
+ if (c == ':') {
+ if (i + 1 < ln && name.charAt(i + 1) == ':') {
+ // "::" is used in XPath
+ return false;
+ }
+ // We don't return here, as a lonely ":" is allowed.
+ } else {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-dom/src/main/java/org/apache/freemarker/dom/ElementModel.java
----------------------------------------------------------------------
diff --git a/freemarker-dom/src/main/java/org/apache/freemarker/dom/ElementModel.java b/freemarker-dom/src/main/java/org/apache/freemarker/dom/ElementModel.java
index 220f414..5e9de70 100644
--- a/freemarker-dom/src/main/java/org/apache/freemarker/dom/ElementModel.java
+++ b/freemarker-dom/src/main/java/org/apache/freemarker/dom/ElementModel.java
@@ -28,7 +28,7 @@ import org.apache.freemarker.core.model.TemplateModelException;
import org.apache.freemarker.core.model.TemplateScalarModel;
import org.apache.freemarker.core.model.TemplateSequenceModel;
import org.apache.freemarker.core.model.impl.SimpleScalar;
-import org.apache.freemarker.core.util._StringUtil;
+import org.apache.freemarker.core.util._StringUtils;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -104,7 +104,7 @@ class ElementModel extends NodeModel implements TemplateScalarModel {
return super.get(key);
}
} else { // Starts with "@", but not with "@@"
- if (DomStringUtil.isXMLNameLike(key, 1)) {
+ if (DomStringUtils.isXMLNameLike(key, 1)) {
Attr att = getAttribute(key.substring(1));
if (att == null) {
return new NodeListModel(this);
@@ -117,7 +117,7 @@ class ElementModel extends NodeModel implements TemplateScalarModel {
return super.get(key);
}
}
- } else if (DomStringUtil.isXMLNameLike(key)) {
+ } else if (DomStringUtils.isXMLNameLike(key)) {
// We interpret key as an element name
NodeListModel result = ((NodeListModel) getChildNodes()).filterByName(key);
return result.size() != 1 ? result : result.get(0);
@@ -229,6 +229,6 @@ class ElementModel extends NodeModel implements TemplateScalarModel {
}
boolean matchesName(String name, Environment env) {
- return _StringUtil.matchesQName(name, getNodeName(), getNodeNamespace(), env);
+ return _StringUtils.matchesQName(name, getNodeName(), getNodeNamespace(), env);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeListModel.java
----------------------------------------------------------------------
diff --git a/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeListModel.java b/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeListModel.java
index 333bb5c..ab7d701 100644
--- a/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeListModel.java
+++ b/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeListModel.java
@@ -137,9 +137,9 @@ class NodeListModel extends SimpleSequence implements TemplateHashModel, _Unexpe
}
}
}
- if (DomStringUtil.isXMLNameLike(key)
+ if (DomStringUtils.isXMLNameLike(key)
|| ((key.startsWith("@")
- && (DomStringUtil.isXMLNameLike(key, 1) || key.equals("@@") || key.equals("@*"))))
+ && (DomStringUtils.isXMLNameLike(key, 1) || key.equals("@@") || key.equals("@*"))))
|| key.equals("*") || key.equals("**")) {
NodeListModel result = new NodeListModel(contextNode);
for (int i = 0; i < size(); i++) {
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeOutputter.java
----------------------------------------------------------------------
diff --git a/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeOutputter.java b/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeOutputter.java
index bda38ac..7b543f4 100644
--- a/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeOutputter.java
+++ b/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeOutputter.java
@@ -25,7 +25,7 @@ import java.util.LinkedHashMap;
import org.apache.freemarker.core.Environment;
import org.apache.freemarker.core.Template;
import org.apache.freemarker.core.util.BugException;
-import org.apache.freemarker.core.util._StringUtil;
+import org.apache.freemarker.core.util._StringUtils;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
@@ -78,7 +78,7 @@ class NodeOutputter {
if (prefix == null) {
// Assign a generated prefix:
do {
- prefix = _StringUtil.toLowerABC(nextGeneratedPrefixNumber++);
+ prefix = _StringUtils.toLowerABC(nextGeneratedPrefixNumber++);
} while (env.getNamespaceForPrefix(prefix) != null);
}
}
@@ -150,7 +150,7 @@ class NodeOutputter {
buf.append(' ');
outputQualifiedName(n, buf);
buf.append("=\"")
- .append(_StringUtil.XMLEncQAttr(n.getNodeValue()))
+ .append(_StringUtils.XMLEncQAttr(n.getNodeValue()))
.append('"');
}
break;
@@ -216,7 +216,7 @@ class NodeOutputter {
}*/
case Node.CDATA_SECTION_NODE:
case Node.TEXT_NODE: {
- buf.append(_StringUtil.XMLEncNQG(n.getNodeValue()));
+ buf.append(_StringUtils.XMLEncNQG(n.getNodeValue()));
break;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-dom/src/test/java/org/apache/freemarker/dom/test/DOMLoader.java
----------------------------------------------------------------------
diff --git a/freemarker-dom/src/test/java/org/apache/freemarker/dom/test/DOMLoader.java b/freemarker-dom/src/test/java/org/apache/freemarker/dom/test/DOMLoader.java
index bc957c5..cbb06e5 100644
--- a/freemarker-dom/src/test/java/org/apache/freemarker/dom/test/DOMLoader.java
+++ b/freemarker-dom/src/test/java/org/apache/freemarker/dom/test/DOMLoader.java
@@ -30,7 +30,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.apache.freemarker.core.util._StringUtil;
+import org.apache.freemarker.core.util._StringUtils;
import org.apache.freemarker.dom.NodeModel;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -89,7 +89,7 @@ public final class DOMLoader {
InputStream in = baseClass.getResourceAsStream(resourcePath);
if (in == null) {
throw new FileNotFoundException("Class loader resource not found: baseClass=" + baseClass.getName()
- + "; path=" + _StringUtil.jQuote(resourcePath));
+ + "; path=" + _StringUtils.jQuote(resourcePath));
}
return toModel(new InputSource(in));
}
@@ -121,7 +121,7 @@ public final class DOMLoader {
InputStream in = baseClass.getResourceAsStream(resourcePath);
if (in == null) {
throw new FileNotFoundException("Class loader resource not found: baseClass="
- + baseClass.getName() + "; " + "path=" + _StringUtil.jQuote(resourcePath));
+ + baseClass.getName() + "; " + "path=" + _StringUtils.jQuote(resourcePath));
}
return builder.parse(new InputSource(in));
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/BaseNTemplateNumberFormatFactory.java
----------------------------------------------------------------------
diff --git a/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/BaseNTemplateNumberFormatFactory.java b/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/BaseNTemplateNumberFormatFactory.java
index f987dcd..a670b62 100644
--- a/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/BaseNTemplateNumberFormatFactory.java
+++ b/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/BaseNTemplateNumberFormatFactory.java
@@ -23,8 +23,8 @@ import java.util.Locale;
import org.apache.freemarker.core.Environment;
import org.apache.freemarker.core.model.TemplateModelException;
import org.apache.freemarker.core.model.TemplateNumberModel;
-import org.apache.freemarker.core.util._NumberUtil;
-import org.apache.freemarker.core.util._StringUtil;
+import org.apache.freemarker.core.util._NumberUtils;
+import org.apache.freemarker.core.util._StringUtils;
import org.apache.freemarker.core.valueformat.InvalidFormatParametersException;
import org.apache.freemarker.core.valueformat.TemplateFormatUtil;
import org.apache.freemarker.core.valueformat.TemplateNumberFormat;
@@ -60,7 +60,7 @@ public class BaseNTemplateNumberFormatFactory extends TemplateNumberFormatFactor
} catch (TemplateValueFormatException e) {
throw new InvalidFormatParametersException(
"Couldn't get the fallback number format (specified after the \"|\"), "
- + _StringUtil.jQuote(fallbackFormatStr) + ". Reason: " + e.getMessage(),
+ + _StringUtils.jQuote(fallbackFormatStr) + ". Reason: " + e.getMessage(),
e);
}
} else {
@@ -78,7 +78,7 @@ public class BaseNTemplateNumberFormatFactory extends TemplateNumberFormatFactor
}
throw new InvalidFormatParametersException(
"The format paramter must be an integer, but was (shown quoted): "
- + _StringUtil.jQuote(params));
+ + _StringUtils.jQuote(params));
}
if (base < 2) {
throw new InvalidFormatParametersException("A base must be at least 2.");
@@ -101,7 +101,7 @@ public class BaseNTemplateNumberFormatFactory extends TemplateNumberFormatFactor
throws TemplateModelException, TemplateValueFormatException {
Number n = TemplateFormatUtil.getNonNullNumber(numberModel);
try {
- return Integer.toString(_NumberUtil.toIntExact(n), base);
+ return Integer.toString(_NumberUtils.toIntExact(n), base);
} catch (ArithmeticException e) {
if (fallbackFormat == null) {
throw new UnformattableValueException(
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/TemplateConfigurationExamples.java
----------------------------------------------------------------------
diff --git a/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/TemplateConfigurationExamples.java b/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/TemplateConfigurationExamples.java
index 078e4db..d1b5e3e 100644
--- a/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/TemplateConfigurationExamples.java
+++ b/freemarker-manual/src/test/java/org/apache/freemarker/manual/examples/TemplateConfigurationExamples.java
@@ -37,7 +37,7 @@ import org.apache.freemarker.core.templateresolver.FirstMatchTemplateConfigurati
import org.apache.freemarker.core.templateresolver.MergingTemplateConfigurationFactory;
import org.apache.freemarker.core.templateresolver.OrMatcher;
import org.apache.freemarker.core.templateresolver.PathGlobMatcher;
-import org.apache.freemarker.core.util._DateUtil;
+import org.apache.freemarker.core.util._DateUtils;
import org.apache.freemarker.test.TemplateTest;
import org.apache.freemarker.test.TestConfigurationBuilder;
import org.junit.Test;
@@ -144,7 +144,7 @@ public class TemplateConfigurationExamples extends TemplateTest {
.dateTimeFormat("iso")
.dateFormat("iso")
.timeFormat("iso")
- .timeZone(_DateUtil.UTC)
+ .timeZone(_DateUtils.UTC)
.build()),
new ConditionalTemplateConfigurationFactory(
new PathGlobMatcher("mail/**"),
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java
index 181d0ab..2121720 100644
--- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java
+++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java
@@ -61,9 +61,9 @@ import org.apache.freemarker.core.templateresolver.TemplateLoader;
import org.apache.freemarker.core.templateresolver.impl.ClassTemplateLoader;
import org.apache.freemarker.core.templateresolver.impl.FileTemplateLoader;
import org.apache.freemarker.core.templateresolver.impl.MultiTemplateLoader;
-import org.apache.freemarker.core.util._CollectionUtil;
-import org.apache.freemarker.core.util._SecurityUtil;
-import org.apache.freemarker.core.util._StringUtil;
+import org.apache.freemarker.core.util._CollectionUtils;
+import org.apache.freemarker.core.util._SecurityUtils;
+import org.apache.freemarker.core.util._StringUtils;
import org.apache.freemarker.servlet.jsp.TaglibFactory;
import org.apache.freemarker.servlet.jsp.TaglibFactory.ClasspathMetaInfTldSource;
import org.apache.freemarker.servlet.jsp.TaglibFactory.MetaInfTldSource;
@@ -566,7 +566,7 @@ public class FreemarkerServlet extends HttpServlet {
}
if (value == null) {
throw new MalformedWebXmlException(
- "init-param " + _StringUtil.jQuote(name) + " without param-value. "
+ "init-param " + _StringUtils.jQuote(name) + " without param-value. "
+ "Maybe the web.xml is not well-formed?");
}
@@ -611,16 +611,16 @@ public class FreemarkerServlet extends HttpServlet {
"Not one of the supported values.");
}
} else if (name.equals(INIT_PARAM_NO_CACHE)) {
- noCache = _StringUtil.getYesNo(value);
+ noCache = _StringUtils.getYesNo(value);
} else if (name.equals(INIT_PARAM_BUFFER_SIZE)) {
bufferSize = Integer.valueOf(parseSize(value));
} else if (name.equals(DEPR_INITPARAM_DEBUG)) { // BC
if (getInitParameter(INIT_PARAM_DEBUG) != null) {
throw new ConflictingInitParamsException(INIT_PARAM_DEBUG, DEPR_INITPARAM_DEBUG);
}
- debug = _StringUtil.getYesNo(value);
+ debug = _StringUtils.getYesNo(value);
} else if (name.equals(INIT_PARAM_DEBUG)) {
- debug = _StringUtil.getYesNo(value);
+ debug = _StringUtils.getYesNo(value);
} else if (name.equals(INIT_PARAM_CONTENT_TYPE)) {
contentType = new ContentType(value);
} else if (name.equals(INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE)) {
@@ -634,7 +634,7 @@ public class FreemarkerServlet extends HttpServlet {
} else if (name.equals(INIT_PARAM_OVERRIDE_RESPONSE_LOCALE)) {
overrideResponseLocale = initParamValueToEnum(value, OverrideResponseLocale.values());
} else if (name.equals(INIT_PARAM_EXCEPTION_ON_MISSING_TEMPLATE)) {
- exceptionOnMissingTemplate = _StringUtil.getYesNo(value);
+ exceptionOnMissingTemplate = _StringUtils.getYesNo(value);
} else if (name.equals(INIT_PARAM_META_INF_TLD_LOCATIONS)) {
metaInfTldSources = TaglibFactory.parseMetaInfTldLocations(InitParamParser.parseCommaSeparatedList(value));
} else if (name.equals(INIT_PARAM_CLASSPATH_TLDS)) {
@@ -722,7 +722,7 @@ public class FreemarkerServlet extends HttpServlet {
String templatePath = requestUrlToTemplatePath(request);
if (LOG.isDebugEnabled()) {
- LOG.debug("Requested template " + _StringUtil.jQuoteNoXSS(templatePath) + ".");
+ LOG.debug("Requested template " + _StringUtils.jQuoteNoXSS(templatePath) + ".");
}
Locale locale = request.getLocale();
@@ -736,21 +736,21 @@ public class FreemarkerServlet extends HttpServlet {
} catch (TemplateNotFoundException e) {
if (exceptionOnMissingTemplate) {
throw newServletExceptionWithFreeMarkerLogging(
- "Template not found for name " + _StringUtil.jQuoteNoXSS(templatePath) + ".", e);
+ "Template not found for name " + _StringUtils.jQuoteNoXSS(templatePath) + ".", e);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Responding HTTP 404 \"Not found\" for missing template "
- + _StringUtil.jQuoteNoXSS(templatePath) + ".", e);
+ + _StringUtils.jQuoteNoXSS(templatePath) + ".", e);
}
response.sendError(HttpServletResponse.SC_NOT_FOUND, "Page template not found");
return;
}
} catch (org.apache.freemarker.core.ParseException e) {
throw newServletExceptionWithFreeMarkerLogging(
- "Parsing error with template " + _StringUtil.jQuoteNoXSS(templatePath) + ".", e);
+ "Parsing error with template " + _StringUtils.jQuoteNoXSS(templatePath) + ".", e);
} catch (Exception e) {
throw newServletExceptionWithFreeMarkerLogging(
- "Unexpected error when loading template " + _StringUtil.jQuoteNoXSS(templatePath) + ".", e);
+ "Unexpected error when loading template " + _StringUtils.jQuoteNoXSS(templatePath) + ".", e);
}
boolean tempSpecContentTypeContainsCharset = false;
@@ -810,7 +810,7 @@ public class FreemarkerServlet extends HttpServlet {
throw new IllegalStateException(
"Failed to resolve charset name returned by "
+ " HttpServletResponse.getCharacterEncoding(): "
- + _StringUtil.jQuote(actualOutputCharsetName),
+ + _StringUtils.jQuote(actualOutputCharsetName),
e);
}
env.setOutputEncoding(actualOutputCharset);
@@ -1001,7 +1001,7 @@ public class FreemarkerServlet extends HttpServlet {
List<MetaInfTldSource> metaInfTldSourcesFromSysProp = null;
try {
- final String prop = _SecurityUtil.getSystemProperty(SYSTEM_PROPERTY_META_INF_TLD_SOURCES, null);
+ final String prop = _SecurityUtils.getSystemProperty(SYSTEM_PROPERTY_META_INF_TLD_SOURCES, null);
metaInfTldSourcesFromSysProp = (List<MetaInfTldSource>) ((prop != null)
? TaglibFactory.parseMetaInfTldLocations(InitParamParser.parseCommaSeparatedList(prop))
: Collections.emptyList());
@@ -1026,7 +1026,7 @@ public class FreemarkerServlet extends HttpServlet {
List<String> classpathTldsFromSysProp = null;
try {
- final String prop = _SecurityUtil.getSystemProperty(SYSTEM_PROPERTY_CLASSPATH_TLDS, null);
+ final String prop = _SecurityUtils.getSystemProperty(SYSTEM_PROPERTY_CLASSPATH_TLDS, null);
classpathTldsFromSysProp = (prop != null) ? InitParamParser.parseCommaSeparatedList(prop)
: Collections.<String>emptyList();
} catch (ParseException e) {
@@ -1035,10 +1035,10 @@ public class FreemarkerServlet extends HttpServlet {
}
return new TaglibFactory.Builder(servletContext, objectWrapper)
- .metaInfTldSources(_CollectionUtil.mergeImmutableLists(true, metaInfTldSources,
+ .metaInfTldSources(_CollectionUtils.mergeImmutableLists(true, metaInfTldSources,
metaInfTldSourcesFromSysProp, jettyMetaInfTldSources))
.classpathTlds(
- _CollectionUtil.mergeImmutableLists(classpathTlds, classpathTldsFromSysProp, true))
+ _CollectionUtils.mergeImmutableLists(classpathTlds, classpathTldsFromSysProp, true))
.build();
}
@@ -1329,14 +1329,14 @@ public class FreemarkerServlet extends HttpServlet {
private static class InitParamValueException extends Exception {
InitParamValueException(String initParamName, String initParamValue, Throwable casue) {
- super("Failed to set the " + _StringUtil.jQuote(initParamName) + " servlet init-param to "
- + _StringUtil.jQuote(initParamValue) + "; see cause exception.",
+ super("Failed to set the " + _StringUtils.jQuote(initParamName) + " servlet init-param to "
+ + _StringUtils.jQuote(initParamValue) + "; see cause exception.",
casue);
}
public InitParamValueException(String initParamName, String initParamValue, String cause) {
- super("Failed to set the " + _StringUtil.jQuote(initParamName) + " servlet init-param to "
- + _StringUtil.jQuote(initParamValue) + ": " + cause);
+ super("Failed to set the " + _StringUtils.jQuote(initParamName) + " servlet init-param to "
+ + _StringUtils.jQuote(initParamValue) + ": " + cause);
}
}
@@ -1346,8 +1346,8 @@ public class FreemarkerServlet extends HttpServlet {
ConflictingInitParamsException(String recommendedName, String otherName) {
super("Conflicting servlet init-params: "
- + _StringUtil.jQuote(recommendedName) + " and " + _StringUtil.jQuote(otherName)
- + ". Only use " + _StringUtil.jQuote(recommendedName) + ".");
+ + _StringUtils.jQuote(recommendedName) + " and " + _StringUtils.jQuote(otherName)
+ + ". Only use " + _StringUtils.jQuote(recommendedName) + ".");
}
}
@@ -1411,7 +1411,7 @@ public class FreemarkerServlet extends HttpServlet {
}
StringBuilder sb = new StringBuilder();
- sb.append(_StringUtil.jQuote(initParamValue));
+ sb.append(_StringUtils.jQuote(initParamValue));
sb.append(" is not a one of the enumeration values: ");
boolean first = true;
for (T value : enumValues) {
@@ -1420,7 +1420,7 @@ public class FreemarkerServlet extends HttpServlet {
} else {
first = false;
}
- sb.append(_StringUtil.jQuote(value.getInitParamValue()));
+ sb.append(_StringUtils.jQuote(value.getInitParamValue()));
}
throw new IllegalArgumentException(sb.toString());
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/InitParamParser.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/InitParamParser.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/InitParamParser.java
index 323e15f..e74d475 100644
--- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/InitParamParser.java
+++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/InitParamParser.java
@@ -33,7 +33,7 @@ import org.apache.freemarker.core.templateresolver.TemplateLoader;
import org.apache.freemarker.core.templateresolver.impl.ClassTemplateLoader;
import org.apache.freemarker.core.templateresolver.impl.FileTemplateLoader;
import org.apache.freemarker.core.templateresolver.impl.MultiTemplateLoader;
-import org.apache.freemarker.core.util._StringUtil;
+import org.apache.freemarker.core.util._StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -127,7 +127,7 @@ final class InitParamParser {
static List<String> parseCommaSeparatedList(String value) throws ParseException {
List<String> valuesList = new ArrayList<>();
- String[] values = _StringUtil.split(value, ',');
+ String[] values = _StringUtils.split(value, ',');
for (int i = 0; i < values.length; i++) {
final String s = values[i].trim();
if (s.length() != 0) {
@@ -243,7 +243,7 @@ final class InitParamParser {
if (!biName.equals(TEMPLATE_PATH_SETTINGS_BI_NAME)) {
throw new TemplatePathParsingException(
- _StringUtil.jQuote(biName) + " is unexpected after the \"?\". "
+ _StringUtils.jQuote(biName) + " is unexpected after the \"?\". "
+ "Expected \"" + TEMPLATE_PATH_SETTINGS_BI_NAME + "\".");
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/WebAppTemplateLoader.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/WebAppTemplateLoader.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/WebAppTemplateLoader.java
index adbc5e0..b72ce78 100644
--- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/WebAppTemplateLoader.java
+++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/WebAppTemplateLoader.java
@@ -38,9 +38,9 @@ import org.apache.freemarker.core.templateresolver.TemplateLoadingResult;
import org.apache.freemarker.core.templateresolver.TemplateLoadingSource;
import org.apache.freemarker.core.templateresolver.impl.URLTemplateLoader;
import org.apache.freemarker.core.templateresolver.impl._TemplateLoaderUtils;
-import org.apache.freemarker.core.util._CollectionUtil;
+import org.apache.freemarker.core.util._CollectionUtils;
import org.apache.freemarker.core.util._NullArgumentException;
-import org.apache.freemarker.core.util._StringUtil;
+import org.apache.freemarker.core.util._StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -119,16 +119,16 @@ public class WebAppTemplateLoader implements TemplateLoader {
@Override
public String toString() {
return _TemplateLoaderUtils.getClassNameForToString(this)
- + "(subdirPath=" + _StringUtil.jQuote(subdirPath)
- + ", servletContext={contextPath=" + _StringUtil.jQuote(getContextPath())
- + ", displayName=" + _StringUtil.jQuote(servletContext.getServletContextName()) + "})";
+ + "(subdirPath=" + _StringUtils.jQuote(subdirPath)
+ + ", servletContext={contextPath=" + _StringUtils.jQuote(getContextPath())
+ + ", displayName=" + _StringUtils.jQuote(servletContext.getServletContextName()) + "})";
}
/** Gets the context path if we are on Servlet 2.5+, or else returns failure description string. */
private String getContextPath() {
try {
- Method m = servletContext.getClass().getMethod("getContextPath", _CollectionUtil.EMPTY_CLASS_ARRAY);
- return (String) m.invoke(servletContext, _CollectionUtil.EMPTY_OBJECT_ARRAY);
+ Method m = servletContext.getClass().getMethod("getContextPath", _CollectionUtils.EMPTY_CLASS_ARRAY);
+ return (String) m.invoke(servletContext, _CollectionUtils.EMPTY_OBJECT_ARRAY);
} catch (Throwable e) {
return "[can't query before Serlvet 2.5]";
}
@@ -221,7 +221,7 @@ public class WebAppTemplateLoader implements TemplateLoader {
url = servletContext.getResource(fullPath);
} catch (MalformedURLException e) {
if (LOG.isWarnEnabled()) {
- LOG.warn("Could not retrieve resource " + _StringUtil.jQuoteNoXSS(fullPath), e);
+ LOG.warn("Could not retrieve resource " + _StringUtils.jQuoteNoXSS(fullPath), e);
}
return null;
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/FreeMarkerJspApplicationContext.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/FreeMarkerJspApplicationContext.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/FreeMarkerJspApplicationContext.java
index 12f0d3c..559c70f 100644
--- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/FreeMarkerJspApplicationContext.java
+++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/FreeMarkerJspApplicationContext.java
@@ -40,7 +40,7 @@ import javax.servlet.jsp.JspApplicationContext;
import javax.servlet.jsp.el.ImplicitObjectELResolver;
import javax.servlet.jsp.el.ScopedAttributeELResolver;
-import org.apache.freemarker.core.util._ClassUtil;
+import org.apache.freemarker.core.util._ClassUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -85,7 +85,7 @@ class FreeMarkerJspApplicationContext implements JspApplicationContext {
private static ExpressionFactory tryExpressionFactoryImplementation(String packagePrefix) {
String className = packagePrefix + ".el.ExpressionFactoryImpl";
try {
- Class cl = _ClassUtil.forName(className);
+ Class cl = _ClassUtils.forName(className);
if (ExpressionFactory.class.isAssignableFrom(cl)) {
LOG.info("Using {} as implementation of {}", className, ExpressionFactory.class.getName());
return (ExpressionFactory) cl.newInstance();
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java
index 01418ba..bf2a433 100644
--- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java
+++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java
@@ -45,7 +45,7 @@ import org.apache.freemarker.core.model.TemplateHashModelEx2;
import org.apache.freemarker.core.model.TemplateModelException;
import org.apache.freemarker.core.model.TemplateScalarModel;
import org.apache.freemarker.core.model.impl.DefaultObjectWrapper;
-import org.apache.freemarker.core.util._StringUtil;
+import org.apache.freemarker.core.util._StringUtils;
import org.apache.freemarker.servlet.jsp.SimpleTagDirectiveModel.TemplateExceptionWrapperJspException;
class JspTagModelBase {
@@ -93,7 +93,7 @@ class JspTagModelBase {
}
} else {
throw new TemplateModelException("Unknown property "
- + _StringUtil.jQuote(paramName.toString())
+ + _StringUtils.jQuote(paramName.toString())
+ " on instance of " + tagClass.getName());
}
} else {
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/JspWriterAdapter.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/JspWriterAdapter.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/JspWriterAdapter.java
index 2136968..8f135c2 100644
--- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/JspWriterAdapter.java
+++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/JspWriterAdapter.java
@@ -24,10 +24,10 @@ import java.io.Writer;
import javax.servlet.jsp.JspWriter;
-import org.apache.freemarker.core.util._SecurityUtil;
+import org.apache.freemarker.core.util._SecurityUtils;
class JspWriterAdapter extends JspWriter {
- static final char[] NEWLINE = _SecurityUtil.getSystemProperty("line.separator", "\n").toCharArray();
+ static final char[] NEWLINE = _SecurityUtils.getSystemProperty("line.separator", "\n").toCharArray();
private final Writer out;
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java
index a1525af..6aaae12 100644
--- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java
+++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java
@@ -72,9 +72,9 @@ import org.apache.freemarker.core.model.TemplateModelException;
import org.apache.freemarker.core.model.impl.DefaultObjectWrapper;
import org.apache.freemarker.core.util.BugException;
import org.apache.freemarker.core.util.CommonBuilder;
-import org.apache.freemarker.core.util._ClassUtil;
+import org.apache.freemarker.core.util._ClassUtils;
import org.apache.freemarker.core.util._NullArgumentException;
-import org.apache.freemarker.core.util._StringUtil;
+import org.apache.freemarker.core.util._StringUtils;
import org.apache.freemarker.servlet.FreemarkerServlet;
import org.apache.freemarker.servlet.HttpRequestHashModel;
import org.slf4j.Logger;
@@ -251,7 +251,7 @@ public class TaglibFactory implements TemplateHashModel {
try {
if (LOG.isDebugEnabled()) {
- LOG.debug("Locating TLD for taglib URI " + _StringUtil.jQuoteNoXSS(taglibUri) + ".");
+ LOG.debug("Locating TLD for taglib URI " + _StringUtils.jQuoteNoXSS(taglibUri) + ".");
}
TldLocation explicitlyMappedTldLocation = getExplicitlyMappedTldLocation(taglibUri);
@@ -267,7 +267,7 @@ public class TaglibFactory implements TemplateHashModel {
try {
urlType = getUriType(taglibUri);
} catch (MalformedURLException e) {
- throw new TaglibGettingException("Malformed taglib URI: " + _StringUtil.jQuote(taglibUri), e);
+ throw new TaglibGettingException("Malformed taglib URI: " + _StringUtils.jQuote(taglibUri), e);
}
if (urlType == URL_TYPE_RELATIVE) {
@@ -279,7 +279,7 @@ public class TaglibFactory implements TemplateHashModel {
String failedTLDsList = getFailedTLDsList();
failedTldListAlreadyIncluded = true;
throw new TaglibGettingException("No TLD was found for the "
- + _StringUtil.jQuoteNoXSS(taglibUri) + " JSP taglib URI. (TLD-s are searched according "
+ + _StringUtils.jQuoteNoXSS(taglibUri) + " JSP taglib URI. (TLD-s are searched according "
+ "the JSP 2.2 specification. In development- and embedded-servlet-container "
+ "setups you may also need the "
+ "\"" + FreemarkerServlet.INIT_PARAM_META_INF_TLD_LOCATIONS + "\" and "
@@ -310,7 +310,7 @@ public class TaglibFactory implements TemplateHashModel {
} catch (Exception e) {
String failedTLDsList = failedTldListAlreadyIncluded ? null : getFailedTLDsList();
throw new TemplateModelException(
- "Error while looking for TLD file for " + _StringUtil.jQuoteNoXSS(taglibUri)
+ "Error while looking for TLD file for " + _StringUtils.jQuoteNoXSS(taglibUri)
+ "; see cause exception."
+ (failedTLDsList == null
? ""
@@ -323,8 +323,8 @@ public class TaglibFactory implements TemplateHashModel {
return loadTaglib(tldLocation, normalizedTaglibUri);
} catch (Exception e) {
throw new TemplateModelException("Error while loading tag library for URI "
- + _StringUtil.jQuoteNoXSS(normalizedTaglibUri) + " from TLD location "
- + _StringUtil.jQuoteNoXSS(tldLocation) + "; see cause exception.",
+ + _StringUtils.jQuoteNoXSS(normalizedTaglibUri) + " from TLD location "
+ + _StringUtils.jQuoteNoXSS(tldLocation) + "; see cause exception.",
e);
}
}
@@ -345,7 +345,7 @@ public class TaglibFactory implements TemplateHashModel {
if (i != 0) {
sb.append(", ");
}
- sb.append(_StringUtil.jQuote(failedTldLocations.get(i)));
+ sb.append(_StringUtils.jQuote(failedTldLocations.get(i)));
}
return sb.toString();
@@ -575,7 +575,7 @@ public class TaglibFactory implements TemplateHashModel {
in = tldLocation.getInputStream();
} catch (IOException e) {
if (LOG.isWarnEnabled()) {
- LOG.warn("Ignored classpath TLD location " + _StringUtil.jQuoteNoXSS(tldResourcePath)
+ LOG.warn("Ignored classpath TLD location " + _StringUtils.jQuoteNoXSS(tldResourcePath)
+ " because of error", e);
}
in = null;
@@ -755,7 +755,7 @@ public class TaglibFactory implements TemplateHashModel {
private void addTldLocationsFromFileDirectory(final File dir) throws IOException, SAXException {
if (dir.isDirectory()) {
if (LOG.isDebugEnabled()) {
- LOG.debug("Scanning for *.tld-s in File directory: " + _StringUtil.jQuoteNoXSS(dir));
+ LOG.debug("Scanning for *.tld-s in File directory: " + _StringUtils.jQuoteNoXSS(dir));
}
File[] tldFiles = dir.listFiles(new FilenameFilter() {
@@ -773,7 +773,7 @@ public class TaglibFactory implements TemplateHashModel {
addTldLocationFromTld(new FileTldLocation(file));
}
} else {
- LOG.warn("Skipped scanning for *.tld for non-existent directory: " + _StringUtil.jQuoteNoXSS(dir));
+ LOG.warn("Skipped scanning for *.tld for non-existent directory: " + _StringUtils.jQuoteNoXSS(dir));
}
}
@@ -822,15 +822,15 @@ public class TaglibFactory implements TemplateHashModel {
private void addTldLocation(TldLocation tldLocation, String taglibUri) {
if (tldLocations.containsKey(taglibUri)) {
if (LOG.isDebugEnabled()) {
- LOG.debug("Ignored duplicate mapping of taglib URI " + _StringUtil.jQuoteNoXSS(taglibUri)
- + " to TLD location " + _StringUtil.jQuoteNoXSS(tldLocation));
+ LOG.debug("Ignored duplicate mapping of taglib URI " + _StringUtils.jQuoteNoXSS(taglibUri)
+ + " to TLD location " + _StringUtils.jQuoteNoXSS(tldLocation));
}
} else {
tldLocations.put(taglibUri, tldLocation);
if (LOG.isDebugEnabled()) {
- LOG.debug("Mapped taglib URI " + _StringUtil.jQuoteNoXSS(taglibUri)
- + " to TLD location " + _StringUtil.jQuoteNoXSS(tldLocation));
+ LOG.debug("Mapped taglib URI " + _StringUtils.jQuoteNoXSS(taglibUri)
+ + " to TLD location " + _StringUtils.jQuoteNoXSS(tldLocation));
}
}
}
@@ -873,8 +873,8 @@ public class TaglibFactory implements TemplateHashModel {
*/
private TemplateHashModel loadTaglib(TldLocation tldLocation, String taglibUri) throws IOException, SAXException {
if (LOG.isDebugEnabled()) {
- LOG.debug("Loading taglib for URI " + _StringUtil.jQuoteNoXSS(taglibUri)
- + " from TLD location " + _StringUtil.jQuoteNoXSS(tldLocation));
+ LOG.debug("Loading taglib for URI " + _StringUtils.jQuoteNoXSS(taglibUri)
+ + " from TLD location " + _StringUtils.jQuoteNoXSS(tldLocation));
}
final Taglib taglib = new Taglib(servletContext, tldLocation, objectWrapper);
@@ -1006,7 +1006,7 @@ public class TaglibFactory implements TemplateHashModel {
}
try {
- return new URL(jarBaseEntryUrl, _StringUtil.URLPathEnc(relativeEntryPath, Charset.defaultCharset()));
+ return new URL(jarBaseEntryUrl, _StringUtils.URLPathEnc(relativeEntryPath, Charset.defaultCharset()));
} catch (UnsupportedEncodingException e) {
throw new BugException();
}
@@ -1107,8 +1107,8 @@ public class TaglibFactory implements TemplateHashModel {
Charset.defaultCharset().name()));
} catch (Exception e) {
LOG.error("Couldn't get URL for serlvetContext resource "
- + _StringUtil.jQuoteNoXSS(servletContextJarFilePath)
- + " / jar entry " + _StringUtil.jQuoteNoXSS(entryPath),
+ + _StringUtils.jQuoteNoXSS(servletContextJarFilePath)
+ + " / jar entry " + _StringUtils.jQuoteNoXSS(entryPath),
e);
return null;
}
@@ -1404,7 +1404,7 @@ public class TaglibFactory implements TemplateHashModel {
while (true) {
final ZipEntry macthedJarEntry = zipIn.getNextEntry();
if (macthedJarEntry == null) {
- throw new IOException("Could not find JAR entry " + _StringUtil.jQuoteNoXSS(entryPath) + ".");
+ throw new IOException("Could not find JAR entry " + _StringUtils.jQuoteNoXSS(entryPath) + ".");
}
if (entryPath.equals(normalizeJarEntryPath(macthedJarEntry.getName(), false))) {
returnedZipIn = true;
@@ -1781,7 +1781,7 @@ public class TaglibFactory implements TemplateHashModel {
customTagModel, (TemplateFunctionModel) replacedTagOrFunction));
} else {
if (LOG.isWarnEnabled()) {
- LOG.warn("TLD contains multiple tags with name " + _StringUtil.jQuote(tagNameCData)
+ LOG.warn("TLD contains multiple tags with name " + _StringUtils.jQuote(tagNameCData)
+ "; keeping only the last one.");
}
}
@@ -1799,13 +1799,13 @@ public class TaglibFactory implements TemplateHashModel {
final Method functionMethod;
try {
- functionMethod = TaglibMethodUtil.getMethodByFunctionSignature(
+ functionMethod = TaglibMethodUtils.getMethodByFunctionSignature(
functionClass, functionSignatureCData);
} catch (Exception e) {
throw new TldParsingSAXException(
- "Error while trying to resolve signature " + _StringUtil.jQuote(functionSignatureCData)
- + " on class " + _StringUtil.jQuote(functionClass.getName())
- + " for custom EL function " + _StringUtil.jQuote(functionNameCData) + ".",
+ "Error while trying to resolve signature " + _StringUtils.jQuote(functionSignatureCData)
+ + " on class " + _StringUtils.jQuote(functionClass.getName())
+ + " for custom EL function " + _StringUtils.jQuote(functionNameCData) + ".",
locator,
e);
}
@@ -1835,7 +1835,7 @@ public class TaglibFactory implements TemplateHashModel {
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("TLD contains multiple functions with name "
- + _StringUtil.jQuote(functionNameCData) + "; keeping only the last one.");
+ + _StringUtils.jQuote(functionNameCData) + "; keeping only the last one.");
}
}
}
@@ -1885,7 +1885,7 @@ public class TaglibFactory implements TemplateHashModel {
private Class<?> resoveClassFromTLD(String className, String entryType, String entryName)
throws TldParsingSAXException {
try {
- return _ClassUtil.forName(className);
+ return _ClassUtils.forName(className);
} catch (LinkageError e) {
throw newTLDEntryClassLoadingException(e, className, entryType, entryName);
} catch (ClassNotFoundException e) {
@@ -1905,8 +1905,8 @@ public class TaglibFactory implements TemplateHashModel {
&& Character.isUpperCase(className.charAt(dotIdx + 1));
return new TldParsingSAXException(
(e instanceof ClassNotFoundException ? "Not found class " : "Can't load class ")
- + _StringUtil.jQuote(className) + " for " + entryType
- + (entryName != null ? " " + _StringUtil.jQuote(entryName) : "") + "."
+ + _StringUtils.jQuote(className) + " for " + entryType
+ + (entryName != null ? " " + _StringUtils.jQuote(entryName) : "") + "."
+ (looksLikeNestedClass
? " Hint: Before nested classes, use \"$\", not \".\"."
: ""),
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtil.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtil.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtil.java
deleted file mode 100644
index a732cbb..0000000
--- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtil.java
+++ /dev/null
@@ -1,117 +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.servlet.jsp;
-
-import java.lang.reflect.Method;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.freemarker.core.util._ClassUtil;
-import org.apache.freemarker.core.util._StringUtil;
-
-final class TaglibMethodUtil {
-
- private TaglibMethodUtil() {
- // Not meant to be instantiated
- }
-
- private static final Pattern FUNCTION_SIGNATURE_PATTERN =
- Pattern.compile("^([\\w\\.]+(\\s*\\[\\s*\\])?)\\s+([\\w]+)\\s*\\((.*)\\)$");
- private static final Pattern FUNCTION_PARAMETER_PATTERN =
- Pattern.compile("^([\\w\\.]+)(\\s*\\[\\s*\\])?$");
-
- /**
- * Finds method by function signature string which is compliant with
- * Tag Library function signature in Java Server Page (TM) Specification.
- * A function signature example is as follows: {@code java.lang.String nickName( java.lang.String, int)}
- *
- * @param clazz Class having the method.
- * @param signature Java Server Page (TM) Specification compliant function signature string.
- * @return method if found.
- */
- public static Method getMethodByFunctionSignature(Class clazz, String signature)
- throws SecurityException, NoSuchMethodException, ClassNotFoundException {
- Matcher m1 = FUNCTION_SIGNATURE_PATTERN.matcher(signature);
-
- if (!m1.matches()) {
- throw new IllegalArgumentException("Invalid function signature.");
- }
-
- String methodName = m1.group(3);
- String params = m1.group(4).trim();
- Class [] paramTypes = null;
-
- if ("".equals(params)) {
- paramTypes = new Class[0];
- } else {
- String [] paramsArray = _StringUtil.split(params, ',');
- paramTypes = new Class[paramsArray.length];
- String token = null;
- String paramType = null;
- boolean isPrimitive = false;
- boolean isArrayType = false;
- Matcher m2 = null;
-
- for (int i = 0; i < paramsArray.length; i++) {
- token = paramsArray[i].trim();
- m2 = FUNCTION_PARAMETER_PATTERN.matcher(token);
-
- if (!m2.matches()) {
- throw new IllegalArgumentException("Invalid argument signature: '" + token + "'.");
- }
-
- paramType = m2.group(1);
- isPrimitive = (paramType.indexOf('.') == -1);
- isArrayType = (m2.group(2) != null);
-
- if (isPrimitive) {
- if ("byte".equals(paramType)) {
- paramTypes[i] = (isArrayType ? byte[].class : byte.class);
- } else if ("short".equals(paramType)) {
- paramTypes[i] = (isArrayType ? short[].class : short.class);
- } else if ("int".equals(paramType)) {
- paramTypes[i] = (isArrayType ? int[].class : int.class);
- } else if ("long".equals(paramType)) {
- paramTypes[i] = (isArrayType ? long[].class : long.class);
- } else if ("float".equals(paramType)) {
- paramTypes[i] = (isArrayType ? float[].class : float.class);
- } else if ("double".equals(paramType)) {
- paramTypes[i] = (isArrayType ? double[].class : double.class);
- } else if ("boolean".equals(paramType)) {
- paramTypes[i] = (isArrayType ? boolean[].class : boolean.class);
- } else if ("char".equals(paramType)) {
- paramTypes[i] = (isArrayType ? char[].class : char.class);
- } else {
- throw new IllegalArgumentException("Invalid primitive type: '" + paramType + "'.");
- }
- } else {
- if (isArrayType) {
- paramTypes[i] = _ClassUtil.forName("[L" + paramType + ";");
- } else {
- paramTypes[i] = _ClassUtil.forName(paramType);
- }
- }
- }
- }
-
- return clazz.getMethod(methodName, paramTypes);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtils.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtils.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtils.java
new file mode 100644
index 0000000..8222f6e
--- /dev/null
+++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtils.java
@@ -0,0 +1,117 @@
+/*
+ * 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.servlet.jsp;
+
+import java.lang.reflect.Method;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.freemarker.core.util._ClassUtils;
+import org.apache.freemarker.core.util._StringUtils;
+
+final class TaglibMethodUtils {
+
+ private TaglibMethodUtils() {
+ // Not meant to be instantiated
+ }
+
+ private static final Pattern FUNCTION_SIGNATURE_PATTERN =
+ Pattern.compile("^([\\w\\.]+(\\s*\\[\\s*\\])?)\\s+([\\w]+)\\s*\\((.*)\\)$");
+ private static final Pattern FUNCTION_PARAMETER_PATTERN =
+ Pattern.compile("^([\\w\\.]+)(\\s*\\[\\s*\\])?$");
+
+ /**
+ * Finds method by function signature string which is compliant with
+ * Tag Library function signature in Java Server Page (TM) Specification.
+ * A function signature example is as follows: {@code java.lang.String nickName( java.lang.String, int)}
+ *
+ * @param clazz Class having the method.
+ * @param signature Java Server Page (TM) Specification compliant function signature string.
+ * @return method if found.
+ */
+ public static Method getMethodByFunctionSignature(Class clazz, String signature)
+ throws SecurityException, NoSuchMethodException, ClassNotFoundException {
+ Matcher m1 = FUNCTION_SIGNATURE_PATTERN.matcher(signature);
+
+ if (!m1.matches()) {
+ throw new IllegalArgumentException("Invalid function signature.");
+ }
+
+ String methodName = m1.group(3);
+ String params = m1.group(4).trim();
+ Class [] paramTypes = null;
+
+ if ("".equals(params)) {
+ paramTypes = new Class[0];
+ } else {
+ String [] paramsArray = _StringUtils.split(params, ',');
+ paramTypes = new Class[paramsArray.length];
+ String token = null;
+ String paramType = null;
+ boolean isPrimitive = false;
+ boolean isArrayType = false;
+ Matcher m2 = null;
+
+ for (int i = 0; i < paramsArray.length; i++) {
+ token = paramsArray[i].trim();
+ m2 = FUNCTION_PARAMETER_PATTERN.matcher(token);
+
+ if (!m2.matches()) {
+ throw new IllegalArgumentException("Invalid argument signature: '" + token + "'.");
+ }
+
+ paramType = m2.group(1);
+ isPrimitive = (paramType.indexOf('.') == -1);
+ isArrayType = (m2.group(2) != null);
+
+ if (isPrimitive) {
+ if ("byte".equals(paramType)) {
+ paramTypes[i] = (isArrayType ? byte[].class : byte.class);
+ } else if ("short".equals(paramType)) {
+ paramTypes[i] = (isArrayType ? short[].class : short.class);
+ } else if ("int".equals(paramType)) {
+ paramTypes[i] = (isArrayType ? int[].class : int.class);
+ } else if ("long".equals(paramType)) {
+ paramTypes[i] = (isArrayType ? long[].class : long.class);
+ } else if ("float".equals(paramType)) {
+ paramTypes[i] = (isArrayType ? float[].class : float.class);
+ } else if ("double".equals(paramType)) {
+ paramTypes[i] = (isArrayType ? double[].class : double.class);
+ } else if ("boolean".equals(paramType)) {
+ paramTypes[i] = (isArrayType ? boolean[].class : boolean.class);
+ } else if ("char".equals(paramType)) {
+ paramTypes[i] = (isArrayType ? char[].class : char.class);
+ } else {
+ throw new IllegalArgumentException("Invalid primitive type: '" + paramType + "'.");
+ }
+ } else {
+ if (isArrayType) {
+ paramTypes[i] = _ClassUtils.forName("[L" + paramType + ";");
+ } else {
+ paramTypes[i] = _ClassUtils.forName(paramType);
+ }
+ }
+ }
+ }
+
+ return clazz.getMethod(methodName, paramTypes);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/_FreeMarkerPageContext21.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/_FreeMarkerPageContext21.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/_FreeMarkerPageContext21.java
index 2500665..be9d58a 100644
--- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/_FreeMarkerPageContext21.java
+++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/_FreeMarkerPageContext21.java
@@ -32,7 +32,7 @@ import javax.servlet.jsp.el.ExpressionEvaluator;
import javax.servlet.jsp.el.VariableResolver;
import org.apache.freemarker.core.model.TemplateModelException;
-import org.apache.freemarker.core.util._ClassUtil;
+import org.apache.freemarker.core.util._ClassUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -111,7 +111,7 @@ public class _FreeMarkerPageContext21 extends FreeMarkerPageContext {
} else {
throw new UnsupportedOperationException(
"Can not invoke an ELContext using a foreign JspApplicationContext (of class "
- + _ClassUtil.getShortClassNameOfObject(jspctx) + ").\n" +
+ + _ClassUtils.getShortClassNameOfObject(jspctx) + ").\n" +
"Hint: The cause of this is often that you are trying to use JSTL tags/functions in FTL. "
+ "In that case, know that that's not really suppored, and you are supposed to use FTL "
+ "constrcuts instead, like #list instead of JSTL's forEach, etc.");
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilTest.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilTest.java b/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilTest.java
deleted file mode 100644
index 5733abc..0000000
--- a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilTest.java
+++ /dev/null
@@ -1,108 +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.servlet.jsp;
-
-import static org.junit.Assert.*;
-
-import java.lang.reflect.Method;
-
-import org.apache.freemarker.servlet.jsp.TaglibMethodUtil;
-import org.junit.Test;
-
-public class TaglibMethodUtilTest {
-
- @Test
- public void testGetMethodByFunctionSignature() throws Exception {
- Method expected = Functions.class.getMethod("plus", int.class, int.class);
- String signature = "int plus(int, int)";
- Method method = TaglibMethodUtil.getMethodByFunctionSignature(Functions.class, signature);
- assertEquals(expected, method);
-
- expected = Functions.class.getMethod("plus", double.class, double.class);
- signature = "double plus ( double , double )";
- method = TaglibMethodUtil.getMethodByFunctionSignature(Functions.class, signature);
- assertEquals(expected, method);
-
- expected = Functions.class.getMethod("plus", String.class, String.class);
- signature = "java.lang.String plus ( java.lang.String ,java.lang.String )";
- method = TaglibMethodUtil.getMethodByFunctionSignature(Functions.class, signature);
- assertEquals(expected, method);
-
- expected = Functions.class.getMethod("plus", double[].class, double[].class);
- signature = "double[] plus ( double[] ,double [] )";
- method = TaglibMethodUtil.getMethodByFunctionSignature(Functions.class, signature);
- assertEquals(expected, method);
-
- expected = Functions.class.getMethod("plus", String[].class, String[].class);
- signature = "java.lang.String [] plus ( java.lang.String[] ,java.lang.String [] )";
- method = TaglibMethodUtil.getMethodByFunctionSignature(Functions.class, signature);
- assertEquals(expected, method);
-
- expected = Functions.class.getMethod("sum", double[].class);
- signature = "double sum ( double[] )";
- method = TaglibMethodUtil.getMethodByFunctionSignature(Functions.class, signature);
- assertEquals(expected, method);
- }
-
- @SuppressWarnings("unused")
- private static class Functions {
-
- public static int plus(int a, int b) {
- return a + b;
- }
-
- public static double plus(double a, double b) {
- return a + b;
- }
-
- public static String plus(String a, String b) {
- return a + b;
- }
-
- public static double [] plus(double [] a, double [] b) {
- double [] sum = new double[a.length];
-
- for (int i = 0; i < a.length; i++) {
- sum[i] = a[i] + b[i];
- }
-
- return sum;
- }
-
- public static String [] plus(String [] a, String [] b) {
- String [] joins = new String[a.length];
-
- for (int i = 0; i < a.length; i++) {
- joins[i] = a[i] + b[i];
- }
-
- return joins;
- }
-
- public static double sum(double [] a) {
- double sum = 0.0;
- for (double i : a) {
- sum += i;
- }
- return sum;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilsTest.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilsTest.java b/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilsTest.java
new file mode 100644
index 0000000..fa341e5
--- /dev/null
+++ b/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilsTest.java
@@ -0,0 +1,107 @@
+/*
+ * 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.servlet.jsp;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Method;
+
+import org.junit.Test;
+
+public class TaglibMethodUtilsTest {
+
+ @Test
+ public void testGetMethodByFunctionSignature() throws Exception {
+ Method expected = Functions.class.getMethod("plus", int.class, int.class);
+ String signature = "int plus(int, int)";
+ Method method = TaglibMethodUtils.getMethodByFunctionSignature(Functions.class, signature);
+ assertEquals(expected, method);
+
+ expected = Functions.class.getMethod("plus", double.class, double.class);
+ signature = "double plus ( double , double )";
+ method = TaglibMethodUtils.getMethodByFunctionSignature(Functions.class, signature);
+ assertEquals(expected, method);
+
+ expected = Functions.class.getMethod("plus", String.class, String.class);
+ signature = "java.lang.String plus ( java.lang.String ,java.lang.String )";
+ method = TaglibMethodUtils.getMethodByFunctionSignature(Functions.class, signature);
+ assertEquals(expected, method);
+
+ expected = Functions.class.getMethod("plus", double[].class, double[].class);
+ signature = "double[] plus ( double[] ,double [] )";
+ method = TaglibMethodUtils.getMethodByFunctionSignature(Functions.class, signature);
+ assertEquals(expected, method);
+
+ expected = Functions.class.getMethod("plus", String[].class, String[].class);
+ signature = "java.lang.String [] plus ( java.lang.String[] ,java.lang.String [] )";
+ method = TaglibMethodUtils.getMethodByFunctionSignature(Functions.class, signature);
+ assertEquals(expected, method);
+
+ expected = Functions.class.getMethod("sum", double[].class);
+ signature = "double sum ( double[] )";
+ method = TaglibMethodUtils.getMethodByFunctionSignature(Functions.class, signature);
+ assertEquals(expected, method);
+ }
+
+ @SuppressWarnings("unused")
+ private static class Functions {
+
+ public static int plus(int a, int b) {
+ return a + b;
+ }
+
+ public static double plus(double a, double b) {
+ return a + b;
+ }
+
+ public static String plus(String a, String b) {
+ return a + b;
+ }
+
+ public static double [] plus(double [] a, double [] b) {
+ double [] sum = new double[a.length];
+
+ for (int i = 0; i < a.length; i++) {
+ sum[i] = a[i] + b[i];
+ }
+
+ return sum;
+ }
+
+ public static String [] plus(String [] a, String [] b) {
+ String [] joins = new String[a.length];
+
+ for (int i = 0; i < a.length; i++) {
+ joins[i] = a[i] + b[i];
+ }
+
+ return joins;
+ }
+
+ public static double sum(double [] a) {
+ double sum = 0.0;
+ for (double i : a) {
+ sum += i;
+ }
+ return sum;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeAccessorTag.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeAccessorTag.java b/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeAccessorTag.java
index d068204..49e071b 100644
--- a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeAccessorTag.java
+++ b/freemarker-servlet/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._StringUtils;
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: " + _StringUtils.jQuote(scope));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeInfoTag.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeInfoTag.java b/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeInfoTag.java
index 2d306a0..e8b6eea 100644
--- a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/jsp/taglibmembers/AttributeInfoTag.java
+++ b/freemarker-servlet/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._DateUtils;
+import org.apache.freemarker.core.util._DateUtils.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 = _DateUtils.dateToISO8601String((Date) attrVal, true, true, true, _DateUtils.ACCURACY_SECONDS,
+ _DateUtils.UTC,
new TrivialDateToISO8601CalendarFactory());
} else {
formattedVal = String.valueOf(attrVal);
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/test/Model2TesterServlet.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/test/Model2TesterServlet.java b/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/test/Model2TesterServlet.java
index 52cdf4b..c0e9739 100644
--- a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/test/Model2TesterServlet.java
+++ b/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/test/Model2TesterServlet.java
@@ -29,7 +29,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._StringUtils;
import org.apache.freemarker.servlet.FreemarkerServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -109,7 +109,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) + ".");
+ + _StringUtils.jQuote(paramViewServlet) + ".");
}
final HttpServletRequestWrapper viewReq = new HttpServletRequestWrapper(req) {
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/test/WebAppTestCase.java
----------------------------------------------------------------------
diff --git a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/test/WebAppTestCase.java b/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/test/WebAppTestCase.java
index 05138fd..01e6072 100644
--- a/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/test/WebAppTestCase.java
+++ b/freemarker-servlet/src/test/java/org/apache/freemarker/servlet/test/WebAppTestCase.java
@@ -36,7 +36,7 @@ import java.util.regex.Pattern;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.freemarker.test.ResourcesExtractor;
-import org.apache.freemarker.test.TestUtil;
+import org.apache.freemarker.test.TestUtils;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.webapp.WebAppContext;
@@ -192,7 +192,7 @@ public class WebAppTestCase {
throw new IOException("Test resource not found: " + expectedResource);
}
try {
- expected = TestUtil.removeTxtCopyrightComment(normalizeWS(
+ expected = TestUtils.removeTxtCopyrightComment(normalizeWS(
IOUtils.toString(in, StandardCharsets.UTF_8.name()),
compressWS));
} finally {
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-test-utils/src/main/java/org/apache/freemarker/test/CopyrightCommentRemoverTemplateLoader.java
----------------------------------------------------------------------
diff --git a/freemarker-test-utils/src/main/java/org/apache/freemarker/test/CopyrightCommentRemoverTemplateLoader.java b/freemarker-test-utils/src/main/java/org/apache/freemarker/test/CopyrightCommentRemoverTemplateLoader.java
index 3b6ea39..3c03a87 100644
--- a/freemarker-test-utils/src/main/java/org/apache/freemarker/test/CopyrightCommentRemoverTemplateLoader.java
+++ b/freemarker-test-utils/src/main/java/org/apache/freemarker/test/CopyrightCommentRemoverTemplateLoader.java
@@ -81,7 +81,7 @@ public class CopyrightCommentRemoverTemplateLoader implements TemplateLoader {
}
try {
String content = IOUtils.toString(reader);
- return new StringReader(TestUtil.removeFTLCopyrightComment(content));
+ return new StringReader(TestUtils.removeFTLCopyrightComment(content));
} finally {
reader.close();
}
@@ -95,7 +95,7 @@ public class CopyrightCommentRemoverTemplateLoader implements TemplateLoader {
// Encoding then decosing in ISO-8859-1 is binary loseless
String content = IOUtils.toString(in, StandardCharsets.ISO_8859_1.name());
return new ReaderInputStream(
- new StringReader(TestUtil.removeFTLCopyrightComment(content)),
+ new StringReader(TestUtils.removeFTLCopyrightComment(content)),
StandardCharsets.ISO_8859_1);
} finally {
in.close();
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ebb39b84/freemarker-test-utils/src/main/java/org/apache/freemarker/test/FileTestCase.java
----------------------------------------------------------------------
diff --git a/freemarker-test-utils/src/main/java/org/apache/freemarker/test/FileTestCase.java b/freemarker-test-utils/src/main/java/org/apache/freemarker/test/FileTestCase.java
index 1d70d8c..c0adb72 100644
--- a/freemarker-test-utils/src/main/java/org/apache/freemarker/test/FileTestCase.java
+++ b/freemarker-test-utils/src/main/java/org/apache/freemarker/test/FileTestCase.java
@@ -29,7 +29,7 @@ import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.freemarker.core.util._NullArgumentException;
-import org.apache.freemarker.core.util._StringUtil;
+import org.apache.freemarker.core.util._StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,8 +68,8 @@ public abstract class FileTestCase extends TestCase {
}
private void multilineAssertEquals(String expected, String actual) {
- String normExpected = _StringUtil.normalizeEOLs(expected);
- final String normActual = _StringUtil.normalizeEOLs(actual);
+ String normExpected = _StringUtils.normalizeEOLs(expected);
+ final String normActual = _StringUtils.normalizeEOLs(actual);
// Ignore final line-break difference:
if (normActual.endsWith("\n") && !normExpected.endsWith("\n")) {
@@ -117,7 +117,7 @@ public abstract class FileTestCase extends TestCase {
if (resource == null) {
throw new FileNotFoundException("Class-loader resource not found for: "
+ "baseClass: " + baseClass.getName() + "; "
- + "resourcePath (shown quoted): " + _StringUtil.jQuote(resourcePath));
+ + "resourcePath (shown quoted): " + _StringUtils.jQuote(resourcePath));
}
return resource;
}
@@ -205,7 +205,7 @@ public abstract class FileTestCase extends TestCase {
}
protected String loadTestTextResource(URL resource, Charset charset) throws IOException {
- return TestUtil.removeTxtCopyrightComment(
+ return TestUtils.removeTxtCopyrightComment(
IOUtils.toString(resource, charset.name()));
}