Skip to content

Commit 2f50940

Browse files
authored
Merge pull request #116 from hduelme/use-isEmpty-to-check-if-string-is-empty
use isEmpty to check if string is empty
2 parents b20474e + 928bd5e commit 2f50940

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

freemarker-core/src/main/java/freemarker/core/StopException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void printStackTrace(PrintWriter pw) {
4242
synchronized (pw) {
4343
String msg = this.getMessage();
4444
pw.print("Encountered stop instruction");
45-
if (msg != null && !msg.equals("")) {
45+
if (msg != null && !msg.isEmpty()) {
4646
pw.println("\nCause given: " + msg);
4747
} else pw.println();
4848
super.printStackTrace(pw);
@@ -54,7 +54,7 @@ public void printStackTrace(PrintStream ps) {
5454
synchronized (ps) {
5555
String msg = this.getMessage();
5656
ps.print("Encountered stop instruction");
57-
if (msg != null && !msg.equals("")) {
57+
if (msg != null && !msg.isEmpty()) {
5858
ps.println("\nCause given: " + msg);
5959
} else ps.println();
6060
super.printStackTrace(ps);

freemarker-core/src/main/java/freemarker/ext/dom/AttributeNodeModel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public String getAsString() {
3838
@Override
3939
public String getNodeName() {
4040
String result = node.getLocalName();
41-
if (result == null || result.equals("")) {
41+
if (result == null || result.isEmpty()) {
4242
result = node.getNodeName();
4343
}
4444
return result;
@@ -52,7 +52,7 @@ public boolean isEmpty() {
5252
@Override
5353
String getQualifiedName() {
5454
String nsURI = node.getNamespaceURI();
55-
if (nsURI == null || nsURI.equals(""))
55+
if (nsURI == null || nsURI.isEmpty())
5656
return node.getNodeName();
5757
Environment env = Environment.getCurrentEnvironment();
5858
String defaultNS = env.getDefaultNS();

freemarker-core/src/main/java/freemarker/ext/dom/ElementModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public String getAsString() throws TemplateModelException {
151151
@Override
152152
public String getNodeName() {
153153
String result = node.getLocalName();
154-
if (result == null || result.equals("")) {
154+
if (result == null || result.isEmpty()) {
155155
result = node.getNodeName();
156156
}
157157
return result;

freemarker-core/src/main/java/freemarker/template/Template.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ public String getDefaultNS() {
966966
* @return the NamespaceUri mapped to this prefix in this template. (Or null if there is none.)
967967
*/
968968
public String getNamespaceForPrefix(String prefix) {
969-
if (prefix.equals("")) {
969+
if (prefix.isEmpty()) {
970970
return defaultNS == null ? "" : defaultNS;
971971
}
972972
return (String) prefixToNamespaceURILookup.get(prefix);

freemarker-javax-servlet/src/main/java/freemarker/ext/jsp/TaglibMethodUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static Method getMethodByFunctionSignature(Class clazz, String signature)
5959
String params = m1.group(4).trim();
6060
Class [] paramTypes = null;
6161

62-
if ("".equals(params)) {
62+
if (params.isEmpty()) {
6363
paramTypes = new Class[0];
6464
} else {
6565
String [] paramsArray = StringUtil.split(params, ',');

0 commit comments

Comments
 (0)