]> source.dussan.org Git - vaadin-framework.git/commitdiff
Use String .isEmpty() over .equals("")
authorPer-Åke Minborg <minborg@speedment.com>
Fri, 28 Oct 2016 15:58:20 +0000 (08:58 -0700)
committerVaadin Code Review <review@vaadin.com>
Fri, 4 Nov 2016 13:36:29 +0000 (13:36 +0000)
Change-Id: I80b73b653e97904605dc62484a7448f3bfbf721e

server/src/main/java/com/vaadin/server/ComponentSizeValidator.java
server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java
server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java
server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java
server/src/main/java/com/vaadin/ui/AbsoluteLayout.java
server/src/main/java/com/vaadin/ui/declarative/Design.java
server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java

index 7d4de85cfe63b8fcde1189698c23eb6639564235..de6f5d0a9a67ea721c9178ce4f5be0116856848b 100644 (file)
@@ -608,7 +608,7 @@ public class ComponentSizeValidator implements Serializable {
             } else if (parent instanceof Window) {
                 // Sub window can define width based on caption
                 if (parent.getCaption() != null
-                        && !parent.getCaption().equals("")) {
+                        && !parent.getCaption().isEmpty()) {
                     return true;
                 } else {
                     return false;
index d5c047b0eb0bc45b871da6ee2d105cb4ce78fe3c..6a860bd5e27aa47a1726883686a47dc69db76b71 100644 (file)
@@ -370,7 +370,7 @@ public class FileUploadHandler implements RequestHandler {
                 rawfilename = rawfilename.substring(0,
                         rawfilename.indexOf(quote));
                 firstFileFieldFound = true;
-            } else if (firstFileFieldFound && readLine.equals("")) {
+            } else if (firstFileFieldFound && readLine.isEmpty()) {
                 atStart = true;
             } else if (readLine.startsWith("Content-Type")) {
                 rawMimeType = readLine.split(": ")[1];
index 8ec3503be0ad7918fd8bbf536475d9306c892d00..4e7bc937137c5cfd9fc2eaa4360fe256f88bf999 100644 (file)
@@ -90,7 +90,7 @@ public class ServerRpcHandler implements Serializable {
                 csrfToken = ApplicationConstants.CSRF_TOKEN_DEFAULT_VALUE;
             } else {
                 String csrfToken = token.asString();
-                if (csrfToken.equals("")) {
+                if (csrfToken.isEmpty()) {
                     csrfToken = ApplicationConstants.CSRF_TOKEN_DEFAULT_VALUE;
                 }
                 this.csrfToken = csrfToken;
@@ -223,7 +223,7 @@ public class ServerRpcHandler implements Serializable {
 
         String changeMessage = getMessage(reader);
 
-        if (changeMessage == null || changeMessage.equals("")) {
+        if (changeMessage == null || changeMessage.isEmpty()) {
             // The client sometimes sends empty messages, this is probably a bug
             return;
         }
index 6903a17ddd3cb819b0c5e225b8fa5aa6f91e0480..1e159a68c3369c0a3633507590b3300ba4e706fb 100644 (file)
@@ -115,7 +115,7 @@ public class ClassPathExplorer {
 
     static {
         String debugProperty = System.getProperty("debug");
-        if (debugProperty != null && !debugProperty.equals("")) {
+        if (debugProperty != null && !debugProperty.isEmpty()) {
             debug = true;
         }
     }
@@ -212,7 +212,7 @@ public class ClassPathExplorer {
                 // remove the .gwt.xml extension
                 String classname = files[i].substring(0, files[i].length() - 8);
                 String packageName = locationString
-                    .substring(locationString.lastIndexOf('/') + 1);
+                        .substring(locationString.lastIndexOf('/') + 1);
                 classname = packageName + "." + classname;
 
                 if (!WidgetSetBuilder.isWidgetset(classname)) {
@@ -273,9 +273,9 @@ public class ClassPathExplorer {
                             .getValue("Vaadin-Widgetsets");
                     if (value != null) {
                         String[] widgetsetNames = value.split(",");
-                        for (int i = 0; i < widgetsetNames.length; i++) {
-                            String widgetsetname = widgetsetNames[i].trim();
-                            if (!widgetsetname.equals("")) {
+                        for (String widgetsetName : widgetsetNames) {
+                            String widgetsetname = widgetsetName.trim();
+                            if (!widgetsetname.isEmpty()) {
                                 widgetsets.put(widgetsetname, location);
                             }
                         }
@@ -286,9 +286,9 @@ public class ClassPathExplorer {
                             .getValue("Vaadin-Stylesheets");
                     if (value != null) {
                         String[] stylesheets = value.split(",");
-                        for (int i = 0; i < stylesheets.length; i++) {
-                            String stylesheet = stylesheets[i].trim();
-                            if (!stylesheet.equals("")) {
+                        for (String stylesheet1 : stylesheets) {
+                            String stylesheet = stylesheet1.trim();
+                            if (!stylesheet.isEmpty()) {
                                 addonStyles.put(stylesheet, location);
                             }
                         }
index 5aa008e8293bb9627e27b29d93df835fad675e44..04c53fa84ce65c7b72a1484dd10ca520422edb4f 100644 (file)
@@ -304,7 +304,7 @@ public class AbsoluteLayout extends AbstractLayout
             for (int i = 0; i < cssProperties.length; i++) {
                 String[] keyValuePair = cssProperties[i].split(":");
                 String key = keyValuePair[0].trim();
-                if (key.equals("")) {
+                if (key.isEmpty()) {
                     continue;
                 }
                 if (key.equals("z-index")) {
@@ -317,7 +317,7 @@ public class AbsoluteLayout extends AbstractLayout
                         value = "";
                     }
                     String symbol = value.replaceAll("[0-9\\.\\-]+", "");
-                    if (!symbol.equals("")) {
+                    if (!symbol.isEmpty()) {
                         value = value.substring(0, value.indexOf(symbol))
                                 .trim();
                     }
index 54abc38427bb8abd6c9a484154522c76727a5c21..0c5595028ef3970e28e09d180f5db0c976439f12 100644 (file)
@@ -571,7 +571,7 @@ public class Design implements Serializable {
         DesignRoot designAnnotation = annotatedClass
                 .getAnnotation(DesignRoot.class);
         String filename = designAnnotation.value();
-        if (filename.equals("")) {
+        if (filename.isEmpty()) {
             // No value, assume the html file is named as the class
             filename = annotatedClass.getSimpleName() + ".html";
         }
index d5b3c9a9cd3924e18f853b54affffc77195e3bdb..93ccee3f374702c748fe83edd7765439a8b151ba 100644 (file)
@@ -48,7 +48,7 @@ public class DesignEnumConverter<T extends Enum>
     @SuppressWarnings("unchecked")
     @Override
     public Result<T> convertToModel(String value, ValueContext context) {
-        if (value == null || value.trim().equals("")) {
+        if (value == null || value.trim().isEmpty()) {
             return Result.ok(null);
         }
         try {