aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-09-21 10:51:51 +0200
committerHenri Sara <henri.sara@gmail.com>2017-09-21 11:51:51 +0300
commit867006d2f81aa813c36f614fc6f1b98a5937c5f3 (patch)
treefb2c34b1b58db8b3610a4a47010196069e90c436 /server/src/main
parent719b12e44afc8b62458b1e29d1503e28544acc24 (diff)
downloadvaadin-framework-867006d2f81aa813c36f614fc6f1b98a5937c5f3.tar.gz
vaadin-framework-867006d2f81aa813c36f614fc6f1b98a5937c5f3.zip
Use String.isEmpty() (#10045)
Diffstat (limited to 'server/src/main')
-rw-r--r--server/src/main/java/com/vaadin/server/AbstractErrorMessage.java2
-rw-r--r--server/src/main/java/com/vaadin/server/BootstrapHandler.java2
-rw-r--r--server/src/main/java/com/vaadin/server/LegacyApplicationUIProvider.java2
-rw-r--r--server/src/main/java/com/vaadin/server/Page.java2
-rw-r--r--server/src/main/java/com/vaadin/server/SizeWithUnit.java2
-rw-r--r--server/src/main/java/com/vaadin/server/ThemeResource.java2
-rw-r--r--server/src/main/java/com/vaadin/server/VaadinServlet.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/ComboBox.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/CustomLayout.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/MenuBar.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/declarative/DesignContext.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java4
-rw-r--r--server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java2
15 files changed, 16 insertions, 16 deletions
diff --git a/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java b/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java
index 6ffbf6063e..cad1dc425d 100644
--- a/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java
+++ b/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java
@@ -129,7 +129,7 @@ public abstract class AbstractErrorMessage implements ErrorMessage {
sb.append("</div>\n");
}
}
- if (sb.length() > 0) {
+ if (sb.length() != 0) {
result = sb.toString();
}
}
diff --git a/server/src/main/java/com/vaadin/server/BootstrapHandler.java b/server/src/main/java/com/vaadin/server/BootstrapHandler.java
index 1cba25fbf6..6b43dc3a64 100644
--- a/server/src/main/java/com/vaadin/server/BootstrapHandler.java
+++ b/server/src/main/java/com/vaadin/server/BootstrapHandler.java
@@ -659,7 +659,7 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler {
mainDiv.addClass(context.getThemeName());
mainDiv.addClass(context.getUIClass().getSimpleName()
.toLowerCase(Locale.ENGLISH));
- if (style != null && style.length() != 0) {
+ if (style != null && !style.isEmpty()) {
mainDiv.attr("style", style);
}
mainDiv.appendElement("div").addClass("v-app-loading");
diff --git a/server/src/main/java/com/vaadin/server/LegacyApplicationUIProvider.java b/server/src/main/java/com/vaadin/server/LegacyApplicationUIProvider.java
index 4ad7097e3b..1128bc85fd 100644
--- a/server/src/main/java/com/vaadin/server/LegacyApplicationUIProvider.java
+++ b/server/src/main/java/com/vaadin/server/LegacyApplicationUIProvider.java
@@ -78,7 +78,7 @@ public abstract class LegacyApplicationUIProvider extends UIProvider {
VaadinRequest request = event.getRequest();
String pathInfo = request.getPathInfo();
String name = null;
- if (pathInfo != null && pathInfo.length() > 0) {
+ if (pathInfo != null && !pathInfo.isEmpty()) {
Matcher matcher = WINDOW_NAME_PATTERN.matcher(pathInfo);
if (matcher.matches()) {
// Skip the initial slash
diff --git a/server/src/main/java/com/vaadin/server/Page.java b/server/src/main/java/com/vaadin/server/Page.java
index 385aa0bf9a..4c880c2a6b 100644
--- a/server/src/main/java/com/vaadin/server/Page.java
+++ b/server/src/main/java/com/vaadin/server/Page.java
@@ -203,7 +203,7 @@ public class Page implements Serializable {
private void paintContent(PaintTarget target) throws PaintException {
target.startTag("open");
target.addAttribute("src", resource);
- if (name != null && name.length() > 0) {
+ if (name != null && !name.isEmpty()) {
target.addAttribute("name", name);
}
if (!tryToOpenAsPopup) {
diff --git a/server/src/main/java/com/vaadin/server/SizeWithUnit.java b/server/src/main/java/com/vaadin/server/SizeWithUnit.java
index b1b34e1fef..d5894f4e12 100644
--- a/server/src/main/java/com/vaadin/server/SizeWithUnit.java
+++ b/server/src/main/java/com/vaadin/server/SizeWithUnit.java
@@ -98,7 +98,7 @@ public class SizeWithUnit implements Serializable {
unit = Unit.PIXELS;
} else {
String symbol = matcher.group(2);
- if ((symbol != null && symbol.length() > 0)
+ if ((symbol != null && !symbol.isEmpty())
|| defaultUnit == null) {
unit = Unit.getUnitFromSymbol(symbol);
} else {
diff --git a/server/src/main/java/com/vaadin/server/ThemeResource.java b/server/src/main/java/com/vaadin/server/ThemeResource.java
index 8fc0a76bad..4410aa4cb7 100644
--- a/server/src/main/java/com/vaadin/server/ThemeResource.java
+++ b/server/src/main/java/com/vaadin/server/ThemeResource.java
@@ -45,7 +45,7 @@ public class ThemeResource implements Resource {
if (resourceId == null) {
throw new NullPointerException("Resource ID must not be null");
}
- if (resourceId.length() == 0) {
+ if (resourceId.isEmpty()) {
throw new IllegalArgumentException("Resource ID can not be empty");
}
if (resourceId.charAt(0) == '/') {
diff --git a/server/src/main/java/com/vaadin/server/VaadinServlet.java b/server/src/main/java/com/vaadin/server/VaadinServlet.java
index d2498dddfc..638eeb047f 100644
--- a/server/src/main/java/com/vaadin/server/VaadinServlet.java
+++ b/server/src/main/java/com/vaadin/server/VaadinServlet.java
@@ -1412,7 +1412,7 @@ public class VaadinServlet extends HttpServlet implements Constants {
servletPath = request.getContextPath() + request.getServletPath();
}
- if (servletPath.length() == 0
+ if (servletPath.isEmpty()
|| servletPath.charAt(servletPath.length() - 1) != '/') {
servletPath += "/";
}
diff --git a/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java
index a90f8e8d8a..43f78f7c1b 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java
+++ b/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java
@@ -476,7 +476,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout
// handle expand ratio
if (attr.hasKey(":expand")) {
String value = attr.get(":expand");
- if (value.length() > 0) {
+ if (!value.isEmpty()) {
try {
float ratio = Float.valueOf(value);
setExpandRatio(newChild, ratio);
diff --git a/server/src/main/java/com/vaadin/ui/ComboBox.java b/server/src/main/java/com/vaadin/ui/ComboBox.java
index af100e03f1..0d7e7fc619 100644
--- a/server/src/main/java/com/vaadin/ui/ComboBox.java
+++ b/server/src/main/java/com/vaadin/ui/ComboBox.java
@@ -155,7 +155,7 @@ public class ComboBox<T> extends AbstractSingleSelect<T>
public void createNewItem(String itemValue) {
// New option entered
if (getNewItemHandler() != null && itemValue != null
- && itemValue.length() > 0) {
+ && !itemValue.isEmpty()) {
getNewItemHandler().accept(itemValue);
}
}
diff --git a/server/src/main/java/com/vaadin/ui/CustomLayout.java b/server/src/main/java/com/vaadin/ui/CustomLayout.java
index 0293b0a648..d44a02f52e 100644
--- a/server/src/main/java/com/vaadin/ui/CustomLayout.java
+++ b/server/src/main/java/com/vaadin/ui/CustomLayout.java
@@ -307,7 +307,7 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent {
// Workaround to make the CommunicationManager read the template file
// and send it to the client
String templateName = getState(false).templateName;
- if (templateName != null && templateName.length() != 0) {
+ if (templateName != null && !templateName.isEmpty()) {
Set<Object> usedResources = ((JsonPaintTarget) target)
.getUsedResources();
String resourceName = "layouts/" + templateName + ".html";
diff --git a/server/src/main/java/com/vaadin/ui/MenuBar.java b/server/src/main/java/com/vaadin/ui/MenuBar.java
index 9cf60faddc..39d66bd0b0 100644
--- a/server/src/main/java/com/vaadin/ui/MenuBar.java
+++ b/server/src/main/java/com/vaadin/ui/MenuBar.java
@@ -139,7 +139,7 @@ public class MenuBar extends AbstractComponent
}
String description = item.getDescription();
- if (description != null && description.length() > 0) {
+ if (description != null && !description.isEmpty()) {
target.addAttribute(MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION,
description);
}
diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
index dde1624352..0fbfe9c6b5 100644
--- a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
+++ b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
@@ -327,7 +327,7 @@ public class DesignAttributeHandler implements Serializable {
String[] words = propertyName.split("(?<!^)(?=[A-Z])");
StringBuilder builder = new StringBuilder();
for (int i = 0; i < words.length; i++) {
- if (builder.length() > 0) {
+ if (builder.length() != 0) {
builder.append("-");
}
builder.append(words[i].toLowerCase());
diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java b/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java
index e3237ada53..042fa77826 100644
--- a/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java
+++ b/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java
@@ -530,7 +530,7 @@ public class DesignContext implements Serializable {
// global id: only update the mapping, the id has already been set for
// the component
String id = component.getId();
- if (id != null && id.length() > 0) {
+ if (id != null && !id.isEmpty()) {
boolean mappingExists = mapId(id, component);
if (mappingExists) {
throw new DesignException(
diff --git a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java
index f860e30e7c..dfd7033430 100644
--- a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java
+++ b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java
@@ -176,7 +176,7 @@ public class FieldBinder implements Serializable {
try {
// create and validate field name
String fieldName = asFieldName(identifier);
- if (fieldName.length() == 0) {
+ if (fieldName.isEmpty()) {
return false;
}
// validate that the field can be found
@@ -231,7 +231,7 @@ public class FieldBinder implements Serializable {
}
}
// lowercase first letter
- if (result.length() > 0 && Character.isLetter(result.charAt(0))) {
+ if (result.length() != 0 && Character.isLetter(result.charAt(0))) {
result.setCharAt(0, Character.toLowerCase(result.charAt(0)));
}
return result.toString();
diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java
index b4f38928a9..aade7e80b7 100644
--- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java
+++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java
@@ -123,7 +123,7 @@ public class DesignShortcutActionConverter
@Override
public Result<ShortcutAction> convertToModel(String value,
ValueContext context) {
- if (value.length() == 0) {
+ if (value.isEmpty()) {
return Result.ok(null);
}