diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-09-18 23:16:02 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-09-19 14:25:46 +0300 |
commit | f6e082f5172d791a49d98a6b6b7770d3b38c8695 (patch) | |
tree | 439c6d53e57e8b24f81f341eb0fc93583a3c42bd /server/src | |
parent | d8baecb239b0d91f477c450d2a08a472b169a08d (diff) | |
download | vaadin-framework-f6e082f5172d791a49d98a6b6b7770d3b38c8695.tar.gz vaadin-framework-f6e082f5172d791a49d98a6b6b7770d3b38c8695.zip |
Use String.isEmpty()
Diffstat (limited to 'server/src')
8 files changed, 19 insertions, 19 deletions
diff --git a/server/src/main/java/com/vaadin/server/SizeWithUnit.java b/server/src/main/java/com/vaadin/server/SizeWithUnit.java index b53e4533f4..b1b34e1fef 100644 --- a/server/src/main/java/com/vaadin/server/SizeWithUnit.java +++ b/server/src/main/java/com/vaadin/server/SizeWithUnit.java @@ -85,7 +85,7 @@ public class SizeWithUnit implements Serializable { return null; } s = s.trim(); - if ("".equals(s)) { + if (s.isEmpty()) { return null; } float size = 0; diff --git a/server/src/main/java/com/vaadin/server/VaadinServlet.java b/server/src/main/java/com/vaadin/server/VaadinServlet.java index 0151d42b62..d2498dddfc 100644 --- a/server/src/main/java/com/vaadin/server/VaadinServlet.java +++ b/server/src/main/java/com/vaadin/server/VaadinServlet.java @@ -472,7 +472,7 @@ public class VaadinServlet extends HttpServlet implements Constants { location.length() - lastPathParameter.length()); if ((request.getPathInfo() == null || "/".equals(request.getPathInfo())) - && "".equals(request.getServletPath()) + && request.getServletPath().isEmpty() && !location.endsWith("/")) { /* * Path info is for the root but request URI doesn't end with a diff --git a/server/src/main/java/com/vaadin/server/VaadinServletService.java b/server/src/main/java/com/vaadin/server/VaadinServletService.java index 42213f60d0..1de9bfc1f4 100644 --- a/server/src/main/java/com/vaadin/server/VaadinServletService.java +++ b/server/src/main/java/com/vaadin/server/VaadinServletService.java @@ -152,7 +152,7 @@ public class VaadinServletService extends VaadinService { } String pathInfo = servletRequest.getPathInfo(); - if (pathInfo != null && !"".equals(pathInfo)) { + if (pathInfo != null && !pathInfo.isEmpty()) { servletPath += pathInfo; } @@ -272,7 +272,7 @@ public class VaadinServletService extends VaadinService { // Just ignore problem here } - if (appId == null || "".equals(appId) || "/".equals(appId)) { + if (appId == null || appId.isEmpty() || "/".equals(appId)) { appId = "ROOT"; } appId = appId.replaceAll("[^a-zA-Z0-9]", ""); diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponent.java b/server/src/main/java/com/vaadin/ui/AbstractComponent.java index cce8d970dd..bea9ef9e56 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractComponent.java +++ b/server/src/main/java/com/vaadin/ui/AbstractComponent.java @@ -195,7 +195,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public void setStyleName(String style) { - if (style == null || "".equals(style)) { + if (style == null || style.isEmpty()) { getState().styles = null; return; } @@ -222,7 +222,7 @@ public abstract class AbstractComponent extends AbstractClientConnector @Override public void addStyleName(String style) { - if (style == null || "".equals(style)) { + if (style == null || style.isEmpty()) { return; } if (style.contains(" ")) { diff --git a/server/src/main/java/com/vaadin/ui/Embedded.java b/server/src/main/java/com/vaadin/ui/Embedded.java index ef31790e8a..1f6c15e0c6 100644 --- a/server/src/main/java/com/vaadin/ui/Embedded.java +++ b/server/src/main/java/com/vaadin/ui/Embedded.java @@ -161,25 +161,25 @@ public class Embedded extends AbstractComponent implements LegacyComponent { target.addAttribute("src", getSource()); } - if (mimeType != null && !"".equals(mimeType)) { + if (mimeType != null && !mimeType.isEmpty()) { target.addAttribute("mimetype", mimeType); } - if (classId != null && !"".equals(classId)) { + if (classId != null && !classId.isEmpty()) { target.addAttribute("classid", classId); } - if (codebase != null && !"".equals(codebase)) { + if (codebase != null && !codebase.isEmpty()) { target.addAttribute("codebase", codebase); } - if (codetype != null && !"".equals(codetype)) { + if (codetype != null && !codetype.isEmpty()) { target.addAttribute("codetype", codetype); } - if (standby != null && !"".equals(standby)) { + if (standby != null && !standby.isEmpty()) { target.addAttribute("standby", standby); } - if (archive != null && !"".equals(archive)) { + if (archive != null && !archive.isEmpty()) { target.addAttribute("archive", archive); } - if (altText != null && !"".equals(altText)) { + if (altText != null && !altText.isEmpty()) { target.addAttribute(EmbeddedConstants.ALTERNATE_TEXT, altText); } diff --git a/server/src/main/java/com/vaadin/ui/Label.java b/server/src/main/java/com/vaadin/ui/Label.java index c2fd132060..849e67ad63 100644 --- a/server/src/main/java/com/vaadin/ui/Label.java +++ b/server/src/main/java/com/vaadin/ui/Label.java @@ -141,7 +141,7 @@ public class Label extends AbstractComponent { } else { setContentMode(ContentMode.HTML); } - if (innerHtml != null && !"".equals(innerHtml)) { + if (innerHtml != null && !innerHtml.isEmpty()) { if (plainText) { innerHtml = DesignFormatter.decodeFromTextNode(innerHtml); } diff --git a/server/src/test/java/com/vaadin/server/LocaleServiceTest.java b/server/src/test/java/com/vaadin/server/LocaleServiceTest.java index a93489194c..7742c2ae30 100644 --- a/server/src/test/java/com/vaadin/server/LocaleServiceTest.java +++ b/server/src/test/java/com/vaadin/server/LocaleServiceTest.java @@ -997,9 +997,9 @@ public class LocaleServiceTest { private static void generateData(Locale locale) { System.out.println(); String id = locale.getLanguage(); - if (!locale.getCountry().equals("")) { + if (!locale.getCountry().isEmpty()) { id += "_" + locale.getCountry(); - if (!locale.getVariant().equals("")) { + if (!locale.getVariant().isEmpty()) { id += "_" + locale.getVariant(); } } diff --git a/server/src/test/java/com/vaadin/tests/design/LocaleTest.java b/server/src/test/java/com/vaadin/tests/design/LocaleTest.java index f1c61d9558..7673094ff1 100644 --- a/server/src/test/java/com/vaadin/tests/design/LocaleTest.java +++ b/server/src/test/java/com/vaadin/tests/design/LocaleTest.java @@ -93,19 +93,19 @@ public class LocaleTest { assertTrue( "The element should not have a locale specification, found locale " + eb1.attr("locale"), - "".equals(eb1.attr("locale"))); + eb1.attr("locale").isEmpty()); Element eb2 = ehLayout.child(1); assertEquals("Wrong locale information.", "en_US", eb2.attr("locale")); Element ehLayout2 = evLayout.child(1); assertTrue( "The element should not have a locale specification, found locale " + ehLayout2.attr("locale"), - "".equals(ehLayout2.attr("locale"))); + ehLayout2.attr("locale").isEmpty()); Element el1 = ehLayout2.child(0); assertTrue( "The element should not have a locale specification, found locale " + el1.attr("locale"), - "".equals(el1.attr("locale"))); + el1.attr("locale").isEmpty()); Element el2 = ehLayout2.child(1); assertEquals("Wrong locale information.", "en_CA", el2.attr("locale")); } |