From: Per-Åke Minborg Date: Fri, 28 Oct 2016 15:58:20 +0000 (-0700) Subject: Use String .isEmpty() over .equals("") X-Git-Tag: 8.0.0.alpha7~25 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=41c183a9b68c72af04f8be1c1a0a09d01b518652;p=vaadin-framework.git Use String .isEmpty() over .equals("") Change-Id: I80b73b653e97904605dc62484a7448f3bfbf721e --- diff --git a/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java b/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java index 7d4de85cfe..de6f5d0a9a 100644 --- a/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java +++ b/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java @@ -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; diff --git a/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java b/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java index d5c047b0eb..6a860bd5e2 100644 --- a/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java @@ -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]; diff --git a/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java index 8ec3503be0..4e7bc93713 100644 --- a/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java @@ -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; } diff --git a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java index 6903a17ddd..1e159a68c3 100644 --- a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java +++ b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java @@ -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); } } diff --git a/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java b/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java index 5aa008e829..04c53fa84c 100644 --- a/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java +++ b/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java @@ -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(); } diff --git a/server/src/main/java/com/vaadin/ui/declarative/Design.java b/server/src/main/java/com/vaadin/ui/declarative/Design.java index 54abc38427..0c5595028e 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/Design.java +++ b/server/src/main/java/com/vaadin/ui/declarative/Design.java @@ -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"; } diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java index d5b3c9a9cd..93ccee3f37 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java @@ -48,7 +48,7 @@ public class DesignEnumConverter @SuppressWarnings("unchecked") @Override public Result convertToModel(String value, ValueContext context) { - if (value == null || value.trim().equals("")) { + if (value == null || value.trim().isEmpty()) { return Result.ok(null); } try {