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 | |
parent | d8baecb239b0d91f477c450d2a08a472b169a08d (diff) | |
download | vaadin-framework-f6e082f5172d791a49d98a6b6b7770d3b38c8695.tar.gz vaadin-framework-f6e082f5172d791a49d98a6b6b7770d3b38c8695.zip |
Use String.isEmpty()
44 files changed, 78 insertions, 78 deletions
diff --git a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java index 4c2583e493..0ee4a4f708 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java @@ -416,7 +416,7 @@ public class ApplicationConfiguration implements EntryPoint { JsoConfiguration jsoConfiguration = getJsoConfiguration(id); serviceUrl = jsoConfiguration .getConfigString(ApplicationConstants.SERVICE_URL); - if (serviceUrl == null || "".equals(serviceUrl)) { + if (serviceUrl == null || serviceUrl.isEmpty()) { /* * Use the current url without query parameters and fragment as the * default value. diff --git a/client/src/main/java/com/vaadin/client/BrowserInfo.java b/client/src/main/java/com/vaadin/client/BrowserInfo.java index 1cbbb2145d..6e0b858990 100644 --- a/client/src/main/java/com/vaadin/client/BrowserInfo.java +++ b/client/src/main/java/com/vaadin/client/BrowserInfo.java @@ -197,13 +197,13 @@ public class BrowserInfo { } cssClass = prefix + browserIdentifier; - if (!"".equals(majorVersionClass)) { + if (!majorVersionClass.isEmpty()) { cssClass = cssClass + " " + prefix + majorVersionClass; } - if (!"".equals(minorVersionClass)) { + if (!minorVersionClass.isEmpty()) { cssClass = cssClass + " " + prefix + minorVersionClass; } - if (!"".equals(browserEngineClass)) { + if (!browserEngineClass.isEmpty()) { cssClass = cssClass + " " + prefix + browserEngineClass; } String osClass = getOperatingSystemClass(); diff --git a/client/src/main/java/com/vaadin/client/SuperDevMode.java b/client/src/main/java/com/vaadin/client/SuperDevMode.java index ce371c030d..e8eab082d1 100644 --- a/client/src/main/java/com/vaadin/client/SuperDevMode.java +++ b/client/src/main/java/com/vaadin/client/SuperDevMode.java @@ -184,7 +184,7 @@ public class SuperDevMode { * SuperDevMode */ protected static boolean recompileIfNeeded(String serverUrl) { - if (serverUrl == null || "".equals(serverUrl)) { + if (serverUrl == null || serverUrl.isEmpty()) { serverUrl = "http://localhost:9876/"; } else { if (serverUrl.contains(":")) { diff --git a/client/src/main/java/com/vaadin/client/VCaption.java b/client/src/main/java/com/vaadin/client/VCaption.java index 0ed0bc037c..8da36becfa 100644 --- a/client/src/main/java/com/vaadin/client/VCaption.java +++ b/client/src/main/java/com/vaadin/client/VCaption.java @@ -207,7 +207,7 @@ public class VCaption extends HTML { String c = owner.getState().caption; // A text forces the caption to be above the component. placedAfterComponent = false; - if (c == null || c.trim().equals("")) { + if (c == null || c.trim().isEmpty()) { // Not sure if c even can be null. Should not. // This is required to ensure that the caption uses space in all @@ -378,7 +378,7 @@ public class VCaption extends HTML { // Update caption text // A text forces the caption to be above the component. placedAfterComponent = false; - if (caption.trim().equals("")) { + if (caption.trim().isEmpty()) { // This is required to ensure that the caption uses space in all // browsers when it is set to the empty string. If there is an // icon, error indicator or required indicator they will ensure @@ -434,7 +434,7 @@ public class VCaption extends HTML { setMaxWidth(maxWidth); } else { String width = getElement().getStyle().getProperty("width"); - if (width != null && !width.equals("")) { + if (width != null && !width.isEmpty()) { setWidth(getRequiredWidth() + "px"); } } diff --git a/client/src/main/java/com/vaadin/client/WidgetUtil.java b/client/src/main/java/com/vaadin/client/WidgetUtil.java index d42ba541c6..c9e49f13c0 100644 --- a/client/src/main/java/com/vaadin/client/WidgetUtil.java +++ b/client/src/main/java/com/vaadin/client/WidgetUtil.java @@ -280,7 +280,7 @@ public class WidgetUtil { public static int setHeightExcludingPaddingAndBorder(Widget widget, String height, int paddingBorderGuess) { - if (height.equals("")) { + if (height.isEmpty()) { setHeight(widget, ""); return paddingBorderGuess; } else if (height.endsWith("px")) { @@ -307,7 +307,7 @@ public class WidgetUtil { public static int setWidthExcludingPaddingAndBorder(Widget widget, String width, int paddingBorderGuess) { - if (width.equals("")) { + if (width.isEmpty()) { setWidth(widget, ""); return paddingBorderGuess; } else if (width.endsWith("px")) { @@ -1477,7 +1477,7 @@ public class WidgetUtil { } s = s.trim(); - if ("".equals(s)) { + if (s.isEmpty()) { return null; } diff --git a/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java b/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java index ad5a33c02e..dca4ad7b3a 100644 --- a/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java +++ b/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java @@ -508,7 +508,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy { if (part.equals(ROOT_ID)) { w = RootPanel.get(); - } else if (part.equals("")) { + } else if (part.isEmpty()) { if (w == null) { w = client.getUIConnector().getWidget(); } diff --git a/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java b/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java index 314d167bfe..f18ecb0711 100644 --- a/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java +++ b/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java @@ -350,7 +350,7 @@ public class ResponsiveConnector extends AbstractExtensionConnector // Loop through breakpoints and see which one applies to this width currentWidthRanges = resolveBreakpoint("width", width); - if (!"".equals(currentWidthRanges)) { + if (!currentWidthRanges.isEmpty()) { element.setAttribute("width-range", currentWidthRanges); } else { element.removeAttribute("width-range"); @@ -359,7 +359,7 @@ public class ResponsiveConnector extends AbstractExtensionConnector // Loop through breakpoints and see which one applies to this height currentHeightRanges = resolveBreakpoint("height", height); - if (!"".equals(currentHeightRanges)) { + if (!currentHeightRanges.isEmpty()) { element.setAttribute("height-range", currentHeightRanges); } else { element.removeAttribute("height-range"); diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java index 8623bc1d76..7ce3e5c9b7 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java @@ -771,10 +771,10 @@ public abstract class AbstractComponentConnector extends AbstractConnector public boolean hasTooltip() { // Normally, there is a tooltip if description or errorMessage is set AbstractComponentState state = getState(); - if (state.description != null && !state.description.equals("")) { + if (state.description != null && !state.description.isEmpty()) { return true; } - return state.errorMessage != null && !state.errorMessage.equals(""); + return state.errorMessage != null && !state.errorMessage.isEmpty(); } /** diff --git a/client/src/main/java/com/vaadin/client/ui/MediaBaseConnector.java b/client/src/main/java/com/vaadin/client/ui/MediaBaseConnector.java index 9e457fa150..33624b8703 100644 --- a/client/src/main/java/com/vaadin/client/ui/MediaBaseConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/MediaBaseConnector.java @@ -78,7 +78,7 @@ public abstract class MediaBaseConnector extends AbstractComponentConnector { private void setAltText(String altText) { - if (altText == null || "".equals(altText)) { + if (altText == null || altText.isEmpty()) { altText = getDefaultAltHtml(); } else if (!getState().htmlContentAllowed) { altText = WidgetUtil.escapeHTML(altText); diff --git a/client/src/main/java/com/vaadin/client/ui/VAbsoluteLayout.java b/client/src/main/java/com/vaadin/client/ui/VAbsoluteLayout.java index 3ccdcdbee9..935706babd 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbsoluteLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbsoluteLayout.java @@ -429,7 +429,7 @@ public class VAbsoluteLayout extends ComplexPanel { if (css == null || !css.equals(position)) { css = position; top = right = bottom = left = zIndex = null; - if (!css.equals("")) { + if (!css.isEmpty()) { String[] properties = css.split(";"); for (int i = 0; i < properties.length; i++) { String[] keyValue = properties[i].split(":"); diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java b/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java index fd50c92aed..c9c6df01f4 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java @@ -207,7 +207,7 @@ public abstract class VAbstractTextualDate<R extends Enum<R>> @Override @SuppressWarnings("deprecation") public void onChange(ChangeEvent event) { - if (!text.getText().equals("")) { + if (!text.getText().isEmpty()) { try { String enteredDate = text.getText(); diff --git a/client/src/main/java/com/vaadin/client/ui/VComboBox.java b/client/src/main/java/com/vaadin/client/ui/VComboBox.java index 784f2b116d..93ac755ee1 100644 --- a/client/src/main/java/com/vaadin/client/ui/VComboBox.java +++ b/client/src/main/java/com/vaadin/client/ui/VComboBox.java @@ -1141,7 +1141,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, // stays selected if (!"".equals(enteredItemValue) || selectedOptionKey != null - && !"".equals(selectedOptionKey)) { + && !selectedOptionKey.isEmpty()) { doItemAction(potentialExactMatch, true); } suggestionPopup.hide(); @@ -1165,7 +1165,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, } else { // currentSuggestion has key="" for nullselection if (currentSuggestion != null - && !currentSuggestion.key.equals("")) { + && !currentSuggestion.key.isEmpty()) { // An item (not null) selected String text = currentSuggestion.getReplacementString(); setText(text); @@ -1867,7 +1867,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, // when filtering, let the server decide the page unless we've // set the filter to empty and explicitly said that we want to see // the results starting from page 0. - if ("".equals(filter) && page != 0) { + if (filter.isEmpty() && page != 0) { // let server decide page = -1; } else { @@ -1964,7 +1964,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, + suggestion.key + ")"); } // special handling of null selection - if (suggestion.key.equals("")) { + if (suggestion.key.isEmpty()) { onNullSelected(); return; } @@ -2074,7 +2074,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, */ private void performSelection(String selectedKey, boolean forceUpdateText, boolean updatePromptAndSelectionIfMatchFound) { - if (selectedKey == null || "".equals(selectedKey)) { + if (selectedKey == null || selectedKey.isEmpty()) { currentSuggestion = null; // #13217 selectedOptionKey = null; setText(getEmptySelectionCaption()); @@ -2357,7 +2357,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, setText(text == null ? getEmptySelectionCaption() : text); setSelectedItemIcon(connector.getState().selectedItemIcon); selectedOptionKey = (connector.getState().selectedItemKey); - if (selectedOptionKey == null || "".equals(selectedOptionKey)) { + if (selectedOptionKey == null || selectedOptionKey.isEmpty()) { currentSuggestion = null; // #13217 selectedOptionKey = null; updatePlaceholder(); diff --git a/client/src/main/java/com/vaadin/client/ui/VLabel.java b/client/src/main/java/com/vaadin/client/ui/VLabel.java index f3d64108b4..3e596a21ab 100644 --- a/client/src/main/java/com/vaadin/client/ui/VLabel.java +++ b/client/src/main/java/com/vaadin/client/ui/VLabel.java @@ -50,7 +50,7 @@ public class VLabel extends HTML { @Override public void setWidth(String width) { super.setWidth(width); - if (width == null || width.equals("")) { + if (width == null || width.isEmpty()) { setStyleName(getElement(), CLASSNAME_UNDEFINED_WIDTH, true); } else { setStyleName(getElement(), CLASSNAME_UNDEFINED_WIDTH, false); diff --git a/client/src/main/java/com/vaadin/client/ui/VOverlay.java b/client/src/main/java/com/vaadin/client/ui/VOverlay.java index 5681df286f..4d0c8d2914 100644 --- a/client/src/main/java/com/vaadin/client/ui/VOverlay.java +++ b/client/src/main/java/com/vaadin/client/ui/VOverlay.java @@ -136,7 +136,7 @@ public class VOverlay extends Overlay { container.setId(id); String styles = ac.getUIConnector().getWidget().getParent() .getStyleName(); - if (styles != null && !styles.equals("")) { + if (styles != null && !styles.isEmpty()) { container.addClassName(styles); } container.addClassName(CLASSNAME_CONTAINER); diff --git a/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java b/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java index 75bec94dca..b0f9a6a510 100644 --- a/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java +++ b/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java @@ -234,14 +234,14 @@ public class VRichTextArea extends Composite implements Field, KeyPressHandler, @Override public void setHeight(String height) { super.setHeight(height); - if (height == null || height.equals("")) { + if (height == null || height.isEmpty()) { rta.setHeight(""); } } @Override public void setWidth(String width) { - if (width.equals("")) { + if (width.isEmpty()) { /* * IE cannot calculate the width of the 100% iframe correctly if * there is no width specified for the parent. In this case we would diff --git a/client/src/main/java/com/vaadin/client/ui/VUpload.java b/client/src/main/java/com/vaadin/client/ui/VUpload.java index a6d4875ec1..d25508d29a 100644 --- a/client/src/main/java/com/vaadin/client/ui/VUpload.java +++ b/client/src/main/java/com/vaadin/client/ui/VUpload.java @@ -59,7 +59,7 @@ public class VUpload extends SimplePanel { super.onBrowserEvent(event); if (event.getTypeInt() == Event.ONCHANGE) { if (isImmediateMode() && fu.getFilename() != null - && !"".equals(fu.getFilename())) { + && !fu.getFilename().isEmpty()) { submit(); } } else if (BrowserInfo.get().isIE() diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java index e027775793..da08413926 100644 --- a/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java @@ -50,7 +50,7 @@ public abstract class AbstractColorPickerConnector refreshColor(); if (getState().showDefaultCaption && (getState().caption == null - || "".equals(getState().caption))) { + || getState().caption.isEmpty())) { setCaption(getState().color); } @@ -79,7 +79,7 @@ public abstract class AbstractColorPickerConnector */ protected String getCaption() { if (getState().showDefaultCaption && (getState().caption == null - || "".equals(getState().caption))) { + || getState().caption.isEmpty())) { return getState().color; } return getState().caption; diff --git a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java index 9d37afc8a5..2b3db9aa65 100644 --- a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java @@ -210,7 +210,7 @@ public class ComboBoxConnector extends AbstractListingConnector page = 0; } } - int adjustment = getWidget().nullSelectionAllowed && "".equals(filter) + int adjustment = getWidget().nullSelectionAllowed && filter.isEmpty() ? 1 : 0; int startIndex = Math.max(0, page * getWidget().pageLength - adjustment); diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java index 8755bea650..d8e0544aaf 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java @@ -538,7 +538,7 @@ public class Slot extends SimplePanel { this.captionText.addClassName("v-captiontext"); caption.appendChild(this.captionText); } - if (captionText.trim().equals("")) { + if (captionText.trim().isEmpty()) { this.captionText.setInnerHTML(" "); } else { if (captionAsHtml) { diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java index 1148ab90ad..d226e0b5dc 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java @@ -715,7 +715,7 @@ public class VAbstractOrderedLayout extends FlowPanel { @Override public void setHeight(String height) { super.setHeight(height); - definedHeight = (height != null && !"".equals(height)); + definedHeight = height != null && !height.isEmpty(); } /** diff --git a/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java b/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java index 5e22b9ef32..84ed73e537 100644 --- a/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java @@ -96,7 +96,7 @@ public class PanelConnector extends AbstractSingleComponentContainerConnector .setClassName(VPanel.CLASSNAME + "-deco"); getWidget().captionNode.setClassName(VPanel.CLASSNAME + "-caption"); boolean hasCaption = false; - if (getState().caption != null && !"".equals(getState().caption)) { + if (getState().caption != null && !getState().caption.isEmpty()) { getWidget().setCaption(getState().caption); hasCaption = true; } else { 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")); } diff --git a/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java b/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java index 883ade868e..0ef247353b 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java +++ b/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java @@ -29,16 +29,16 @@ public final class ComponentStateUtil implements Serializable { } public static final boolean isUndefinedWidth(AbstractComponentState state) { - return state.width == null || "".equals(state.width); + return state.width == null || state.width.isEmpty(); } public static final boolean isUndefinedHeight( AbstractComponentState state) { - return state.height == null || "".equals(state.height); + return state.height == null || state.height.isEmpty(); } public static final boolean hasDescription(AbstractComponentState state) { - return state.description != null && !"".equals(state.description); + return state.description != null && !state.description.isEmpty(); } public static final boolean hasStyles(AbstractComponentState state) { diff --git a/test/servlet-containers/generic/src/test/java/com/vaadin/tests/integration/AbstractIntegrationTest.java b/test/servlet-containers/generic/src/test/java/com/vaadin/tests/integration/AbstractIntegrationTest.java index 6a948f63d8..10ad299a4b 100644 --- a/test/servlet-containers/generic/src/test/java/com/vaadin/tests/integration/AbstractIntegrationTest.java +++ b/test/servlet-containers/generic/src/test/java/com/vaadin/tests/integration/AbstractIntegrationTest.java @@ -87,7 +87,7 @@ public abstract class AbstractIntegrationTest extends ParallelTest { private String getDeploymentURL() { String deploymentUrl = System.getProperty("deployment.url"); - if (deploymentUrl == null || deploymentUrl.equals("")) { + if (deploymentUrl == null || deploymentUrl.isEmpty()) { throw new RuntimeException( "Deployment url must be given as deployment.url"); } diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/AbstractComponentElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/AbstractComponentElement.java index e219b53a04..7a4963d4ab 100644 --- a/testbench-api/src/main/java/com/vaadin/testbench/elements/AbstractComponentElement.java +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/AbstractComponentElement.java @@ -36,7 +36,7 @@ public class AbstractComponentElement extends AbstractElement { captionId = getAttribute(GWT_ID_ATTRIBUTE); // IE8 getAttribute returns empty string instead of null // when there is no attribute with specified name - if (captionId == null || captionId.equals("")) { + if (captionId == null || captionId.isEmpty()) { WebElement elem = findElement( By.xpath(".//*[@" + GWT_ID_ATTRIBUTE + "]")); captionId = elem.getAttribute(GWT_ID_ATTRIBUTE); diff --git a/uitest/src/main/java/com/vaadin/tests/TestBench.java b/uitest/src/main/java/com/vaadin/tests/TestBench.java index 076d02b4be..7de6e4e2c5 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestBench.java +++ b/uitest/src/main/java/com/vaadin/tests/TestBench.java @@ -134,7 +134,7 @@ public class TestBench extends com.vaadin.server.LegacyApplication public void uriFragmentChanged( UriFragmentChangedEvent source) { String fragment = source.getUriFragment(); - if (fragment != null && !"".equals(fragment)) { + if (fragment != null && !fragment.isEmpty()) { // try to find a proper test class // exact match diff --git a/uitest/src/main/java/com/vaadin/tests/components/TestBase.java b/uitest/src/main/java/com/vaadin/tests/components/TestBase.java index 9a3906bdc0..9e638682ce 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/TestBase.java +++ b/uitest/src/main/java/com/vaadin/tests/components/TestBase.java @@ -22,7 +22,7 @@ public abstract class TestBase extends AbstractTestCase { window.getContent().setSizeFull(); Label label = new Label(getDescription(), ContentMode.HTML); - if (label.getValue() == null || "".equals(label.getValue())) { + if (label.getValue() == null || label.getValue().isEmpty()) { // This is only an ugly hack to be screenshot compatible to be able // to detect real problems when introducing IE font-size/line-height // fixes diff --git a/uitest/src/main/java/com/vaadin/tests/components/popupview/PopupViewWithRTE.java b/uitest/src/main/java/com/vaadin/tests/components/popupview/PopupViewWithRTE.java index 069ccef2bb..a411013ae3 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/popupview/PopupViewWithRTE.java +++ b/uitest/src/main/java/com/vaadin/tests/components/popupview/PopupViewWithRTE.java @@ -30,7 +30,7 @@ public class PopupViewWithRTE extends TestBase { @Override public String getMinimizedValueAsHTML() { String value = rte.getValue(); - if (value == null || "".equals(value)) { + if (value == null || value.isEmpty()) { value = "Initial <b>content</b> for <h3>rte</h3>."; rte.setValue(value); rte.setHeight("150px"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/ItemClickEvents.java b/uitest/src/main/java/com/vaadin/tests/components/table/ItemClickEvents.java index f5e62adfc8..1fbc932374 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/ItemClickEvents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/ItemClickEvents.java @@ -123,7 +123,7 @@ public class ItemClickEvents extends AbstractReindeerTestUI { if (event.isShiftKey()) { modifiers += "shift "; } - if (!"".equals(modifiers)) { + if (!modifiers.isEmpty()) { modifiers = " (" + modifiers.trim() + ")"; } diff --git a/uitest/src/main/java/com/vaadin/tests/components/ui/MultiFileUploadTest.java b/uitest/src/main/java/com/vaadin/tests/components/ui/MultiFileUploadTest.java index 0533099a54..ffa9b55b3a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/ui/MultiFileUploadTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/ui/MultiFileUploadTest.java @@ -39,7 +39,7 @@ public class MultiFileUploadTest extends AbstractTestUIWithLog { @Override public void filenameChanged(ChangeEvent event) { - if (event.getFilename().equals("")) { + if (event.getFilename().isEmpty()) { removeUpload(event.getSource()); } else { addUpload(); diff --git a/uitest/src/main/java/com/vaadin/tests/dd/DDTest5.java b/uitest/src/main/java/com/vaadin/tests/dd/DDTest5.java index e932c02505..a5ad3c3f9c 100644 --- a/uitest/src/main/java/com/vaadin/tests/dd/DDTest5.java +++ b/uitest/src/main/java/com/vaadin/tests/dd/DDTest5.java @@ -147,7 +147,7 @@ public class DDTest5 extends TestBase { String data = (String) dropEvent.getTransferable() .getData("text/plain"); - if (data == null || "".equals(data)) { + if (data == null || data.isEmpty()) { data = "-- no Text --"; } cssLayout.addComponent(new WrappedLabel(data)); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/ValoThemeUI.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/ValoThemeUI.java index 4ec83dc6ec..c4a50bf0d1 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/ValoThemeUI.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/ValoThemeUI.java @@ -133,7 +133,7 @@ public class ValoThemeUI extends UI { navigator.addView("dragging", Dragging.class); String f = Page.getCurrent().getUriFragment(); - if (f == null || f.equals("")) { + if (f == null || f.isEmpty()) { navigator.navigateTo("common"); } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/treetable/TreeTableElementExpandRowTest.java b/uitest/src/test/java/com/vaadin/tests/elements/treetable/TreeTableElementExpandRowTest.java index 49847ae0b6..e20a6dd4ab 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/treetable/TreeTableElementExpandRowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/treetable/TreeTableElementExpandRowTest.java @@ -48,7 +48,7 @@ public class TreeTableElementExpandRowTest extends MultiBrowserTest { TreeTableRowElement row = tree.getRow(rowIndex); WebElement cell = row.getCell(0); String errorMessage = ""; - if (extraInfo != null && !extraInfo.equals("")) { + if (extraInfo != null && !extraInfo.isEmpty()) { errorMessage += extraInfo; } errorMessage += "Return value of row=" + rowIndex + " cell=0 should be " diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java index 5985420c93..3d2c8e8481 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -771,7 +771,7 @@ public abstract class AbstractTB3Test extends ParallelTest { // Remove any possible URL parameters String pathWithoutQueryParameters = pathWithQueryParameters .replaceAll("\\?.*", ""); - if ("".equals(pathWithoutQueryParameters)) { + if (pathWithoutQueryParameters.isEmpty()) { return "ROOT"; } diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java index abee2c1c2c..aae9b3e13f 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java @@ -211,7 +211,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { public static String getConfiguredDeploymentHostname() { String hostName = getProperty(HOSTNAME_PROPERTY); - if (hostName == null || "".equals(hostName)) { + if (hostName == null || hostName.isEmpty()) { hostName = findAutoHostname(); } @@ -232,7 +232,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { String portString = getProperty(PORT_PROPERTY); int port = 8888; - if (portString != null && !"".equals(portString)) { + if (portString != null && !portString.isEmpty()) { port = Integer.parseInt(portString); } diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/TooltipTest.java b/uitest/src/test/java/com/vaadin/tests/tb3/TooltipTest.java index d58eca573f..9c99818a96 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/TooltipTest.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/TooltipTest.java @@ -91,7 +91,7 @@ public abstract class TooltipTest extends MultiBrowserTest { protected void checkTooltipNotPresent() throws Exception { try { WebElement tooltip = getTooltip(); - if (!"".equals(tooltip.getText()) + if (!tooltip.getText().isEmpty() || tooltip.getLocation().getX() > -999) { Assert.fail("Found tooltip that shouldn't be visible: " + tooltip.getText() + " at " + tooltip.getLocation()); diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnReorderTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnReorderTest.java index aac48dc4d2..bc10780ef6 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnReorderTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnReorderTest.java @@ -253,7 +253,7 @@ public class GridColumnReorderTest extends GridBasicFeaturesTest { toggleColumnReordering(); selectMenuPath("Component", "State", "Selection mode", "multi"); List<TestBenchElement> gridHeaderRowCells = getGridHeaderRowCells(); - assertTrue(gridHeaderRowCells.get(0).getText().equals("")); + assertTrue(gridHeaderRowCells.get(0).getText().isEmpty()); assertColumnHeader("Column 0", gridHeaderRowCells.get(1)); assertColumnHeader("Column 1", gridHeaderRowCells.get(2)); assertColumnHeader("Column 2", gridHeaderRowCells.get(3)); @@ -263,7 +263,7 @@ public class GridColumnReorderTest extends GridBasicFeaturesTest { // then gridHeaderRowCells = getGridHeaderRowCells(); - assertTrue(gridHeaderRowCells.get(0).getText().equals("")); + assertTrue(gridHeaderRowCells.get(0).getText().isEmpty()); assertColumnHeader("Column 1", gridHeaderRowCells.get(1)); assertColumnHeader("Column 0", gridHeaderRowCells.get(2)); assertColumnHeader("Column 2", gridHeaderRowCells.get(3)); @@ -277,7 +277,7 @@ public class GridColumnReorderTest extends GridBasicFeaturesTest { selectMenuPath("Component", "State", "Selection mode", "multi"); setFrozenColumns(1); List<TestBenchElement> gridHeaderRowCells = getGridHeaderRowCells(); - assertTrue(gridHeaderRowCells.get(0).getText().equals("")); + assertTrue(gridHeaderRowCells.get(0).getText().isEmpty()); assertColumnHeader("Column 0", gridHeaderRowCells.get(1)); assertColumnHeader("Column 1", gridHeaderRowCells.get(2)); assertColumnHeader("Column 2", gridHeaderRowCells.get(3)); @@ -287,7 +287,7 @@ public class GridColumnReorderTest extends GridBasicFeaturesTest { // then gridHeaderRowCells = getGridHeaderRowCells(); - assertTrue(gridHeaderRowCells.get(0).getText().equals("")); + assertTrue(gridHeaderRowCells.get(0).getText().isEmpty()); assertColumnHeader("Column 0", gridHeaderRowCells.get(1)); assertColumnHeader("Column 2", gridHeaderRowCells.get(2)); assertColumnHeader("Column 1", gridHeaderRowCells.get(3)); @@ -301,7 +301,7 @@ public class GridColumnReorderTest extends GridBasicFeaturesTest { selectMenuPath("Component", "State", "Selection mode", "multi"); setFrozenColumns(-1); List<TestBenchElement> gridHeaderRowCells = getGridHeaderRowCells(); - assertTrue(gridHeaderRowCells.get(0).getText().equals("")); + assertTrue(gridHeaderRowCells.get(0).getText().isEmpty()); assertColumnHeader("Column 0", gridHeaderRowCells.get(1)); assertColumnHeader("Column 1", gridHeaderRowCells.get(2)); assertColumnHeader("Column 2", gridHeaderRowCells.get(3)); @@ -311,7 +311,7 @@ public class GridColumnReorderTest extends GridBasicFeaturesTest { // then gridHeaderRowCells = getGridHeaderRowCells(); - assertTrue(gridHeaderRowCells.get(0).getText().equals("")); + assertTrue(gridHeaderRowCells.get(0).getText().isEmpty()); assertColumnHeader("Column 1", gridHeaderRowCells.get(1)); assertColumnHeader("Column 0", gridHeaderRowCells.get(2)); assertColumnHeader("Column 2", gridHeaderRowCells.get(3)); |