diff --git a/freemarker-core/src/main/java/freemarker/core/StopException.java b/freemarker-core/src/main/java/freemarker/core/StopException.java index dbabb2758..1b9f4a5b1 100644 --- a/freemarker-core/src/main/java/freemarker/core/StopException.java +++ b/freemarker-core/src/main/java/freemarker/core/StopException.java @@ -42,7 +42,7 @@ public void printStackTrace(PrintWriter pw) { synchronized (pw) { String msg = this.getMessage(); pw.print("Encountered stop instruction"); - if (msg != null && !msg.equals("")) { + if (msg != null && !msg.isEmpty()) { pw.println("\nCause given: " + msg); } else pw.println(); super.printStackTrace(pw); @@ -54,7 +54,7 @@ public void printStackTrace(PrintStream ps) { synchronized (ps) { String msg = this.getMessage(); ps.print("Encountered stop instruction"); - if (msg != null && !msg.equals("")) { + if (msg != null && !msg.isEmpty()) { ps.println("\nCause given: " + msg); } else ps.println(); super.printStackTrace(ps); diff --git a/freemarker-core/src/main/java/freemarker/ext/dom/AttributeNodeModel.java b/freemarker-core/src/main/java/freemarker/ext/dom/AttributeNodeModel.java index 2ae1740d4..fbcb42588 100644 --- a/freemarker-core/src/main/java/freemarker/ext/dom/AttributeNodeModel.java +++ b/freemarker-core/src/main/java/freemarker/ext/dom/AttributeNodeModel.java @@ -38,7 +38,7 @@ public String getAsString() { @Override public String getNodeName() { String result = node.getLocalName(); - if (result == null || result.equals("")) { + if (result == null || result.isEmpty()) { result = node.getNodeName(); } return result; @@ -52,7 +52,7 @@ public boolean isEmpty() { @Override String getQualifiedName() { String nsURI = node.getNamespaceURI(); - if (nsURI == null || nsURI.equals("")) + if (nsURI == null || nsURI.isEmpty()) return node.getNodeName(); Environment env = Environment.getCurrentEnvironment(); String defaultNS = env.getDefaultNS(); diff --git a/freemarker-core/src/main/java/freemarker/ext/dom/ElementModel.java b/freemarker-core/src/main/java/freemarker/ext/dom/ElementModel.java index 8e3acae6e..2622d8d8d 100644 --- a/freemarker-core/src/main/java/freemarker/ext/dom/ElementModel.java +++ b/freemarker-core/src/main/java/freemarker/ext/dom/ElementModel.java @@ -151,7 +151,7 @@ public String getAsString() throws TemplateModelException { @Override public String getNodeName() { String result = node.getLocalName(); - if (result == null || result.equals("")) { + if (result == null || result.isEmpty()) { result = node.getNodeName(); } return result; diff --git a/freemarker-core/src/main/java/freemarker/template/Template.java b/freemarker-core/src/main/java/freemarker/template/Template.java index c6fcc31fd..7d71b1377 100644 --- a/freemarker-core/src/main/java/freemarker/template/Template.java +++ b/freemarker-core/src/main/java/freemarker/template/Template.java @@ -966,7 +966,7 @@ public String getDefaultNS() { * @return the NamespaceUri mapped to this prefix in this template. (Or null if there is none.) */ public String getNamespaceForPrefix(String prefix) { - if (prefix.equals("")) { + if (prefix.isEmpty()) { return defaultNS == null ? "" : defaultNS; } return (String) prefixToNamespaceURILookup.get(prefix); diff --git a/freemarker-javax-servlet/src/main/java/freemarker/ext/jsp/TaglibMethodUtil.java b/freemarker-javax-servlet/src/main/java/freemarker/ext/jsp/TaglibMethodUtil.java index ab1effbb7..75ce8f7cd 100644 --- a/freemarker-javax-servlet/src/main/java/freemarker/ext/jsp/TaglibMethodUtil.java +++ b/freemarker-javax-servlet/src/main/java/freemarker/ext/jsp/TaglibMethodUtil.java @@ -59,7 +59,7 @@ static Method getMethodByFunctionSignature(Class clazz, String signature) String params = m1.group(4).trim(); Class [] paramTypes = null; - if ("".equals(params)) { + if (params.isEmpty()) { paramTypes = new Class[0]; } else { String [] paramsArray = StringUtil.split(params, ',');