diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-10-20 10:10:02 +0200 |
---|---|---|
committer | Péter Török <31210544+torok-peter@users.noreply.github.com> | 2017-10-20 11:10:02 +0300 |
commit | a9c83ba07e4dec90eb7d6e332b91adde9613ebb4 (patch) | |
tree | 7907a6c389ae740572197d949e27c6fd3c25491c | |
parent | 0a26d0e44169f9643e7d30ba370b8ecbbe128a56 (diff) | |
download | vaadin-framework-a9c83ba07e4dec90eb7d6e332b91adde9613ebb4.tar.gz vaadin-framework-a9c83ba07e4dec90eb7d6e332b91adde9613ebb4.zip |
Use .toLowerCase and .toUpperCase(Locale.ROOT) (#10182)
* Use .toLowerCase and .toUpperCase(Locale.ROOT)
* Spaces
* add spaces after if(
106 files changed, 444 insertions, 309 deletions
diff --git a/client/src/main/java/com/vaadin/client/CSSRule.java b/client/src/main/java/com/vaadin/client/CSSRule.java index b351d9c36b..c425fbd2ce 100644 --- a/client/src/main/java/com/vaadin/client/CSSRule.java +++ b/client/src/main/java/com/vaadin/client/CSSRule.java @@ -64,7 +64,7 @@ public class CSSRule { if (!$doc.styleSheets) return null; - selector = selector.toLowerCase(); + selector = selector.toLowerCase('en'); var allMatches = []; @@ -87,7 +87,7 @@ public class CSSRule { for (var i=0; i<j; i++) { var r = theRules[i]; if (r.type == 1 || sheet.imports) { - var selectors = r.selectorText.toLowerCase().split(","); + var selectors = r.selectorText.toLowerCase('en').split(","); var n = selectors.length; for (var m=0; m<n; m++) { if (selectors[m].replace(/^\s+|\s+$/g, "") == selector) { diff --git a/client/src/main/java/com/vaadin/client/ComputedStyle.java b/client/src/main/java/com/vaadin/client/ComputedStyle.java index 7d2b3fb732..b54ee64ed4 100644 --- a/client/src/main/java/com/vaadin/client/ComputedStyle.java +++ b/client/src/main/java/com/vaadin/client/ComputedStyle.java @@ -83,7 +83,7 @@ public class ComputedStyle { if (cs.getPropertyValue) { // Convert name to dashed format - name = name.replace(/([A-Z])/g, "-$1").toLowerCase(); + name = name.replace(/([A-Z])/g, "-$1").toLowerCase('en'); var ret = cs.getPropertyValue(name); } else { diff --git a/client/src/main/java/com/vaadin/client/WidgetUtil.java b/client/src/main/java/com/vaadin/client/WidgetUtil.java index 7d54ac7650..94439dc945 100644 --- a/client/src/main/java/com/vaadin/client/WidgetUtil.java +++ b/client/src/main/java/com/vaadin/client/WidgetUtil.java @@ -18,6 +18,7 @@ package com.vaadin.client; import java.io.Serializable; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.logging.Logger; @@ -1888,7 +1889,7 @@ public class WidgetUtil { ErrorLevel errorLevel) { for (ErrorLevel errorLevelValue : ErrorLevel.values()) { String className = prefix + "-" - + errorLevelValue.toString().toLowerCase(); + + errorLevelValue.toString().toLowerCase(Locale.ROOT); if (errorLevel == errorLevelValue) { element.addClassName(className); } else { diff --git a/client/src/main/java/com/vaadin/client/debug/internal/SelectorPath.java b/client/src/main/java/com/vaadin/client/debug/internal/SelectorPath.java index 07da3fbd4a..19a1682f49 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/SelectorPath.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/SelectorPath.java @@ -18,6 +18,7 @@ package com.vaadin.client.debug.internal; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import com.google.gwt.dom.client.Element; @@ -199,7 +200,7 @@ public class SelectorPath { name = getNameWithCount(name); // Use direct path and elementX naming style. - return "WebElement " + name.substring(0, 1).toLowerCase() + return "WebElement " + name.substring(0, 1).toLowerCase(Locale.ROOT) + name.substring(1) + " = getDriver().findElement(By.vaadin(\"" + path + "\"));"; } @@ -242,7 +243,8 @@ public class SelectorPath { name = name.replaceAll("\\W", ""); // Lowercase the first character of name - return elementType + "Element " + name.substring(0, 1).toLowerCase() + return elementType + "Element " + + name.substring(0, 1).toLowerCase(Locale.ROOT) + name.substring(1) + " = "; } diff --git a/client/src/main/java/com/vaadin/client/event/PointerEventSupportImpl.java b/client/src/main/java/com/vaadin/client/event/PointerEventSupportImpl.java index 9ceeb86994..3fa3ecd6eb 100644 --- a/client/src/main/java/com/vaadin/client/event/PointerEventSupportImpl.java +++ b/client/src/main/java/com/vaadin/client/event/PointerEventSupportImpl.java @@ -15,6 +15,8 @@ */ package com.vaadin.client.event; +import java.util.Locale; + import com.vaadin.client.event.PointerEvent.EventType; /** @@ -38,7 +40,7 @@ public class PointerEventSupportImpl { * @return the native event name of the given event */ public String getNativeEventName(EventType eventName) { - return eventName.toString().toLowerCase(); + return eventName.toString().toLowerCase(Locale.ROOT); } /** diff --git a/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java b/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java index cb2870cf7a..52b9d1f0ea 100644 --- a/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java +++ b/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java @@ -16,6 +16,7 @@ package com.vaadin.client.extensions; import java.util.LinkedHashMap; +import java.util.Locale; import java.util.Map; import java.util.logging.Logger; @@ -490,7 +491,7 @@ public class DragSourceExtensionConnector extends AbstractExtensionConnector { assert dropEffect != null : "Drop effect should never be null"; sendDragEndEventToServer(nativeEvent, - DropEffect.valueOf(dropEffect.toUpperCase())); + DropEffect.valueOf(dropEffect.toUpperCase(Locale.ROOT))); } } diff --git a/client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java b/client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java index 3791db53b4..b9ce983dab 100644 --- a/client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java +++ b/client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -219,7 +220,8 @@ public class DropTargetExtensionConnector extends AbstractExtensionConnector { DataTransfer.DropEffect dropEffect = DataTransfer.DropEffect // the valueOf() needs to have equal string and name() // doesn't return in all upper case - .valueOf(getState().dropEffect.name().toUpperCase()); + .valueOf(getState().dropEffect.name() + .toUpperCase(Locale.ROOT)); event.getDataTransfer().setDropEffect(dropEffect); } } @@ -283,13 +285,13 @@ public class DropTargetExtensionConnector extends AbstractExtensionConnector { JsArrayString typesJsArray = getTypes( nativeEvent.getDataTransfer()); - /* Handle event if transfer doesn't contain files. + /* + * Handle event if transfer doesn't contain files. * * Spec: "Dragging files can currently only happen from outside a * browsing context, for example from a file system manager - * application." - * Thus there cannot be at the same time both files and other data - * dragged + * application." Thus there cannot be at the same time both files + * and other data dragged */ if (!containsFiles(typesJsArray)) { nativeEvent.preventDefault(); @@ -304,7 +306,8 @@ public class DropTargetExtensionConnector extends AbstractExtensionConnector { } sendDropEventToServer(types, data, DragSourceExtensionConnector - .getDropEffect(nativeEvent.getDataTransfer()), nativeEvent); + .getDropEffect(nativeEvent.getDataTransfer()), + nativeEvent); } } @@ -332,8 +335,8 @@ public class DropTargetExtensionConnector extends AbstractExtensionConnector { } // Execute criterion defined via API - if (allowed && getState().criteria != null && !getState().criteria - .isEmpty()) { + if (allowed && getState().criteria != null + && !getState().criteria.isEmpty()) { // Collect payload data types Set<Payload> payloadSet = new HashSet<>(); @@ -370,7 +373,7 @@ public class DropTargetExtensionConnector extends AbstractExtensionConnector { * https://html.spec.whatwg.org/multipage/interaction.html#the-datatransfer-interface:dom-datatransfer-types-2 * * @param types - * Array of data types. + * Array of data types. * @return {@code} true if given array contains {@code "Files"}, {@code * false} otherwise. */ @@ -403,8 +406,8 @@ public class DropTargetExtensionConnector extends AbstractExtensionConnector { .buildMouseEventDetails(dropEvent, getDropTargetElement()); // Send data to server with RPC - getRpcProxy(DropTargetRpc.class) - .drop(types, data, dropEffect, mouseEventDetails); + getRpcProxy(DropTargetRpc.class).drop(types, data, dropEffect, + mouseEventDetails); } /** 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 683f04a942..df134c4505 100644 --- a/client/src/main/java/com/vaadin/client/ui/VComboBox.java +++ b/client/src/main/java/com/vaadin/client/ui/VComboBox.java @@ -21,6 +21,7 @@ import java.util.Collection; import java.util.Date; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Set; import com.google.gwt.animation.client.AnimationScheduler; @@ -1164,8 +1165,9 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, // TODO try to select the new value if it matches what was // sent for V7 compatibility } - } else if (item != null && !"".equals(lastFilter) && item.getText() - .toLowerCase().contains(lastFilter.toLowerCase())) { + } else if (item != null && !"".equals(lastFilter) + && item.getText().toLowerCase(Locale.ROOT) + .contains(lastFilter.toLowerCase(Locale.ROOT))) { doItemAction(item, true); } else { // currentSuggestion has key="" for nullselection diff --git a/client/src/main/java/com/vaadin/client/ui/VContextMenu.java b/client/src/main/java/com/vaadin/client/ui/VContextMenu.java index 7d2f718566..e6aabd1af1 100644 --- a/client/src/main/java/com/vaadin/client/ui/VContextMenu.java +++ b/client/src/main/java/com/vaadin/client/ui/VContextMenu.java @@ -16,6 +16,8 @@ package com.vaadin.client.ui; +import java.util.Locale; + import com.google.gwt.core.client.Scheduler; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.NodeList; @@ -287,7 +289,8 @@ public class VContextMenu extends VOverlay implements SubPartAware { com.google.gwt.user.client.Element subElement) { if (getElement().isOrHasChild(subElement)) { com.google.gwt.dom.client.Element e = subElement; - while (e != null && !e.getTagName().toLowerCase().equals("tr")) { + while (e != null + && !e.getTagName().toLowerCase(Locale.ROOT).equals("tr")) { e = e.getParentElement(); // ApplicationConnection.getConsole().log("Found row"); } diff --git a/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java b/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java index a3e7217685..d66db480ae 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java @@ -17,6 +17,7 @@ package com.vaadin.client.ui; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import com.google.gwt.dom.client.Element; @@ -271,7 +272,7 @@ public class VCustomLayout extends ComplexPanel { scripts = ""; int endOfPrevScript = 0; int nextPosToCheck = 0; - String lc = html.toLowerCase(); + String lc = html.toLowerCase(Locale.ROOT); String res = ""; int scriptStart = lc.indexOf("<script", nextPosToCheck); while (scriptStart > 0) { @@ -286,7 +287,7 @@ public class VCustomLayout extends ComplexPanel { // Extract body html = res; - lc = html.toLowerCase(); + lc = html.toLowerCase(Locale.ROOT); int startOfBody = lc.indexOf("<body"); if (startOfBody < 0) { res = html; diff --git a/client/src/main/java/com/vaadin/client/ui/VDateField.java b/client/src/main/java/com/vaadin/client/ui/VDateField.java index 558ddaa494..971248cee9 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDateField.java +++ b/client/src/main/java/com/vaadin/client/ui/VDateField.java @@ -265,7 +265,7 @@ public abstract class VDateField<R extends Enum<R>> extends FlowPanel * @return the resolution variable name */ public String getResolutionVariable(R resolution) { - return resolution.name().toLowerCase(Locale.ENGLISH); + return resolution.name().toLowerCase(Locale.ROOT); } /** diff --git a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java index 0202cdf430..0ef910ac96 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java +++ b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java @@ -17,6 +17,7 @@ package com.vaadin.client.ui; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.Map; import com.google.gwt.core.client.GWT; @@ -672,11 +673,11 @@ public class VDragAndDropWrapper extends VCustomComponent protected void deEmphasis(boolean doLayout) { if (emphasizedVDrop != null) { VDragAndDropWrapper.setStyleName(getElement(), OVER_STYLE, false); - VDragAndDropWrapper.setStyleName(getElement(), - OVER_STYLE + "-" + emphasizedVDrop.toString().toLowerCase(), + VDragAndDropWrapper.setStyleName(getElement(), OVER_STYLE + "-" + + emphasizedVDrop.toString().toLowerCase(Locale.ROOT), false); - VDragAndDropWrapper.setStyleName(getElement(), - OVER_STYLE + "-" + emphasizedHDrop.toString().toLowerCase(), + VDragAndDropWrapper.setStyleName(getElement(), OVER_STYLE + "-" + + emphasizedHDrop.toString().toLowerCase(Locale.ROOT), false); } if (doLayout) { @@ -692,10 +693,10 @@ public class VDragAndDropWrapper extends VCustomComponent deEmphasis(false); VDragAndDropWrapper.setStyleName(getElement(), OVER_STYLE, true); VDragAndDropWrapper.setStyleName(getElement(), OVER_STYLE + "-" - + verticalDropLocation.toString().toLowerCase(), true); - VDragAndDropWrapper.setStyleName(getElement(), - OVER_STYLE + "-" - + horizontalDropLocation.toString().toLowerCase(), + + verticalDropLocation.toString().toLowerCase(Locale.ROOT), + true); + VDragAndDropWrapper.setStyleName(getElement(), OVER_STYLE + "-" + + horizontalDropLocation.toString().toLowerCase(Locale.ROOT), true); emphasizedVDrop = verticalDropLocation; emphasizedHDrop = horizontalDropLocation; diff --git a/client/src/main/java/com/vaadin/client/ui/dd/DragAndDropHandler.java b/client/src/main/java/com/vaadin/client/ui/dd/DragAndDropHandler.java index 602e692a6e..55e17c325f 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/DragAndDropHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/DragAndDropHandler.java @@ -15,6 +15,8 @@ */ package com.vaadin.client.ui.dd; +import java.util.Locale; + import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.shared.HandlerRegistration; @@ -174,7 +176,7 @@ public class DragAndDropHandler { public void onPreviewNativeEvent(NativePreviewEvent event) { final int typeInt = event.getTypeInt(); if (typeInt == -1 && event.getNativeEvent().getType() - .toLowerCase().contains("pointer")) { + .toLowerCase(Locale.ROOT).contains("pointer")) { /* * Ignore PointerEvents since IE10 and IE11 send * also MouseEvents for backwards compatibility. diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java b/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java index f1b2e3736a..4030778d34 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java @@ -15,6 +15,8 @@ */ package com.vaadin.client.ui.dd; +import java.util.Locale; + import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; import com.google.gwt.dom.client.Element; @@ -319,7 +321,7 @@ public class VDragAndDropManager { NativePreviewEvent event) { int typeInt = event.getTypeInt(); if (typeInt == -1 && event.getNativeEvent() - .getType().toLowerCase() + .getType().toLowerCase(Locale.ROOT) .contains("pointer")) { /* * Ignore PointerEvents since IE10 and IE11 send diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java b/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java index 1c038de772..f603fbc464 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java @@ -16,6 +16,7 @@ package com.vaadin.client.ui.dd; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import com.google.gwt.dom.client.Document; @@ -257,7 +258,7 @@ public class VDragEvent { syncContent(element, cloneNode); if (BrowserInfo.get().isIE()) { - if (cloneNode.getTagName().toLowerCase().equals("tr")) { + if (cloneNode.getTagName().toLowerCase(Locale.ROOT).equals("tr")) { TableElement table = Document.get().createTableElement(); TableSectionElement tbody = Document.get().createTBodyElement(); table.appendChild(tbody); 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 2faffeede0..63daaf2bc3 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 @@ -17,6 +17,7 @@ package com.vaadin.client.ui.orderedlayout; import java.util.List; +import java.util.Locale; import com.google.gwt.aria.client.Roles; import com.google.gwt.core.client.GWT; @@ -387,8 +388,8 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { if (caption == null) { return; } - captionWrap.removeClassName( - "v-caption-on-" + this.captionPosition.name().toLowerCase()); + captionWrap.removeClassName("v-caption-on-" + + this.captionPosition.name().toLowerCase(Locale.ROOT)); this.captionPosition = captionPosition; if (captionPosition == CaptionPosition.BOTTOM @@ -398,8 +399,8 @@ public class Slot extends SimplePanel implements HasErrorIndicatorElement { captionWrap.insertFirst(caption); } - captionWrap.addClassName( - "v-caption-on-" + captionPosition.name().toLowerCase()); + captionWrap.addClassName("v-caption-on-" + + captionPosition.name().toLowerCase(Locale.ROOT)); } /** 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 6dcc78feeb..80fbe7a079 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 @@ -16,6 +16,7 @@ package com.vaadin.client.ui.orderedlayout; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import com.google.gwt.core.client.GWT; @@ -345,8 +346,8 @@ public class VAbstractOrderedLayout extends FlowPanel { return CaptionPosition.TOP; } String captionClass = matcher.getGroup(1); - CaptionPosition captionPosition = CaptionPosition - .valueOf(CaptionPosition.class, captionClass.toUpperCase()); + CaptionPosition captionPosition = CaptionPosition.valueOf( + CaptionPosition.class, captionClass.toUpperCase(Locale.ROOT)); return captionPosition; } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java index bbbf33f5a4..0d1830e829 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java @@ -21,6 +21,7 @@ import java.util.Collection; import java.util.Date; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Set; import com.google.gwt.aria.client.Roles; @@ -934,7 +935,7 @@ public class VFilterSelect extends Composite private void setTdWidth(Node parent, int width) { for (int i = 0; i < parent.getChildCount(); i++) { Node child = parent.getChild(i); - if ("td".equals(child.getNodeName().toLowerCase())) { + if ("td".equals(child.getNodeName().toLowerCase(Locale.ROOT))) { ((Element) child).getStyle().setWidth(width, Unit.PX); } else { setTdWidth(child, width); @@ -1204,10 +1205,11 @@ public class VFilterSelect extends Composite } } else if (item != null && !"".equals(lastFilter) && (filteringmode == FilteringMode.CONTAINS - ? item.getText().toLowerCase() - .contains(lastFilter.toLowerCase()) - : item.getText().toLowerCase() - .startsWith(lastFilter.toLowerCase()))) { + ? item.getText().toLowerCase(Locale.ROOT).contains( + lastFilter.toLowerCase(Locale.ROOT)) + : item.getText().toLowerCase(Locale.ROOT) + .startsWith(lastFilter + .toLowerCase(Locale.ROOT)))) { doItemAction(item, true); } else { // currentSuggestion has key="" for nullselection diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java index af255c4e5b..16817fd82d 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java @@ -23,6 +23,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.logging.Level; @@ -5904,8 +5905,8 @@ public class VScrollTable extends FlowPanel TooltipInfo info = null; final Element targetTdOrTr = getTdOrTr(target); - if (targetTdOrTr != null && "td" - .equals(targetTdOrTr.getTagName().toLowerCase())) { + if (targetTdOrTr != null && "td".equals( + targetTdOrTr.getTagName().toLowerCase(Locale.ROOT))) { TableCellElement td = (TableCellElement) targetTdOrTr .cast(); info = cellToolTips.get(td); @@ -7593,7 +7594,7 @@ public class VScrollTable extends FlowPanel && row.rowKey == lastEmphasized.overkey) { String stylename = ROWSTYLEBASE + lastEmphasized.dropLocation.toString() - .toLowerCase(); + .toLowerCase(Locale.ROOT); VScrollTableRow.setStyleName(row.getElement(), stylename, false); lastEmphasized = null; @@ -7614,8 +7615,8 @@ public class VScrollTable extends FlowPanel for (Widget w : scrollBody.renderedRows) { VScrollTableRow row = (VScrollTableRow) w; if (details != null && details.overkey == row.rowKey) { - String stylename = ROWSTYLEBASE - + details.dropLocation.toString().toLowerCase(); + String stylename = ROWSTYLEBASE + details.dropLocation + .toString().toLowerCase(Locale.ROOT); VScrollTableRow.setStyleName(row.getElement(), stylename, true); lastEmphasized = details; diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java index b3b4405a1b..e064eb9dad 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java @@ -17,6 +17,7 @@ package com.vaadin.v7.client.ui.combobox; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; @@ -202,8 +203,9 @@ public class ComboBoxConnector extends AbstractFieldConnector } } - if ((getWidget().waitingForFilteringResponse && getWidget().lastFilter - .toLowerCase().equals(uidl.getStringVariable("filter"))) + if ((getWidget().waitingForFilteringResponse + && getWidget().lastFilter.toLowerCase(Locale.ROOT) + .equals(uidl.getStringVariable("filter"))) || popupOpenAndCleared) { getWidget().suggestionPopup.showSuggestions( diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/FieldGroup.java b/compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/FieldGroup.java index 87cc641322..af120108e3 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/FieldGroup.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/FieldGroup.java @@ -23,6 +23,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import com.vaadin.annotations.PropertyId; @@ -1065,7 +1066,7 @@ public class FieldGroup implements Serializable { } protected static String minifyFieldName(String fieldName) { - return fieldName.toLowerCase().replace("_", ""); + return fieldName.toLowerCase(Locale.ROOT).replace("_", ""); } /** diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/filter/Like.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/filter/Like.java index 3c60f83f78..12d8997ad5 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/filter/Like.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/filter/Like.java @@ -15,15 +15,19 @@ */ package com.vaadin.v7.data.util.filter; +import java.util.Locale; + import com.vaadin.data.provider.DataProvider; import com.vaadin.data.provider.ListDataProvider; import com.vaadin.v7.data.Container.Filter; import com.vaadin.v7.data.Item; /** - * @deprecated As of 8.0, the whole filtering feature is integrated into {@link DataProvider}. - * For in-memory case ({@link ListDataProvider}), use predicates as filters. For back-end DataProviders, - * filters are specific to the implementation. + * @deprecated As of 8.0, the whole filtering feature is integrated into + * {@link DataProvider}. For in-memory case + * ({@link ListDataProvider}), use predicates as filters. For + * back-end DataProviders, filters are specific to the + * implementation. */ @Deprecated public class Like implements Filter { @@ -77,7 +81,8 @@ public class Like implements Filter { if (isCaseSensitive()) { return colValue.matches(pattern); } - return colValue.toUpperCase().matches(pattern.toUpperCase()); + return colValue.toUpperCase(Locale.ROOT) + .matches(pattern.toUpperCase(Locale.ROOT)); } @Override @@ -107,7 +112,8 @@ public class Like implements Filter { ? getPropertyId().equals(o.getPropertyId()) : null == o.getPropertyId(); boolean valueEqual = (null != getValue()) - ? getValue().equals(o.getValue()) : null == o.getValue(); + ? getValue().equals(o.getValue()) + : null == o.getValue(); return propertyIdEqual && valueEqual; } } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/filter/SimpleStringFilter.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/filter/SimpleStringFilter.java index 025437659e..6969b12003 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/filter/SimpleStringFilter.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/filter/SimpleStringFilter.java @@ -15,6 +15,8 @@ */ package com.vaadin.v7.data.util.filter; +import java.util.Locale; + import com.vaadin.data.provider.DataProvider; import com.vaadin.data.provider.ListDataProvider; import com.vaadin.v7.data.Container.Filter; @@ -37,9 +39,11 @@ import com.vaadin.v7.data.Property; * * @since 6.6 * - * @deprecated As of 8.0, the whole filtering feature is integrated into {@link DataProvider}. - * For in-memory case ({@link ListDataProvider}), use predicates as filters. For back-end DataProviders, - * filters are specific to the implementation. + * @deprecated As of 8.0, the whole filtering feature is integrated into + * {@link DataProvider}. For in-memory case + * ({@link ListDataProvider}), use predicates as filters. For + * back-end DataProviders, filters are specific to the + * implementation. */ @Deprecated public final class SimpleStringFilter implements Filter { @@ -52,7 +56,7 @@ public final class SimpleStringFilter implements Filter { public SimpleStringFilter(Object propertyId, String filterString, boolean ignoreCase, boolean onlyMatchPrefix) { this.propertyId = propertyId; - this.filterString = ignoreCase ? filterString.toLowerCase() + this.filterString = ignoreCase ? filterString.toLowerCase(Locale.ROOT) : filterString; this.ignoreCase = ignoreCase; this.onlyMatchPrefix = onlyMatchPrefix; @@ -68,7 +72,8 @@ public final class SimpleStringFilter implements Filter { if (propertyValue == null) { return false; } - final String value = ignoreCase ? propertyValue.toString().toLowerCase() + final String value = ignoreCase + ? propertyValue.toString().toLowerCase(Locale.ROOT) : propertyValue.toString(); if (onlyMatchPrefix) { if (!value.startsWith(filterString)) { diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/connection/SimpleJDBCConnectionPool.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/connection/SimpleJDBCConnectionPool.java index 4021ff0100..0d0c8ed53a 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/connection/SimpleJDBCConnectionPool.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/connection/SimpleJDBCConnectionPool.java @@ -22,6 +22,7 @@ import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import java.util.HashSet; +import java.util.Locale; import java.util.Set; /** @@ -29,7 +30,7 @@ import java.util.Set; * the JDBC driver, setting up the connections and ensuring they are still * usable upon release. * - * @deprecated As of 8.0, no replacement available. + * @deprecated As of 8.0, no replacement available. */ @SuppressWarnings("serial") @Deprecated @@ -145,7 +146,7 @@ public class SimpleJDBCConnectionPool implements JDBCConnectionPool { Connection c = DriverManager.getConnection(connectionUri, userName, password); c.setAutoCommit(false); - if (driverName.toLowerCase().contains("mysql")) { + if (driverName.toLowerCase(Locale.ROOT).contains("mysql")) { try { Statement s = c.createStatement(); s.execute("SET SESSION sql_mode = 'ANSI'"); @@ -176,8 +177,7 @@ public class SimpleJDBCConnectionPool implements JDBCConnectionPool { } - private void writeObject(ObjectOutputStream out) - throws IOException { + private void writeObject(ObjectOutputStream out) throws IOException { initialized = false; out.defaultWriteObject(); } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/FreeformQuery.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/FreeformQuery.java index 4575a51904..4e4a0d5f26 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/FreeformQuery.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/FreeformQuery.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Locale; import com.vaadin.v7.data.Container.Filter; import com.vaadin.v7.data.util.sqlcontainer.RowItem; @@ -478,7 +479,7 @@ public class FreeformQuery extends AbstractTransactionalQuery } } // Is there already a WHERE clause in the query string? - int index = queryString.toLowerCase().indexOf("where "); + int index = queryString.toLowerCase(Locale.ROOT).indexOf("where "); if (index > -1) { // Rewrite the where clause return queryString.substring(0, index) + "WHERE " + where + " AND " diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/TableQuery.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/TableQuery.java index 8aa6aa0c26..51c87d960f 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/TableQuery.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/TableQuery.java @@ -28,6 +28,7 @@ import java.util.EventObject; import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; @@ -559,13 +560,13 @@ public class TableQuery extends AbstractTransactionalQuery null); if (!tables.next()) { String catalog = (catalogName != null) - ? catalogName.toUpperCase() + ? catalogName.toUpperCase(Locale.ROOT) : null; String schema = (schemaName != null) - ? schemaName.toUpperCase() + ? schemaName.toUpperCase(Locale.ROOT) : null; tables = dbmd.getTables(catalog, schema, - tableName.toUpperCase(), null); + tableName.toUpperCase(Locale.ROOT), null); if (!tables.next()) { throw new IllegalArgumentException( "Table with the name \"" + getFullTableName() @@ -573,7 +574,7 @@ public class TableQuery extends AbstractTransactionalQuery } else { catalogName = catalog; schemaName = schema; - tableName = tableName.toUpperCase(); + tableName = tableName.toUpperCase(Locale.ROOT); } } tables.close(); diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/generator/filter/LikeTranslator.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/generator/filter/LikeTranslator.java index 292187beec..bf0de08670 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/generator/filter/LikeTranslator.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/generator/filter/LikeTranslator.java @@ -15,6 +15,8 @@ */ package com.vaadin.v7.data.util.sqlcontainer.query.generator.filter; +import java.util.Locale; + import com.vaadin.v7.data.Container.Filter; import com.vaadin.v7.data.util.filter.Like; import com.vaadin.v7.data.util.sqlcontainer.query.generator.StatementHelper; @@ -37,7 +39,7 @@ public class LikeTranslator implements FilterTranslator { sh.addParameterValue(like.getValue()); return QueryBuilder.quote(like.getPropertyId()) + " LIKE ?"; } else { - sh.addParameterValue(like.getValue().toUpperCase()); + sh.addParameterValue(like.getValue().toUpperCase(Locale.ROOT)); return "UPPER(" + QueryBuilder.quote(like.getPropertyId()) + ") LIKE ?"; } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractColorPicker.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractColorPicker.java index 8fb42de9ed..a3066a1de0 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractColorPicker.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractColorPicker.java @@ -18,6 +18,7 @@ package com.vaadin.v7.ui; import java.io.Serializable; import java.lang.reflect.Method; import java.util.Collection; +import java.util.Locale; import org.jsoup.nodes.Attributes; import org.jsoup.nodes.Element; @@ -556,8 +557,8 @@ public abstract class AbstractColorPicker extends AbstractLegacyComponent setColor(new Color(Integer.parseInt(hexColor, 16))); } if (design.hasAttr("popup-style")) { - setPopupStyle(PopupStyle.valueOf( - "POPUP_" + attributes.get("popup-style").toUpperCase())); + setPopupStyle(PopupStyle.valueOf("POPUP_" + + attributes.get("popup-style").toUpperCase(Locale.ROOT))); } if (design.hasAttr("position")) { String[] position = attributes.get("position").split(","); diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java index bd6e0d6902..b7c8feff64 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java @@ -1958,8 +1958,8 @@ public class Calendar extends AbstractLegacyComponent Attributes attr = design.attributes(); if (design.hasAttr("time-format")) { - setTimeFormat(TimeFormat.valueOf( - "Format" + design.attr("time-format").toUpperCase())); + setTimeFormat(TimeFormat.valueOf("Format" + + design.attr("time-format").toUpperCase(Locale.ROOT))); } if (design.hasAttr("start-date")) { diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/themes/Runo.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/themes/Runo.java index 727b44ce37..f603d8c966 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/themes/Runo.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/themes/Runo.java @@ -15,6 +15,8 @@ */ package com.vaadin.v7.ui.themes; +import java.util.Locale; + import com.vaadin.ui.themes.ValoTheme; /** @@ -27,7 +29,7 @@ public class Runo extends BaseTheme { public static final String THEME_NAME = "runo"; public static String themeName() { - return THEME_NAME.toLowerCase(); + return THEME_NAME.toLowerCase(Locale.ROOT); } /*************************************************************************** diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java index 0252da62ac..42e7cd4d0c 100644 --- a/compatibility-server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java +++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java @@ -7,6 +7,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collection; import java.util.HashSet; +import java.util.Locale; import java.util.Set; import org.easymock.EasyMock; @@ -43,7 +44,7 @@ public abstract class AbstractListenerMethodsTestBase { String packageName = "com.vaadin.tests.server"; if (Component.class.isAssignableFrom(c)) { packageName += ".component." - + c.getSimpleName().toLowerCase(); + + c.getSimpleName().toLowerCase(Locale.ROOT); continue; } diff --git a/server/src/main/java/com/vaadin/data/Binder.java b/server/src/main/java/com/vaadin/data/Binder.java index 828130bd81..d417944f80 100644 --- a/server/src/main/java/com/vaadin/data/Binder.java +++ b/server/src/main/java/com/vaadin/data/Binder.java @@ -2585,7 +2585,7 @@ public class Binder<BEAN> implements Serializable { } private String minifyFieldName(String fieldName) { - return fieldName.toLowerCase(Locale.ENGLISH).replace("_", ""); + return fieldName.toLowerCase(Locale.ROOT).replace("_", ""); } private <V> void fireValueChangeEvent(ValueChangeEvent<V> event) { diff --git a/server/src/main/java/com/vaadin/server/BootstrapHandler.java b/server/src/main/java/com/vaadin/server/BootstrapHandler.java index ff9e816013..bd87f78d67 100644 --- a/server/src/main/java/com/vaadin/server/BootstrapHandler.java +++ b/server/src/main/java/com/vaadin/server/BootstrapHandler.java @@ -662,7 +662,7 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { mainDiv.addClass("v-app"); mainDiv.addClass(context.getThemeName()); mainDiv.addClass(context.getUIClass().getSimpleName() - .toLowerCase(Locale.ENGLISH)); + .toLowerCase(Locale.ROOT)); if (style != null && !style.isEmpty()) { mainDiv.attr("style", style); } diff --git a/server/src/main/java/com/vaadin/server/DefaultDeploymentConfiguration.java b/server/src/main/java/com/vaadin/server/DefaultDeploymentConfiguration.java index 80db458c42..33f80015fb 100644 --- a/server/src/main/java/com/vaadin/server/DefaultDeploymentConfiguration.java +++ b/server/src/main/java/com/vaadin/server/DefaultDeploymentConfiguration.java @@ -16,6 +16,7 @@ package com.vaadin.server; +import java.util.Locale; import java.util.Properties; import java.util.logging.Logger; @@ -144,7 +145,8 @@ public class DefaultDeploymentConfiguration } // Try lowercased system properties - val = System.getProperty(pkgName + parameterName.toLowerCase()); + val = System + .getProperty(pkgName + parameterName.toLowerCase(Locale.ROOT)); if (val != null) { return val; } @@ -170,7 +172,8 @@ public class DefaultDeploymentConfiguration // Try lower case application properties for backward compatibility with // 3.0.2 and earlier - val = initParameters.getProperty(parameterName.toLowerCase()); + val = initParameters + .getProperty(parameterName.toLowerCase(Locale.ROOT)); return val; } @@ -322,7 +325,8 @@ public class DefaultDeploymentConfiguration Constants.SERVLET_PARAMETER_PUSH_MODE, PushMode.DISABLED.toString()); try { - pushMode = Enum.valueOf(PushMode.class, mode.toUpperCase()); + pushMode = Enum.valueOf(PushMode.class, + mode.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException e) { getLogger().warning(Constants.WARNING_PUSH_MODE_NOT_RECOGNIZED); pushMode = PushMode.DISABLED; diff --git a/server/src/main/java/com/vaadin/server/JsonCodec.java b/server/src/main/java/com/vaadin/server/JsonCodec.java index a7f94de468..fc8e858b3b 100644 --- a/server/src/main/java/com/vaadin/server/JsonCodec.java +++ b/server/src/main/java/com/vaadin/server/JsonCodec.java @@ -33,6 +33,7 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -729,7 +730,7 @@ public class JsonCodec implements Serializable { throw new RuntimeException("Can't encode " + valueType.getName() + " as it has multiple properties with the name " - + fieldName.toLowerCase() + + fieldName.toLowerCase(Locale.ROOT) + ". This can happen if there are getters and setters for a public field (the framework can't know which to ignore) or if there are properties with only casing distinguishing between the names (e.g. getFoo() and getFOO())"); } diff --git a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java index b643fbb7a9..4cfb389851 100644 --- a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java +++ b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java @@ -26,6 +26,7 @@ import java.util.Deque; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.logging.Level; @@ -289,7 +290,7 @@ public class JsonPaintTarget implements PaintTarget { for (int k = 0; k < 4 - ss.length(); k++) { sb.append('0'); } - sb.append(ss.toUpperCase()); + sb.append(ss.toUpperCase(Locale.ROOT)); } else { sb.append(ch); } diff --git a/server/src/main/java/com/vaadin/server/VaadinPortlet.java b/server/src/main/java/com/vaadin/server/VaadinPortlet.java index d4a7d0e62d..c00b6461d9 100644 --- a/server/src/main/java/com/vaadin/server/VaadinPortlet.java +++ b/server/src/main/java/com/vaadin/server/VaadinPortlet.java @@ -20,6 +20,7 @@ import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Enumeration; +import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.logging.Level; @@ -561,7 +562,8 @@ public class VaadinPortlet extends GenericPortlet */ protected VaadinPortletRequest createVaadinRequest(PortletRequest request) { PortalContext portalContext = request.getPortalContext(); - String portalInfo = portalContext.getPortalInfo().toLowerCase().trim(); + String portalInfo = portalContext.getPortalInfo() + .toLowerCase(Locale.ROOT).trim(); VaadinPortletService service = getService(); if (portalInfo.contains("gatein")) { diff --git a/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java b/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java index a313e8c0fe..d1cdf0dd63 100644 --- a/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java +++ b/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java @@ -24,6 +24,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; @@ -101,12 +102,12 @@ public class SASSAddonImportFileCreator { // last List<String> paths = new ArrayList<>(addonThemes.keySet()); Collections.sort(paths, (String path1, String path2) -> { - if (path1.toLowerCase().endsWith(".css") - && path2.toLowerCase().endsWith(".scss")) { + if (path1.toLowerCase(Locale.ROOT).endsWith(".css") + && path2.toLowerCase(Locale.ROOT).endsWith(".scss")) { return -1; } - if (path1.toLowerCase().endsWith(".scss") - && path2.toLowerCase().endsWith(".css")) { + if (path1.toLowerCase(Locale.ROOT).endsWith(".scss") + && path2.toLowerCase(Locale.ROOT).endsWith(".css")) { return 1; } return 0; diff --git a/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java b/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java index 608f84782c..80c8fc7874 100644 --- a/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java +++ b/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java @@ -29,6 +29,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.util.Collection; import java.util.HashSet; +import java.util.Locale; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -180,7 +181,7 @@ public class WidgetSetBuilder { } static boolean isWidgetset(String gwtModuleName) { - return gwtModuleName.toLowerCase().contains("widgetset"); + return gwtModuleName.toLowerCase(Locale.ROOT).contains("widgetset"); } private static String readFile(File widgetsetFile) throws IOException { diff --git a/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java b/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java index 608cdd9cfa..74b7e1f2b1 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java +++ b/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java @@ -17,6 +17,7 @@ package com.vaadin.ui; import java.io.Serializable; import java.util.Collection; +import java.util.Locale; import java.util.Objects; import org.jsoup.nodes.Attributes; @@ -492,8 +493,8 @@ public abstract class AbstractColorPicker extends AbstractField<Color> { doSetValue(new Color(Integer.parseInt(hexColor, 16))); } if (design.hasAttr("popup-style")) { - setPopupStyle(PopupStyle.valueOf( - "POPUP_" + attributes.get("popup-style").toUpperCase())); + setPopupStyle(PopupStyle.valueOf("POPUP_" + + attributes.get("popup-style").toUpperCase(Locale.ROOT))); } if (design.hasAttr("position")) { String[] position = attributes.get("position").split(","); diff --git a/server/src/main/java/com/vaadin/ui/components/grid/GridDropTarget.java b/server/src/main/java/com/vaadin/ui/components/grid/GridDropTarget.java index 342946d5c9..edb1534a05 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/GridDropTarget.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/GridDropTarget.java @@ -16,6 +16,7 @@ package com.vaadin.ui.components.grid; import java.util.LinkedHashMap; +import java.util.Locale; import java.util.Map; import com.vaadin.shared.Registration; @@ -156,7 +157,7 @@ public class GridDropTarget<T> extends DropTargetExtension<Grid<T>> { GridDropEvent<T> event = new GridDropEvent<>(getParent(), dataPreserveOrder, - DropEffect.valueOf(dropEffect.toUpperCase()), + DropEffect.valueOf(dropEffect.toUpperCase(Locale.ROOT)), getUI().getActiveDragSource(), dropTargetRow, dropLocation, mouseEventDetails); diff --git a/server/src/main/java/com/vaadin/ui/components/grid/TreeGridDropTarget.java b/server/src/main/java/com/vaadin/ui/components/grid/TreeGridDropTarget.java index 1d440b5fec..e471f350bc 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/TreeGridDropTarget.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/TreeGridDropTarget.java @@ -16,6 +16,7 @@ package com.vaadin.ui.components.grid; import java.util.LinkedHashMap; +import java.util.Locale; import java.util.Map; import com.vaadin.shared.Registration; @@ -30,7 +31,7 @@ import com.vaadin.ui.TreeGrid; * counterpart of GridDropTargetExtensionConnector. * * @param <T> - * Type of the TreeGrid bean. + * Type of the TreeGrid bean. * @author Vaadin Ltd * @since 8.1 */ @@ -41,22 +42,22 @@ public class TreeGridDropTarget<T> extends GridDropTarget<T> { * drop. * * @param target - * TreeGrid to be extended. + * TreeGrid to be extended. * @param dropMode - * Drop mode that describes the allowed drop locations within the - * TreeGrid's row. + * Drop mode that describes the allowed drop locations within the + * TreeGrid's row. */ public TreeGridDropTarget(TreeGrid<T> target, DropMode dropMode) { super(target, dropMode); } /** - * Attaches drop listener for the current drop target. {@link - * TreeGridDropListener#drop(TreeGridDropEvent)} is called when drop event - * happens on the client side. + * Attaches drop listener for the current drop target. + * {@link TreeGridDropListener#drop(TreeGridDropEvent)} is called when drop + * event happens on the client side. * * @param listener - * Listener to handle drop event. + * Listener to handle drop event. * @return Handle to be used to remove this listener. */ public Registration addTreeGridDropListener( @@ -79,7 +80,7 @@ public class TreeGridDropTarget<T> extends GridDropTarget<T> { TreeGridDropEvent<T> event = new TreeGridDropEvent<>(getParent(), dataPreserveOrder, - DropEffect.valueOf(dropEffect.toUpperCase()), + DropEffect.valueOf(dropEffect.toUpperCase(Locale.ROOT)), getUI().getActiveDragSource(), dropTargetRow, dropLocation, mouseEventDetails, depth, collapsed); 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 61d35297d0..7c65992967 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/Design.java +++ b/server/src/main/java/com/vaadin/ui/declarative/Design.java @@ -265,7 +265,7 @@ public class Design implements Serializable { String prefix = context.getPackagePrefix(packageName); if (prefix == null) { prefix = packageName.replace('.', '_') - .toLowerCase(Locale.ENGLISH); + .toLowerCase(Locale.ROOT); context.addPackagePrefix(prefix, packageName); } prefix += "-"; 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 e8fa278aba..c508b693f8 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java @@ -25,6 +25,7 @@ import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; @@ -330,7 +331,7 @@ public class DesignAttributeHandler implements Serializable { if (builder.length() != 0) { builder.append('-'); } - builder.append(word.toLowerCase()); + builder.append(word.toLowerCase(Locale.ROOT)); } return builder.toString(); } @@ -356,13 +357,13 @@ public class DesignAttributeHandler implements Serializable { // written in lower case if (matcher.group(1).isEmpty()) { matcher.appendReplacement(result, - matched.toLowerCase() + matcher.group(3)); + matched.toLowerCase(Locale.ROOT) + matcher.group(3)); // otherwise the first character of the group stays uppercase, // while the others are lower case } else { matcher.appendReplacement(result, matcher.group(1) + matched.substring(0, 1) - + matched.substring(1).toLowerCase() + + matched.substring(1).toLowerCase(Locale.ROOT) + matcher.group(3)); } // in both cases the uppercase letter of the next word (or string's 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 2caecda8f4..f1e7e25329 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java +++ b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java @@ -104,7 +104,7 @@ public class FieldBinder implements Serializable { private void resolveFields(Class<?> classWithFields) { for (Field memberField : getFields(classWithFields)) { if (Component.class.isAssignableFrom(memberField.getType())) { - fieldMap.put(memberField.getName().toLowerCase(Locale.ENGLISH), + fieldMap.put(memberField.getName().toLowerCase(Locale.ROOT), memberField); } } @@ -180,7 +180,7 @@ public class FieldBinder implements Serializable { return false; } // validate that the field can be found - Field field = fieldMap.get(fieldName.toLowerCase(Locale.ENGLISH)); + Field field = fieldMap.get(fieldName.toLowerCase(Locale.ROOT)); if (field == null) { getLogger() .fine("No field was found by identifier " + identifier); 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 de7f5ad5b7..1360671d00 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 @@ -53,7 +53,7 @@ public class DesignEnumConverter<T extends Enum> } try { T result = (T) Enum.valueOf(type, - value.toUpperCase(Locale.ENGLISH)); + value.toUpperCase(Locale.ROOT)); return Result.ok(result); } catch (Exception e) { return Result.error(e.getMessage()); @@ -66,7 +66,7 @@ public class DesignEnumConverter<T extends Enum> return null; } - return value.name().toLowerCase(Locale.ENGLISH); + return value.name().toLowerCase(Locale.ROOT); } } diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java index d3d2b13170..c0fa46469c 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java @@ -63,7 +63,7 @@ public class DesignResourceConverter implements Converter<String, Resource> { String protocol = value.split("://")[0]; try { ResourceConverterByProtocol converter = ResourceConverterByProtocol - .valueOf(protocol.toUpperCase(Locale.ENGLISH)); + .valueOf(protocol.toUpperCase(Locale.ROOT)); return Result.ok(converter.parse(value)); } catch (IllegalArgumentException iae) { return Result.error("Unrecognized protocol: " + protocol); diff --git a/server/src/main/java/com/vaadin/ui/dnd/DropTargetExtension.java b/server/src/main/java/com/vaadin/ui/dnd/DropTargetExtension.java index 76c7195f60..5ee7b0e861 100644 --- a/server/src/main/java/com/vaadin/ui/dnd/DropTargetExtension.java +++ b/server/src/main/java/com/vaadin/ui/dnd/DropTargetExtension.java @@ -18,6 +18,7 @@ package com.vaadin.ui.dnd; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Objects; @@ -75,7 +76,7 @@ public class DropTargetExtension<T extends AbstractComponent> registerRpc( (DropTargetRpc) (types, data, dropEffect, mouseEventDetails) -> onDrop(types, data, - DropEffect.valueOf(dropEffect.toUpperCase()), + DropEffect.valueOf(dropEffect.toUpperCase(Locale.ROOT)), mouseEventDetails)); } diff --git a/server/src/main/java/com/vaadin/util/FileTypeResolver.java b/server/src/main/java/com/vaadin/util/FileTypeResolver.java index 500e8736e7..48d7916967 100644 --- a/server/src/main/java/com/vaadin/util/FileTypeResolver.java +++ b/server/src/main/java/com/vaadin/util/FileTypeResolver.java @@ -19,6 +19,7 @@ package com.vaadin.util; import java.io.File; import java.io.Serializable; import java.util.Collections; +import java.util.Locale; import java.util.Map; import java.util.StringTokenizer; import java.util.concurrent.ConcurrentHashMap; @@ -270,7 +271,8 @@ public class FileTypeResolver implements Serializable { } // Return type from extension map, if found - final String type = EXT_TO_MIME_MAP.get(ext.toLowerCase()); + final String type = EXT_TO_MIME_MAP + .get(ext.toLowerCase(Locale.ROOT)); if (type != null) { return type; } @@ -358,7 +360,7 @@ public class FileTypeResolver implements Serializable { * the new mime-type for <code>extension</code>. */ public static void addExtension(String extension, String MIMEType) { - EXT_TO_MIME_MAP.put(extension.toLowerCase(), MIMEType); + EXT_TO_MIME_MAP.put(extension.toLowerCase(Locale.ROOT), MIMEType); } /** diff --git a/server/src/test/java/com/vaadin/data/BinderCustomPropertySetTest.java b/server/src/test/java/com/vaadin/data/BinderCustomPropertySetTest.java index 31c48447a6..cde97441aa 100644 --- a/server/src/test/java/com/vaadin/data/BinderCustomPropertySetTest.java +++ b/server/src/test/java/com/vaadin/data/BinderCustomPropertySetTest.java @@ -79,7 +79,7 @@ public class BinderCustomPropertySetTest { @Override public String getCaption() { - return name.toUpperCase(Locale.ENGLISH); + return name.toUpperCase(Locale.ROOT); } } diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridValueProvider.java b/server/src/test/java/com/vaadin/tests/components/grid/GridValueProvider.java index 6b3d85900d..00961487d3 100644 --- a/server/src/test/java/com/vaadin/tests/components/grid/GridValueProvider.java +++ b/server/src/test/java/com/vaadin/tests/components/grid/GridValueProvider.java @@ -69,7 +69,7 @@ public class GridValueProvider { upperCasePerson); persons.addFilter(col.getValueProvider(), - value -> value.toUpperCase(Locale.ENGLISH).equals(value)); + value -> value.toUpperCase(Locale.ROOT).equals(value)); List<Person> queryPersons = persons.fetch(new Query<>()) .collect(Collectors.toList()); diff --git a/server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java b/server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java index 9f6253067a..de346dd0aa 100644 --- a/server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java +++ b/server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java @@ -25,6 +25,7 @@ import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashSet; +import java.util.Locale; import java.util.TimeZone; import org.junit.Before; @@ -290,9 +291,9 @@ public class DesignFormatterTest { formatter.format(new ThemeResource(themePath))); assertEquals(fontAwesomeUrl, formatter.format(FontAwesome.AMBULANCE)); - assertEquals(someOtherFontUrl.toLowerCase(), + assertEquals(someOtherFontUrl.toLowerCase(Locale.ROOT), formatter.format(new GenericFontIcon("SomeOther", 0xf0f9)) - .toLowerCase()); + .toLowerCase(Locale.ROOT)); assertEquals(fileSystemPath, formatter.format(new FileResource(new File(fileSystemPath)))); diff --git a/server/src/test/java/com/vaadin/tests/server/ClasspathHelper.java b/server/src/test/java/com/vaadin/tests/server/ClasspathHelper.java index 738f0be806..bd0dbbc6e0 100644 --- a/server/src/test/java/com/vaadin/tests/server/ClasspathHelper.java +++ b/server/src/test/java/com/vaadin/tests/server/ClasspathHelper.java @@ -69,7 +69,7 @@ public class ClasspathHelper { .map(path -> getClassFromFile(path, classesRoot.toPath())) .filter(Objects::nonNull).collect(Collectors.toList()); - } else if (classesRoot.getName().toLowerCase(Locale.ENGLISH) + } else if (classesRoot.getName().toLowerCase(Locale.ROOT) .endsWith(".jar")) { URI uri = URI.create("jar:" + classesRoot.toURI()); FileSystem fileSystem; diff --git a/server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java b/server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java index 8a31b8cf98..ba2c424a09 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java +++ b/server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java @@ -7,6 +7,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collection; import java.util.HashSet; +import java.util.Locale; import java.util.Set; import org.easymock.EasyMock; @@ -43,7 +44,7 @@ public abstract class AbstractListenerMethodsTestBase { String packageName = "com.vaadin.tests.server"; if (Component.class.isAssignableFrom(c)) { packageName += ".component." - + c.getSimpleName().toLowerCase(); + + c.getSimpleName().toLowerCase(Locale.ROOT); continue; } diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractdatefield/AbstractLocalDateFieldDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractdatefield/AbstractLocalDateFieldDeclarativeTest.java index 80040804cd..6f18a424b8 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/abstractdatefield/AbstractLocalDateFieldDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/abstractdatefield/AbstractLocalDateFieldDeclarativeTest.java @@ -69,7 +69,7 @@ public abstract class AbstractLocalDateFieldDeclarativeTest<T extends AbstractLo + "date-out-of-range-message='%s' resolution='%s' " + "date-format='%s' lenient parse-error-message='%s'/>", getComponentTag(), end, start, dateOutOfRange, - resolution.name().toLowerCase(Locale.ENGLISH), dateFormat, + resolution.name().toLowerCase(Locale.ROOT), dateFormat, parseErrorMsg); T component = getComponentClass().newInstance(); diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractdatefield/AbstractLocalDateTimeFieldDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractdatefield/AbstractLocalDateTimeFieldDeclarativeTest.java index a4768c6f24..61fff27072 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/abstractdatefield/AbstractLocalDateTimeFieldDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/abstractdatefield/AbstractLocalDateTimeFieldDeclarativeTest.java @@ -74,7 +74,7 @@ public abstract class AbstractLocalDateTimeFieldDeclarativeTest<T extends Abstra + "date-format='%s' lenient parse-error-message='%s'/>", getComponentTag(), DATE_FORMATTER.format(end), DATE_FORMATTER.format(start), dateOutOfRange, - resolution.name().toLowerCase(Locale.ENGLISH), dateFormat, + resolution.name().toLowerCase(Locale.ROOT), dateFormat, parseErrorMsg); T component = getComponentClass().newInstance(); diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java index 7ba3e6aaca..2416620afe 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java @@ -43,7 +43,7 @@ public abstract class AbstractTextFieldDeclarativeTest<T extends AbstractTextFie "<%s maxlength='%d' placeholder='%s' " + "value-change-mode='%s' value-change-timeout='%d'/>", getComponentTag(), maxLength, placeholder, - mode.name().toLowerCase(Locale.ENGLISH), timeout); + mode.name().toLowerCase(Locale.ROOT), timeout); T component = getComponentClass().newInstance(); diff --git a/server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java b/server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java index 8ebc620328..a9b23d7af0 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java @@ -74,7 +74,7 @@ public class CustomLayoutTest { field = list.get(0); } else { for (Field fld : list) { - if (fld.getName().toLowerCase(Locale.ENGLISH) + if (fld.getName().toLowerCase(Locale.ROOT) .startsWith("buffer")) { field = fld; break; diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java index 8d1d6c6955..a4f824d6fa 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java @@ -82,9 +82,9 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> { + "<th plain-text column-ids='id'>Id</th></tr>" + "</thead></table></%s>", getComponentTag(), - heightMode.toString().toLowerCase(Locale.ENGLISH), + heightMode.toString().toLowerCase(Locale.ROOT), frozenColumns, heightByRows, - SelectionMode.MULTI.toString().toLowerCase(Locale.ENGLISH), + SelectionMode.MULTI.toString().toLowerCase(Locale.ROOT), getComponentTag()); testRead(design, grid); diff --git a/server/src/test/java/com/vaadin/tests/server/component/reachtextarea/RichTextAreaDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/reachtextarea/RichTextAreaDeclarativeTest.java index e7cab55f94..6cac635c6a 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/reachtextarea/RichTextAreaDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/reachtextarea/RichTextAreaDeclarativeTest.java @@ -61,7 +61,7 @@ public class RichTextAreaDeclarativeTest int timeout = 67; String design = String.format( "<%s value-change-mode='%s' value-change-timeout='%d'/>", - getComponentTag(), mode.name().toLowerCase(Locale.ENGLISH), + getComponentTag(), mode.name().toLowerCase(Locale.ROOT), timeout); RichTextArea component = new RichTextArea(); diff --git a/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java b/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java index 61161ea3cc..e226751b64 100644 --- a/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java +++ b/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java @@ -16,6 +16,7 @@ package com.vaadin.shared; import java.io.Serializable; +import java.util.Locale; /** * Class that parses the user agent string from the browser and provides @@ -69,7 +70,7 @@ public class VBrowserDetails implements Serializable { * User agent as provided by the browser. */ public VBrowserDetails(String userAgent) { - userAgent = userAgent.toLowerCase(); + userAgent = userAgent.toLowerCase(Locale.ROOT); // browser engine name isGecko = userAgent.indexOf("gecko") != -1 diff --git a/shared/src/main/java/com/vaadin/shared/ui/PreloadMode.java b/shared/src/main/java/com/vaadin/shared/ui/PreloadMode.java index 111278fb0c..2c6f826817 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/PreloadMode.java +++ b/shared/src/main/java/com/vaadin/shared/ui/PreloadMode.java @@ -15,6 +15,8 @@ */ package com.vaadin.shared.ui; +import java.util.Locale; + /** * Enumeration that provides a hint to the browser how media should be * preloaded. @@ -44,6 +46,6 @@ public enum PreloadMode { * @return corresponding preload attribute value string */ public String getValue() { - return name().toLowerCase(); + return name().toLowerCase(Locale.ROOT); } } diff --git a/shared/src/main/java/com/vaadin/shared/ui/dnd/criteria/Payload.java b/shared/src/main/java/com/vaadin/shared/ui/dnd/criteria/Payload.java index fc032ab76d..45be1533b9 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/dnd/criteria/Payload.java +++ b/shared/src/main/java/com/vaadin/shared/ui/dnd/criteria/Payload.java @@ -16,6 +16,7 @@ package com.vaadin.shared.ui.dnd.criteria; import java.io.Serializable; +import java.util.Locale; /** * Stores key/value pairs and the value type. Payload is set in @@ -53,11 +54,11 @@ public class Payload implements Serializable { * Creates a payload object. * * @param key - * key of the payload + * key of the payload * @param value - * value of the payload + * value of the payload * @param valueType - * type of the payload value + * type of the payload value */ public Payload(String key, String value, ValueType valueType) { this.key = key; @@ -99,8 +100,8 @@ public class Payload implements Serializable { * @return the string representation of this payload */ public String getPayloadString() { - return ITEM_PREFIX + ":" + valueType.name().toLowerCase() + ":" + key - + ":" + value; + return ITEM_PREFIX + ":" + valueType.name().toLowerCase(Locale.ROOT) + + ":" + key + ":" + value; } /** @@ -108,7 +109,7 @@ public class Payload implements Serializable { * string. * * @param payloadString - * string that represents a payload object + * string that represents a payload object * @return a payload object represented by the given string */ public static Payload parse(String payloadString) { @@ -122,6 +123,6 @@ public class Payload implements Serializable { // Create payload object of the given parts. Value type is converted to // upper case to match the enum's case. return new Payload(parts[2], parts[3], - ValueType.valueOf(parts[1].toUpperCase())); + ValueType.valueOf(parts[1].toUpperCase(Locale.ROOT))); } } diff --git a/shared/src/main/java/com/vaadin/shared/util/SharedUtil.java b/shared/src/main/java/com/vaadin/shared/util/SharedUtil.java index 9a837c1e75..988ff86f14 100644 --- a/shared/src/main/java/com/vaadin/shared/util/SharedUtil.java +++ b/shared/src/main/java/com/vaadin/shared/util/SharedUtil.java @@ -143,7 +143,7 @@ public class SharedUtil implements Serializable { String[] parts = upperCaseUnderscoreString.replaceFirst("^_*", "") .split("_"); for (int i = 0; i < parts.length; i++) { - parts[i] = capitalize(parts[i].toLowerCase(Locale.ENGLISH)); + parts[i] = capitalize(parts[i].toLowerCase(Locale.ROOT)); } return join(parts, " "); } @@ -186,10 +186,10 @@ public class SharedUtil implements Serializable { } if (string.length() <= 1) { - return string.toUpperCase(Locale.ENGLISH); + return string.toUpperCase(Locale.ROOT); } - return string.substring(0, 1).toUpperCase(Locale.ENGLISH) + return string.substring(0, 1).toUpperCase(Locale.ROOT) + string.substring(1); } diff --git a/test/dependency-rewrite-addon/src/main/java/com/vaadin/test/dependencyrewriteaddon/RewriteJQueryFilter.java b/test/dependency-rewrite-addon/src/main/java/com/vaadin/test/dependencyrewriteaddon/RewriteJQueryFilter.java index 3a317da46c..633a3ae8c9 100644 --- a/test/dependency-rewrite-addon/src/main/java/com/vaadin/test/dependencyrewriteaddon/RewriteJQueryFilter.java +++ b/test/dependency-rewrite-addon/src/main/java/com/vaadin/test/dependencyrewriteaddon/RewriteJQueryFilter.java @@ -19,7 +19,7 @@ public class RewriteJQueryFilter List<Dependency> filtered = new ArrayList<>(); for (Dependency dependency : dependencies) { if (dependency.getType() == Type.JAVASCRIPT && dependency.getUrl() - .toLowerCase(Locale.ENGLISH).contains("jquery")) { + .toLowerCase(Locale.ROOT).contains("jquery")) { filtered.add( new Dependency(Type.JAVASCRIPT, "vaadin://jquery.js")); } else { diff --git a/test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/AbstractIntegrationTest.java b/test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/AbstractIntegrationTest.java index c05cb6fdc6..68a030ec85 100644 --- a/test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/AbstractIntegrationTest.java +++ b/test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/AbstractIntegrationTest.java @@ -3,6 +3,7 @@ package com.vaadin.tests.integration; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; +import java.util.Locale; import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -81,10 +82,10 @@ public abstract class AbstractIntegrationTest extends ParallelTest { protected void compareScreen(String identifier) throws IOException { String refFileName = identifier + "-" - + getDesiredCapabilities().getBrowserName().toLowerCase() + + getDesiredCapabilities().getBrowserName().toLowerCase(Locale.ROOT) + ".png"; String errorFileName = identifier + "-" - + getDesiredCapabilities().getBrowserName().toLowerCase() + "-" + + getDesiredCapabilities().getBrowserName().toLowerCase(Locale.ROOT) + "-" + System.getProperty("server-name") + "[" + getClass().getSimpleName() + "].png"; File referenceFile = ImageFileUtil 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 a95cc58106..b91f3994d1 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 @@ -15,6 +15,8 @@ */ package com.vaadin.testbench.elements; +import java.util.Locale; + import org.openqa.selenium.WebElement; import com.vaadin.testbench.By; @@ -69,7 +71,7 @@ public class AbstractComponentElement extends AbstractElement { String[] styles = style.split(";"); for (String stylePart : styles) { // IE8 has uppercased styles - String lowercasePart = stylePart.toLowerCase(); + String lowercasePart = stylePart.toLowerCase(Locale.ROOT); if (lowercasePart.startsWith(styleName + ":")) { return lowercasePart.substring(styleName.length() + 1).trim(); } diff --git a/uitest/src/main/java/com/vaadin/launcher/util/BrowserLauncher.java b/uitest/src/main/java/com/vaadin/launcher/util/BrowserLauncher.java index cf26d4a891..5abc77e3ff 100644 --- a/uitest/src/main/java/com/vaadin/launcher/util/BrowserLauncher.java +++ b/uitest/src/main/java/com/vaadin/launcher/util/BrowserLauncher.java @@ -21,6 +21,7 @@ import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; +import java.util.Locale; /** * This class opens default browser for DemoLauncher class. Default browser is @@ -40,7 +41,7 @@ public class BrowserLauncher { boolean started = false; final String os = System.getProperty("os.name", "windows") - .toLowerCase(); + .toLowerCase(Locale.ROOT); // Linux if (os.indexOf("linux") >= 0) { diff --git a/uitest/src/main/java/com/vaadin/tests/TestBench.java b/uitest/src/main/java/com/vaadin/tests/TestBench.java index b7b8c93177..208f583dc3 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestBench.java +++ b/uitest/src/main/java/com/vaadin/tests/TestBench.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Set; import com.vaadin.server.ExternalResource; @@ -180,8 +181,9 @@ public class TestBench extends com.vaadin.server.LegacyApplication if (next instanceof Class) { Class<?> c = (Class<?>) next; String string = c.getSimpleName(); - if (string.toLowerCase() - .contains(fragment.toLowerCase())) { + if (string.toLowerCase(Locale.ROOT) + .contains(fragment.toLowerCase( + Locale.ROOT))) { menu.setValue(c); mainLayout.setSplitPosition(0); return; diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java index a479922b4d..ad27e2b6ab 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java @@ -1,5 +1,7 @@ package com.vaadin.tests.components.combobox; +import java.util.Locale; + import com.vaadin.server.ThemeResource; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.ComboBox; @@ -21,8 +23,9 @@ public class ComboBoxItemIcon extends TestBase { { ComboBox<String> cb = new ComboBox<>(); cb.setItems("FI", "SE"); - cb.setItemIconGenerator(item -> new ThemeResource( - "../tests-tickets/icons/" + item.toLowerCase() + ".gif")); + cb.setItemIconGenerator( + item -> new ThemeResource("../tests-tickets/icons/" + + item.toLowerCase(Locale.ROOT) + ".gif")); addComponent(cb); } @@ -31,7 +34,8 @@ public class ComboBoxItemIcon extends TestBase { cb.setItems("Finland", "Australia", "Hungary"); cb.setItemIconGenerator( item -> new ThemeResource("../tests-tickets/icons/" - + item.substring(0, 2).toLowerCase() + ".gif")); + + item.substring(0, 2).toLowerCase(Locale.ROOT) + + ".gif")); cb.setValue("Hungary"); addComponent(cb); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java index 3e04594de3..f03c6cb54f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java @@ -15,6 +15,8 @@ */ package com.vaadin.tests.components.datefield; +import java.util.Locale; + import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.datefield.DateResolution; import com.vaadin.tests.components.AbstractReindeerTestUI; @@ -42,13 +44,12 @@ public class DateFieldChangeResolution extends AbstractReindeerTestUI { HorizontalLayout hlayout = new HorizontalLayout(); addComponent(hlayout); for (final DateResolution value : DateResolution.values()) { - String resolutionString = value.toString().toLowerCase(); + String resolutionString = value.toString().toLowerCase(Locale.ROOT); Button button = new Button(resolutionString); button.addClickListener(event -> dateField.setResolution(value)); button.setId(BUTTON_BASE_ID + resolutionString); hlayout.addComponent(button); } - } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldChangeResolution.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldChangeResolution.java index 2bf161daf4..2a14e20467 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldChangeResolution.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldChangeResolution.java @@ -15,6 +15,8 @@ */ package com.vaadin.tests.components.datefield; +import java.util.Locale; + import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.datefield.DateTimeResolution; import com.vaadin.tests.components.AbstractReindeerTestUI; @@ -41,13 +43,12 @@ public class DateTimeFieldChangeResolution extends AbstractReindeerTestUI { HorizontalLayout hlayout = new HorizontalLayout(); addComponent(hlayout); for (final DateTimeResolution value : DateTimeResolution.values()) { - String resolutionString = value.toString().toLowerCase(); + String resolutionString = value.toString().toLowerCase(Locale.ROOT); Button button = new Button(resolutionString); button.addClickListener(event -> dateField.setResolution(value)); button.setId(BUTTON_BASE_ID + resolutionString); hlayout.addComponent(button); } - } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java index 92ba75869c..c8f7127f76 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.grid; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.stream.IntStream; @@ -54,7 +55,7 @@ public class GridComponents extends AbstractTestUIWithLog { e -> Notification.show( "Clicked button on row for: " + string, Type.WARNING_MESSAGE)); - button.setId(string.replace(' ', '_').toLowerCase()); + button.setId(string.replace(' ', '_').toLowerCase(Locale.ROOT)); return button; }, new ComponentRenderer()).setId("button").setCaption("Button"); // make sure the buttons and focus outlines fit completely in a row diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridEditorUI.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridEditorUI.java index 400ff5266c..6da0a3757f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridEditorUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridEditorUI.java @@ -18,6 +18,7 @@ package com.vaadin.tests.components.grid; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Locale; import java.util.Random; import com.vaadin.server.VaadinRequest; @@ -51,8 +52,9 @@ public class GridEditorUI extends AbstractReindeerTestUIWithLog { person.setFirstName(TestDataGenerator.getFirstName(r)); person.setLastName(TestDataGenerator.getLastName(r)); person.getAddress().setCity(TestDataGenerator.getCity(r)); - person.setEmail(person.getFirstName().toLowerCase() + "." - + person.getLastName().toLowerCase() + "@vaadin.com"); + person.setEmail(person.getFirstName().toLowerCase(Locale.ROOT) + "." + + person.getLastName().toLowerCase(Locale.ROOT) + + "@vaadin.com"); person.setPhoneNumber(TestDataGenerator.getPhoneNumber(r)); person.getAddress() diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java index b4bc32ab7b..84c676b878 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java @@ -1,5 +1,7 @@ package com.vaadin.tests.components.table; +import java.util.Locale; + import com.vaadin.server.VaadinRequest; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.ContentMode; @@ -26,10 +28,11 @@ public class HeaderRightClickAfterDrag extends AbstractReindeerTestUI { public void headerClick(Table.HeaderClickEvent event) { if (MouseEventDetails.MouseButton.RIGHT .equals(event.getButton())) { - Window window = new Window("Right-clicked:", new Label( - "<center>" + event.getPropertyId().toString() - .toUpperCase() + "</center>", - ContentMode.HTML)); + Window window = new Window("Right-clicked:", + new Label("<center>" + + event.getPropertyId().toString() + .toUpperCase(Locale.ROOT) + + "</center>", ContentMode.HTML)); window.setPositionX(event.getClientX()); window.setPositionY(event.getClientY()); window.setResizable(false); diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeMode.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeMode.java index 71b0a801b6..8445d8e5c9 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeMode.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeMode.java @@ -1,5 +1,7 @@ package com.vaadin.tests.components.textfield; +import java.util.Locale; + import com.vaadin.data.HasValue.ValueChangeEvent; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.ValueChangeMode; @@ -29,7 +31,7 @@ public class TextFieldsValueChangeMode extends AbstractTestUIWithLog { private Component createFields(Class<?> fieldClass) { VerticalLayout vl = new VerticalLayout(); - String id = fieldClass.getSimpleName().toLowerCase(); + String id = fieldClass.getSimpleName().toLowerCase(Locale.ROOT); try { AbstractField<String> f = (AbstractField<String>) fieldClass .newInstance(); diff --git a/uitest/src/main/java/com/vaadin/tests/containers/TestItemSorter.java b/uitest/src/main/java/com/vaadin/tests/containers/TestItemSorter.java index 4af48db20a..0c6da38a1e 100644 --- a/uitest/src/main/java/com/vaadin/tests/containers/TestItemSorter.java +++ b/uitest/src/main/java/com/vaadin/tests/containers/TestItemSorter.java @@ -2,6 +2,7 @@ package com.vaadin.tests.containers; import java.util.Collection; import java.util.Comparator; +import java.util.Locale; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; @@ -33,13 +34,15 @@ public class TestItemSorter extends TestBase { Boolean b1 = ((CheckBox) o1).getValue(); return b1.compareTo(((CheckBox) o2).getValue()); } else if (o1 instanceof Button && o2 instanceof Button) { - String caption1 = ((Button) o1).getCaption().toLowerCase(); - String caption2 = ((Button) o2).getCaption().toLowerCase(); + String caption1 = ((Button) o1).getCaption() + .toLowerCase(Locale.ROOT); + String caption2 = ((Button) o2).getCaption() + .toLowerCase(Locale.ROOT); return caption1.compareTo(caption2); } else if (o1 instanceof String && o2 instanceof String) { - return ((String) o1).toLowerCase() - .compareTo(((String) o2).toLowerCase()); + return ((String) o1).toLowerCase(Locale.ROOT) + .compareTo(((String) o2).toLowerCase(Locale.ROOT)); } return 0; @@ -54,8 +57,8 @@ public class TestItemSorter extends TestBase { private static void populateContainer(IndexedContainer container) { container.removeAllItems(); - String[] strings = { "Text 1", "Text 2", "true", "false", - "Caption 1", "Caption 2" }; + String[] strings = { "Text 1", "Text 2", "true", "false", "Caption 1", + "Caption 2" }; for (String s : strings) { Object id = container.addItem(); Item item = container.getItem(id); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java b/uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java index 76bdb6cd13..5c42c445c0 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java @@ -1,5 +1,7 @@ package com.vaadin.tests.themes; +import java.util.Locale; + import com.vaadin.server.ThemeResource; import com.vaadin.server.UserError; import com.vaadin.ui.Button; @@ -125,7 +127,7 @@ public class ButtonsTest extends com.vaadin.server.LegacyApplication { } else { b = new Button(style + " style"); } - b.setStyleName(style.toLowerCase()); + b.setStyleName(style.toLowerCase(Locale.ROOT)); if (icon) { b.setIcon(new ThemeResource("../runo/icons/" + (largeIcons ? "64" : "16") + "/document.png")); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java index 4c83430832..b5cb23a867 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java @@ -15,6 +15,8 @@ */ package com.vaadin.tests.themes.valo; +import java.util.Locale; + import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.icons.VaadinIcons; import com.vaadin.navigator.View; @@ -185,7 +187,8 @@ public class CommonParts extends VerticalLayout implements View { typeString = ""; notification.setStyleName(styleString.trim()); } else { - typeString = selectedItem.getText().toLowerCase(); + typeString = selectedItem.getText() + .toLowerCase(Locale.ROOT); notification.setStyleName( (typeString + " " + styleString.trim()) .trim()); @@ -214,8 +217,8 @@ public class CommonParts extends VerticalLayout implements View { styleString = ""; for (MenuItem item : style.getItems()) { if (item.isChecked()) { - styleString += " " - + item.getText().toLowerCase(); + styleString += " " + item.getText() + .toLowerCase(Locale.ROOT); } } if (!styleString.trim().isEmpty()) { @@ -603,7 +606,8 @@ public class CommonParts extends VerticalLayout implements View { if (selectedItem.getText() .equals("Borderless Toolbars")) { toolbarStyle = selectedItem.isChecked() - ? ValoTheme.MENUBAR_BORDERLESS : null; + ? ValoTheme.MENUBAR_BORDERLESS + : null; } win.setContent(windowContent()); @@ -638,8 +642,9 @@ public class CommonParts extends VerticalLayout implements View { @Override public void menuSelected(MenuItem selectedItem) { if (selectedItem.getText().equals("Caption")) { - win.setCaption(selectedItem.isChecked() - ? "Window Caption" : null); + win.setCaption( + selectedItem.isChecked() ? "Window Caption" + : null); } else if (selectedItem.getText().equals("Closable")) { win.setClosable(selectedItem.isChecked()); } else if (selectedItem.getText().equals("Resizable")) { diff --git a/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java b/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java index bdb73234ba..2ac37a07f7 100644 --- a/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java +++ b/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Locale; import java.util.Random; import com.vaadin.v7.data.util.BeanItemContainer; @@ -56,8 +57,8 @@ public class PersonContainer extends BeanItemContainer<Person> p.setFirstName(TestDataGenerator.getFirstName(r)); p.setLastName(TestDataGenerator.getLastName(r)); p.getAddress().setCity(TestDataGenerator.getCity(r)); - p.setEmail(p.getFirstName().toLowerCase() + "." - + p.getLastName().toLowerCase() + "@vaadin.com"); + p.setEmail(p.getFirstName().toLowerCase(Locale.ROOT) + "." + + p.getLastName().toLowerCase(Locale.ROOT) + "@vaadin.com"); p.setPhoneNumber(TestDataGenerator.getPhoneNumber(r)); p.getAddress().setPostalCode(TestDataGenerator.getPostalCode(r)); diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java index 797aed66cb..037fc049a8 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java @@ -23,6 +23,7 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -169,8 +170,8 @@ public class SerializerTestConnector extends AbstractExtensionConnector { public void sendChar(char value, Character boxedValue, char[] array) { rpc.sendChar(Character.toUpperCase(boxedValue.charValue()), - Character.valueOf(value), - new String(array).toLowerCase().toCharArray()); + Character.valueOf(value), new String(array) + .toLowerCase(Locale.ROOT).toCharArray()); } @Override diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/TextChangeEvents2.java b/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/TextChangeEvents2.java index 4dd7dfd527..7e32692e58 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/TextChangeEvents2.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/TextChangeEvents2.java @@ -1,5 +1,7 @@ package com.vaadin.v7.tests.components.textfield; +import java.util.Locale; + import com.vaadin.event.FieldEvents.BlurEvent; import com.vaadin.event.FieldEvents.BlurListener; import com.vaadin.event.FieldEvents.FocusEvent; @@ -108,7 +110,7 @@ public class TextChangeEvents2 extends TestBase { @Override public void textChange(TextChangeEvent event) { - tf.setValue(event.getText().toUpperCase()); + tf.setValue(event.getText().toUpperCase(Locale.ROOT)); } }); @@ -122,8 +124,8 @@ public class TextChangeEvents2 extends TestBase { } { - final TextField[] tfs = { new TextField(), - new TextField(), new TextField(), new TextField() }; + final TextField[] tfs = { new TextField(), new TextField(), + new TextField(), new TextField() }; HorizontalLayout hl = new HorizontalLayout(); hl.setCaption("Blää"); getLayout().addComponent(hl); diff --git a/uitest/src/test/java/com/vaadin/tests/binder/BinderValidatorErrorLevelTest.java b/uitest/src/test/java/com/vaadin/tests/binder/BinderValidatorErrorLevelTest.java index 4be9f9a49e..20b788a125 100644 --- a/uitest/src/test/java/com/vaadin/tests/binder/BinderValidatorErrorLevelTest.java +++ b/uitest/src/test/java/com/vaadin/tests/binder/BinderValidatorErrorLevelTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.binder; import java.io.IOException; +import java.util.Locale; import org.junit.Assert; import org.junit.Test; @@ -22,20 +23,23 @@ public class BinderValidatorErrorLevelTest extends SingleBrowserTest { // Screenshot the whole slot compareScreen(textField.findElement(By.xpath("..")), - l.name().toLowerCase()); + l.name().toLowerCase(Locale.ROOT)); Assert.assertTrue("Error style for " + l.name() + " not present", - textField.getAttribute("class").contains( - "v-textfield-error-" + l.name().toLowerCase())); + textField.getAttribute("class") + .contains("v-textfield-error-" + + l.name().toLowerCase(Locale.ROOT))); textField.setValue("long enough text"); Assert.assertFalse("Error style for " + l.name() + " still present", - textField.getAttribute("class").contains( - "v-textfield-error-" + l.name().toLowerCase())); + textField.getAttribute("class") + .contains("v-textfield-error-" + + l.name().toLowerCase(Locale.ROOT))); textField.setValue("foo"); Assert.assertTrue( "Error style for " + l.name() + " should be present again.", - textField.getAttribute("class").contains( - "v-textfield-error-" + l.name().toLowerCase())); + textField.getAttribute("class") + .contains("v-textfield-error-" + + l.name().toLowerCase(Locale.ROOT))); } } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ErrorLevelsTest.java b/uitest/src/test/java/com/vaadin/tests/components/ErrorLevelsTest.java index 2dc9e02914..647c9601e4 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ErrorLevelsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ErrorLevelsTest.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; +import java.util.Locale; import org.junit.Test; import org.openqa.selenium.Keys; @@ -133,7 +134,7 @@ public class ErrorLevelsTest extends SingleBrowserTest { private String getErrorLevelClassName(String prefix, ErrorLevel errorLevel) { - return prefix + "-" + errorLevel.toString().toLowerCase(); + return prefix + "-" + errorLevel.toString().toLowerCase(Locale.ROOT); } private List<String> getErrorLevelClassNames(String prefix, @@ -147,7 +148,8 @@ public class ErrorLevelsTest extends SingleBrowserTest { private void selectErrorLevel(ErrorLevel errorLevel) { errorLevelSelector.clear(); - errorLevelSelector.sendKeys(errorLevel.toString().toLowerCase()); + errorLevelSelector + .sendKeys(errorLevel.toString().toLowerCase(Locale.ROOT)); errorLevelSelector.sendKeys(getReturn()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java index 36367e4b66..b5883d43b9 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.stream.Collectors; import org.junit.Before; @@ -260,11 +261,11 @@ public class CheckBoxGroupTest extends MultiBrowserTest { for (int i = 0; i < optionsCssClasses.size(); i++) { String cssClassList = optionsCssClasses.get(i); if (i == 10) { - assertTrue("10th item should be disabled", - cssClassList.toLowerCase().contains("disabled")); + assertTrue("10th item should be disabled", cssClassList + .toLowerCase(Locale.ROOT).contains("disabled")); } else { - assertFalse("Only 10th item should be disabled", - cssClassList.toLowerCase().contains("disabled")); + assertFalse("Only 10th item should be disabled", cssClassList + .toLowerCase(Locale.ROOT).contains("disabled")); } } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridColspansTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridColspansTest.java index 27b9e805bd..306e0cbe3f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridColspansTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridColspansTest.java @@ -57,14 +57,14 @@ public class GridColspansTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); assertEquals("Failed initial condition.", "all the stuff", - grid.getHeaderCell(0, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(0, 1).getText().toLowerCase(Locale.ROOT)); assertEquals("Failed initial condition.", "first name", - grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ROOT)); $(ButtonElement.class).caption("Show/Hide firstName").first().click(); assertEquals("Header text changed on column hide.", "all the stuff", - grid.getHeaderCell(0, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(0, 1).getText().toLowerCase(Locale.ROOT)); assertEquals("Failed initial condition.", "last name", - grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ROOT)); } @Test @@ -74,17 +74,17 @@ public class GridColspansTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); assertEquals("Failed initial condition.", "first name", - grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ROOT)); $(ButtonElement.class).caption("Show/Hide firstName").first().click(); assertEquals("Failed initial condition.", "last name", - grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ROOT)); $(ButtonElement.class).caption("Show/Hide firstName").first().click(); assertEquals("Failed to find first name in last column", "first name", - grid.getHeaderCell(2, 5).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(2, 5).getText().toLowerCase(Locale.ROOT)); } @@ -95,18 +95,18 @@ public class GridColspansTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); GridCellElement headerCell = grid.getHeaderCell(1, 1); assertEquals("Failed initial condition.", "full name", - headerCell.getText().toLowerCase(Locale.ENGLISH)); + headerCell.getText().toLowerCase(Locale.ROOT)); assertEquals("Failed initial condition.", "first name", - grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ROOT)); $(ButtonElement.class).get(1).click(); headerCell = grid.getHeaderCell(1, 1); assertEquals("Joined Header text not changed on column reorder.", - "misc", headerCell.getText().toLowerCase(Locale.ENGLISH)); + "misc", headerCell.getText().toLowerCase(Locale.ROOT)); assertEquals("Unexpected colspan", "1", headerCell.getAttribute("colspan")); headerCell = grid.getHeaderCell(1, 2); assertEquals("Header text not changed on column reorder", "full name", - headerCell.getText().toLowerCase(Locale.ENGLISH)); + headerCell.getText().toLowerCase(Locale.ROOT)); assertEquals("Unexpected colspan", "2", headerCell.getAttribute("colspan")); diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java index 88b218e6bf..4a303ddfb5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java @@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.Locale; import java.util.stream.IntStream; import java.util.stream.Stream; @@ -142,7 +143,9 @@ public class GridComponentsTest extends MultiBrowserTest { GridRowElement row = $(GridElement.class).first().getRow(i); assertEquals("Label text did not match", string, row.getCell(0).getText()); - row.findElement(By.id(string.replace(' ', '_').toLowerCase())).click(); + row.findElement( + By.id(string.replace(' ', '_').toLowerCase(Locale.ROOT))) + .click(); // IE 11 is slow, need to wait for the notification. waitUntil(driver -> isElementPresent(NotificationElement.class), 10); assertTrue("Notification should contain given text", diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridGeneratedPropertiesTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridGeneratedPropertiesTest.java index df89f217f3..c2c28c75df 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridGeneratedPropertiesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridGeneratedPropertiesTest.java @@ -19,6 +19,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.Locale; + import org.junit.Test; import com.vaadin.testbench.elements.GridElement; @@ -35,7 +37,7 @@ public class GridGeneratedPropertiesTest extends MultiBrowserTest { openTestURL(); GridElement grid = $(GridElement.class).first(); assertEquals("Miles header wasn't present.", "miles", - grid.getHeaderCell(0, 2).getText().toLowerCase()); + grid.getHeaderCell(0, 2).getText().toLowerCase(Locale.ROOT)); } @Test diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionScrollBarTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionScrollBarTest.java index 93935f7524..4c4f4595c4 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionScrollBarTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionScrollBarTest.java @@ -18,6 +18,7 @@ package com.vaadin.tests.components.grid; import static org.junit.Assert.assertTrue; import java.io.IOException; +import java.util.Locale; import org.junit.Test; @@ -33,7 +34,7 @@ public class GridMultiSelectionScrollBarTest extends MultiBrowserTest { assertTrue("Horizontal scrollbar should not be visible.", $(GridElement.class).first().getHorizontalScroller() - .getAttribute("style").toLowerCase() + .getAttribute("style").toLowerCase(Locale.ROOT) .contains("display: none;")); // Just to make sure nothing odd happened. diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicsTest.java index caec06b3f5..67c196a4e9 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicsTest.java @@ -5,6 +5,7 @@ import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.stream.Stream; import org.junit.Before; @@ -150,8 +151,8 @@ public abstract class GridBasicsTest extends MultiBrowserTest { protected void assertColumnHeader(String expectedHeaderCaption, TestBenchElement testBenchElement) { - assertEquals(expectedHeaderCaption.toLowerCase(), - testBenchElement.getText().toLowerCase()); + assertEquals(expectedHeaderCaption.toLowerCase(Locale.ROOT), + testBenchElement.getText().toLowerCase(Locale.ROOT)); } protected void assertColumnIsSorted(int index) { @@ -199,7 +200,8 @@ public abstract class GridBasicsTest extends MultiBrowserTest { List<WebElement> elements = sidebar .findElements(By.className("column-hiding-toggle")); for (WebElement e : elements) { - if (e.getText().toLowerCase().startsWith("column " + columnIndex)) { + if (e.getText().toLowerCase(Locale.ROOT) + .startsWith("column " + columnIndex)) { return e; } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java index b7ba76ea73..322524fc76 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.List; +import java.util.Locale; import java.util.stream.IntStream; import org.junit.Test; @@ -157,7 +158,8 @@ public class GridHeaderFooterTest extends GridBasicsTest { "Text Header"); GridCellElement textCell = getGridElement().getHeaderCell(0, 2); - assertEquals("text header", textCell.getText().toLowerCase()); + assertEquals("text header", + textCell.getText().toLowerCase(Locale.ROOT)); } @Test @@ -180,16 +182,16 @@ public class GridHeaderFooterTest extends GridBasicsTest { assertTrue("No notifications should've been shown", !$(NotificationElement.class).exists()); assertEquals("Header should've been reverted back to text header", - "text header", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + "text header", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); } @Test public void testColumnHidingToggleCaption_settingWidgetToHeader_toggleCaptionStays() { toggleColumnHidable(1); getSidebarOpenButton().click(); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); assertEquals("Column 1", getColumnHidingToggle(1).getText()); selectMenuPath("Component", "Columns", "Column 1", "Header Type", @@ -218,7 +220,8 @@ public class GridHeaderFooterTest extends GridBasicsTest { "Text Footer"); GridCellElement textCell = getGridElement().getFooterCell(0, 2); - assertEquals("text footer", textCell.getText().toLowerCase()); + assertEquals("text footer", + textCell.getText().toLowerCase(Locale.ROOT)); } @Test @@ -241,16 +244,16 @@ public class GridHeaderFooterTest extends GridBasicsTest { assertTrue("No notifications should've been shown", !$(NotificationElement.class).exists()); assertEquals("Footer should've been reverted back to text footer", - "text footer", - getGridElement().getFooterCell(0, 1).getText().toLowerCase()); + "text footer", getGridElement().getFooterCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); } @Test public void testColumnHidingToggleCaption_settingWidgetToFooter_toggleCaptionStays() { toggleColumnHidable(1); getSidebarOpenButton().click(); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); assertEquals("Column 1", getColumnHidingToggle(1).getText()); selectMenuPath("Component", "Columns", "Column 1", "Footer Type", diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/ColumnReorderingWithManyColumnsTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/ColumnReorderingWithManyColumnsTest.java index 98b10b9ce0..5e5773fc3f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/ColumnReorderingWithManyColumnsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/ColumnReorderingWithManyColumnsTest.java @@ -3,6 +3,7 @@ package com.vaadin.tests.components.table; import static org.junit.Assert.assertEquals; import java.io.IOException; +import java.util.Locale; import org.junit.Test; import org.openqa.selenium.By; @@ -25,7 +26,7 @@ public class ColumnReorderingWithManyColumnsTest extends MultiBrowserTest { .findElement(By.className("v-table-focus-slot-right")); String markedColumnName = markedElement.findElement(By.xpath("..")) .getText(); - assertEquals("col-9", markedColumnName.toLowerCase()); + assertEquals("col-9", markedColumnName.toLowerCase(Locale.ROOT)); } private void drag(WebElement source, WebElement target) { diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java index 73dfc8f77e..3f7ab9c098 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java @@ -39,7 +39,7 @@ public class UIAutoGeneratedStyleNameTest extends MultiBrowserTest { assertTrue("UI div element doesn't contain autogenerated style name", containsStyle(getDriver().findElement(By.className("v-app")), UIAutoGeneratedStyleName.class.getSimpleName() - .toLowerCase(Locale.ENGLISH))); + .toLowerCase(Locale.ROOT))); assertTrue( "Overlays div element doesn't contain autogenerated style name", @@ -47,7 +47,7 @@ public class UIAutoGeneratedStyleNameTest extends MultiBrowserTest { getDriver().findElement( By.className("v-overlay-container")), UIAutoGeneratedStyleName.class.getSimpleName() - .toLowerCase(Locale.ENGLISH))); + .toLowerCase(Locale.ROOT))); } private boolean containsStyle(WebElement element, String style) { diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java index f23f087b40..655d046166 100644 --- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java @@ -19,6 +19,8 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; +import java.util.Locale; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -105,7 +107,8 @@ public class BasicCrudGridEditorRowTest extends MultiBrowserTest { // Open editor row new Actions(getDriver()).doubleClick(cell).perform(); - String attribute = grid.getEditor().getAttribute("style").toLowerCase(); + String attribute = grid.getEditor().getAttribute("style") + .toLowerCase(Locale.ROOT); assertFalse("Style should not contain top.", attribute.contains("top:")); } diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/AffectedTB3TestLocator.java b/uitest/src/test/java/com/vaadin/tests/tb3/AffectedTB3TestLocator.java index 9f8a79859d..016a246d40 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/AffectedTB3TestLocator.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/AffectedTB3TestLocator.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Set; public class AffectedTB3TestLocator extends TB3TestLocator { @@ -65,7 +66,8 @@ public class AffectedTB3TestLocator extends TB3TestLocator { String lastPart = packageParts[packageParts.length - 2]; for (String f : affectedFiles) { - if (f.toLowerCase().contains(lastPart.toLowerCase())) { + if (f.toLowerCase(Locale.ROOT) + .contains(lastPart.toLowerCase(Locale.ROOT))) { affectedTestClasses.add(c); // Break here not to accidentally add the same test class @@ -82,7 +84,7 @@ public class AffectedTB3TestLocator extends TB3TestLocator { List<String> affectedFilePaths = new ArrayList<>(); for (String path : changedTB3TestLocator.getChangedFilePaths()) { - if (!path.toLowerCase().contains("test")) { + if (!path.toLowerCase(Locale.ROOT).contains("test")) { affectedFilePaths.add(path); } } diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java b/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java index 98a98ffae0..8b3967f087 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java @@ -19,6 +19,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import org.eclipse.jgit.api.DiffCommand; import org.eclipse.jgit.api.Git; @@ -153,8 +154,8 @@ public class ChangedTB3TestLocator extends TB3TestLocator { List<String> changedTestFilePaths = new ArrayList<>(); for (String filePath : getChangedFilePaths()) { - if (filePath.toLowerCase().startsWith("uitest") - && filePath.toLowerCase().endsWith(".java")) { + if (filePath.toLowerCase(Locale.ROOT).startsWith("uitest") + && filePath.toLowerCase(Locale.ROOT).endsWith(".java")) { changedTestFilePaths.add(filePath); } } diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/ParameterizedTB3Runner.java b/uitest/src/test/java/com/vaadin/tests/tb3/ParameterizedTB3Runner.java index 20107f8058..9cadcece10 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/ParameterizedTB3Runner.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/ParameterizedTB3Runner.java @@ -77,7 +77,7 @@ public class ParameterizedTB3Runner extends TB3Runner { // getThemes -> setTheme String setter = "set" + m.getName().substring("get".length()); setter = setter.substring(0, setter.length() - 1); - // property = property.substring(0, 1).toLowerCase() + // property = property.substring(0, 1).toLowerCase(Locale.ROOT) // + property.substring(1); Method setterMethod; 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 4a34c355ad..8e55e9140a 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java @@ -26,6 +26,7 @@ import java.net.NetworkInterface; import java.net.SocketException; import java.util.Calendar; import java.util.Enumeration; +import java.util.Locale; import java.util.Properties; import org.openqa.selenium.ie.InternetExplorerDriver; @@ -131,8 +132,9 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { protected static DesiredCapabilities getRunLocallyCapabilities() { VaadinBrowserFactory factory = new VaadinBrowserFactory(); try { - return factory.create(Browser.valueOf(properties - .getProperty(RUN_LOCALLY_PROPERTY).toUpperCase())); + return factory.create( + Browser.valueOf(properties.getProperty(RUN_LOCALLY_PROPERTY) + .toUpperCase(Locale.ROOT))); } catch (Exception e) { System.err.println(e.getMessage()); System.err.println("Falling back to FireFox"); diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java index 7c4a5962f2..073670f75b 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; @@ -146,8 +147,8 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest { protected void assertColumnHeader(String expectedHeaderCaption, TestBenchElement testBenchElement) { - assertEquals(expectedHeaderCaption.toLowerCase(), - testBenchElement.getText().toLowerCase()); + assertEquals(expectedHeaderCaption.toLowerCase(Locale.ROOT), + testBenchElement.getText().toLowerCase(Locale.ROOT)); } protected GridCellElement getDefaultColumnHeader(int index) { @@ -244,7 +245,7 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest { List<WebElement> elements = sidebar .findElements(By.className("column-hiding-toggle")); for (WebElement e : elements) { - if ((e.getText().toLowerCase()) + if ((e.getText().toLowerCase(Locale.ROOT)) .startsWith("column " + columnIndex)) { return e; } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnHidingTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnHidingTest.java index 6531acb993..c81c024453 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnHidingTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnHidingTest.java @@ -22,8 +22,8 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.util.List; +import java.util.Locale; -import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -827,20 +827,17 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest { selectMenuPath("Component", "Row details", "Toggle details for...", "Row 1"); assertColumnHeaderOrder(0, 1, 2, 3, 4); - assertNotNull("Details not found", - getGridElement().getDetails(1)); + assertNotNull("Details not found", getGridElement().getDetails(1)); toggleHideColumnAPI(0); assertColumnHeaderOrder(1, 2, 3, 4); - assertNotNull("Details not found", - getGridElement().getDetails(1)); + assertNotNull("Details not found", getGridElement().getDetails(1)); toggleHideColumnAPI(0); assertColumnHeaderOrder(0, 1, 2, 3, 4); - assertNotNull("Details not found", - getGridElement().getDetails(1)); + assertNotNull("Details not found", getGridElement().getDetails(1)); } @Test @@ -884,17 +881,13 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest { toggleHideColumnAPI(1); getGridElement().scrollToRow(500); - assertEquals("(500, 0)", - getGridElement().getCell(500, 0).getText()); - assertEquals("(500, 2)", - getGridElement().getCell(500, 1).getText()); + assertEquals("(500, 0)", getGridElement().getCell(500, 0).getText()); + assertEquals("(500, 2)", getGridElement().getCell(500, 1).getText()); toggleHideColumnAPI(1); - assertEquals("(500, 0)", - getGridElement().getCell(500, 0).getText()); - assertEquals("(500, 1)", - getGridElement().getCell(500, 1).getText()); + assertEquals("(500, 0)", getGridElement().getCell(500, 0).getText()); + assertEquals("(500, 1)", getGridElement().getCell(500, 1).getText()); } @Test @@ -902,26 +895,20 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest { toggleHidableColumnAPI(0); toggleHidableColumnAPI(1); - assertEquals("(500, 0)", - getGridElement().getCell(500, 0).getText()); - assertEquals("(500, 1)", - getGridElement().getCell(500, 1).getText()); + assertEquals("(500, 0)", getGridElement().getCell(500, 0).getText()); + assertEquals("(500, 1)", getGridElement().getCell(500, 1).getText()); toggleHideColumnAPI(0); toggleHideColumnAPI(1); - assertEquals("(500, 2)", - getGridElement().getCell(500, 0).getText()); - assertEquals("(500, 3)", - getGridElement().getCell(500, 1).getText()); + assertEquals("(500, 2)", getGridElement().getCell(500, 0).getText()); + assertEquals("(500, 3)", getGridElement().getCell(500, 1).getText()); toggleHideColumnAPI(0); toggleHideColumnAPI(1); - assertEquals("(500, 0)", - getGridElement().getCell(500, 0).getText()); - assertEquals("(500, 1)", - getGridElement().getCell(500, 1).getText()); + assertEquals("(500, 0)", getGridElement().getCell(500, 0).getText()); + assertEquals("(500, 1)", getGridElement().getCell(500, 1).getText()); } private void loadSpannedCellsFixture() { @@ -987,7 +974,8 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest { private void verifyHeaderCellContent(int row, int column, String content) { GridCellElement headerCell = getGridElement().getHeaderCell(row, column); - assertEquals(content.toLowerCase(), headerCell.getText().toLowerCase()); + assertEquals(content.toLowerCase(Locale.ROOT), + headerCell.getText().toLowerCase(Locale.ROOT)); assertTrue(headerCell.isDisplayed()); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridFooterTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridFooterTest.java index 906f1fedba..cea86af619 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridFooterTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridFooterTest.java @@ -19,6 +19,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; +import java.util.Locale; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -160,7 +162,8 @@ public class GridFooterTest extends GridStaticSectionTest { * Reindeer has a CSS text transformation that changes the casing so * that we can't rely on it being what we set */ - assertEquals("footer (0,0)", textCell.getText().toLowerCase()); + assertEquals("footer (0,0)", + textCell.getText().toLowerCase(Locale.ROOT)); GridCellElement widgetCell = getGridElement().getFooterCell(0, 1); assertTrue(widgetCell.isElementPresent(By.className("gwt-HTML"))); @@ -193,7 +196,8 @@ public class GridFooterTest extends GridStaticSectionTest { * Reindeer has a CSS text transformation that changes the casing so * that we can't rely on it being what we set */ - assertEquals("text footer", textCell.getText().toLowerCase()); + assertEquals("text footer", + textCell.getText().toLowerCase(Locale.ROOT)); } @Test @@ -207,11 +211,11 @@ public class GridFooterTest extends GridStaticSectionTest { GridCellElement widgetCell = getGridElement().getFooterCell(0, 0); WebElement button = widgetCell.findElement(By.className("gwt-Button")); - assertNotEquals("clicked", button.getText().toLowerCase()); + assertNotEquals("clicked", button.getText().toLowerCase(Locale.ROOT)); new Actions(getDriver()).moveToElement(button, 5, 5).click().perform(); - assertEquals("clicked", button.getText().toLowerCase()); + assertEquals("clicked", button.getText().toLowerCase(Locale.ROOT)); } private void assertFooterCount(int count) { diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridHeaderTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridHeaderTest.java index 0f4a10a1af..7ece0ed729 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridHeaderTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridHeaderTest.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import java.util.Arrays; +import java.util.Locale; import org.junit.Test; import org.openqa.selenium.By; @@ -204,7 +205,8 @@ public class GridHeaderTest extends GridStaticSectionTest { * Reindeer has a CSS text transformation that changes the casing so * that we can't rely on it being what we set */ - assertEquals("header (0,0)", textCell.getText().toLowerCase()); + assertEquals("header (0,0)", + textCell.getText().toLowerCase(Locale.ROOT)); GridCellElement widgetCell = getGridElement().getHeaderCell(0, 1); assertTrue(widgetCell.isElementPresent(By.className("gwt-HTML"))); @@ -235,7 +237,8 @@ public class GridHeaderTest extends GridStaticSectionTest { * Reindeer has a CSS text transformation that changes the casing so * that we can't rely on it being what we set */ - assertEquals("text header", textCell.getText().toLowerCase()); + assertEquals("text header", + textCell.getText().toLowerCase(Locale.ROOT)); } @Test @@ -249,7 +252,7 @@ public class GridHeaderTest extends GridStaticSectionTest { new Actions(getDriver()).moveToElement(button, 5, 5).click().perform(); - assertEquals("clicked", button.getText().toLowerCase()); + assertEquals("clicked", button.getText().toLowerCase(Locale.ROOT)); } @Test @@ -264,11 +267,11 @@ public class GridHeaderTest extends GridStaticSectionTest { GridCellElement widgetCell = getGridElement().getHeaderCell(0, 0); WebElement button = widgetCell.findElement(By.className("gwt-Button")); - assertNotEquals("clicked", button.getText().toLowerCase()); + assertNotEquals("clicked", button.getText().toLowerCase(Locale.ROOT)); new Actions(getDriver()).moveToElement(button, 5, 5).click().perform(); - assertEquals("clicked", button.getText().toLowerCase()); + assertEquals("clicked", button.getText().toLowerCase(Locale.ROOT)); } private void assertHeaderCount(int count) { diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridStaticSectionTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridStaticSectionTest.java index 835e9d576c..6b9aa813de 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridStaticSectionTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridStaticSectionTest.java @@ -17,6 +17,8 @@ package com.vaadin.v7.tests.components.grid.basicfeatures.client; import static org.junit.Assert.assertEquals; +import java.util.Locale; + import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -88,8 +90,8 @@ public abstract class GridStaticSectionTest // IE 8 returns tags as upper case while other browsers do not, make the // comparison non-casesensive - html = html.toLowerCase(); - text = text.toLowerCase(); + html = html.toLowerCase(Locale.ROOT); + text = text.toLowerCase(Locale.ROOT); // IE 8 returns attributes without quotes, make the comparison without // quotes diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java index c27afc4fd0..d3f3f74f38 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java @@ -21,7 +21,8 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import org.junit.Assert; +import java.util.Locale; + import org.junit.Before; import org.junit.Test; @@ -32,10 +33,10 @@ import com.vaadin.v7.tests.components.grid.basicfeatures.GridBasicFeaturesTest; @TestCategory("grid") public class GridColumnVisibilityTest extends GridBasicFeaturesTest { - private static final String[] TOGGLE_LISTENER = { "Component", - "State", "ColumnVisibilityChangeListener" }; - private static final String[] TOGGLE_HIDE_COLUMN_0 = { - "Component", "Columns", "Column 0", "Hidden" }; + private static final String[] TOGGLE_LISTENER = { "Component", "State", + "ColumnVisibilityChangeListener" }; + private static final String[] TOGGLE_HIDE_COLUMN_0 = { "Component", + "Columns", "Column 0", "Hidden" }; private static final String COLUMN_0_BECAME_HIDDEN_MSG = "Visibility " + "changed: propertyId: Column 0, isHidden: true"; @@ -51,20 +52,20 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { @Test public void columnIsNotShownWhenHidden() { - assertEquals("column 0", - getGridElement().getHeaderCell(0, 0).getText().toLowerCase()); + assertEquals("column 0", getGridElement().getHeaderCell(0, 0).getText() + .toLowerCase(Locale.ROOT)); selectMenuPath(TOGGLE_HIDE_COLUMN_0); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 0).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 0).getText() + .toLowerCase(Locale.ROOT)); } @Test public void columnIsShownWhenUnhidden() { selectMenuPath(TOGGLE_HIDE_COLUMN_0); selectMenuPath(TOGGLE_HIDE_COLUMN_0); - assertEquals("column 0", - getGridElement().getHeaderCell(0, 0).getText().toLowerCase()); + assertEquals("column 0", getGridElement().getHeaderCell(0, 0).getText() + .toLowerCase(Locale.ROOT)); } @Test @@ -170,15 +171,15 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { public void testColumnHidingToggleCaption_settingToggleCaption_updatesToggle() { toggleColumnHidable(1); getSidebarOpenButton().click(); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); assertEquals("Column 1", getColumnHidingToggle(1).getText()); toggleColumnHidingToggleCaptionChange(1); getSidebarOpenButton().click(); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); assertEquals("Column 1 caption 0", getColumnHidingToggle(1).getText()); toggleColumnHidingToggleCaptionChange(1); @@ -190,8 +191,8 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { public void testColumnHidingToggleCaption_settingWidgetToHeader_toggleCaptionStays() { toggleColumnHidable(1); getSidebarOpenButton().click(); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); assertEquals("Column 1", getColumnHidingToggle(1).getText()); selectMenuPath("Component", "Columns", "Column 1", "Header Type", @@ -209,8 +210,8 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { "Change header caption"); getSidebarOpenButton().click(); - assertEquals("column 1 header 0", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1 header 0", getGridElement().getHeaderCell(0, 1) + .getText().toLowerCase(Locale.ROOT)); assertEquals("Column 1 header 0", getColumnHidingToggle(1).getText()); } @@ -224,8 +225,8 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { "Change header caption"); getSidebarOpenButton().click(); - assertEquals("column 1 header 0", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1 header 0", getGridElement().getHeaderCell(0, 1) + .getText().toLowerCase(Locale.ROOT)); assertEquals("Column 1 caption 0", getColumnHidingToggle(1).getText()); } @@ -322,8 +323,7 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { getColumnHidingToggle(3).click(); // Make sure that the new column contains the data it should - assertEquals("(999, 3)", - getGridElement().getCell(999, 3).getText()); + assertEquals("(999, 3)", getGridElement().getCell(999, 3).getText()); } private void verifyColumnFrozen(int index) { diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStaticSectionComponentTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStaticSectionComponentTest.java index ed0b4a7186..10f9173300 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStaticSectionComponentTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStaticSectionComponentTest.java @@ -18,6 +18,8 @@ package com.vaadin.v7.tests.components.grid.basicfeatures.server; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import java.util.Locale; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -64,8 +66,8 @@ public class GridStaticSectionComponentTest extends GridBasicFeaturesTest { assertTrue("No notifications should've been shown", !$(NotificationElement.class).exists()); assertEquals("Header should've been reverted back to text header", - "text header", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + "text header", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStructureTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStructureTest.java index 53a229a4c0..1d139b67a9 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStructureTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStructureTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.List; +import java.util.Locale; import org.junit.Test; import org.openqa.selenium.NoSuchElementException; @@ -58,11 +59,11 @@ public class GridStructureTest extends GridBasicFeaturesTest { setDebug(true); openTestURL(); - assertEquals("column 0", - getGridElement().getHeaderCell(0, 0).getText().toLowerCase()); + assertEquals("column 0", getGridElement().getHeaderCell(0, 0).getText() + .toLowerCase(Locale.ROOT)); selectMenuPath("Component", "Columns", "Column 0", "Add / Remove"); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 0).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 0).getText() + .toLowerCase(Locale.ROOT)); selectMenuPath("Component", "Columns", "Column 0", "Add / Remove"); // Column 0 is now the last column in Grid. @@ -76,14 +77,16 @@ public class GridStructureTest extends GridBasicFeaturesTest { // Column 0 should be visible List<TestBenchElement> cells = getGridHeaderRowCells(); - assertEquals("column 0", cells.get(0).getText().toLowerCase()); + assertEquals("column 0", + cells.get(0).getText().toLowerCase(Locale.ROOT)); // Hide column 0 selectMenuPath("Component", "Columns", "Column 0", "Add / Remove"); // Column 1 should now be the first cell cells = getGridHeaderRowCells(); - assertEquals("column 1", cells.get(0).getText().toLowerCase()); + assertEquals("column 1", + cells.get(0).getText().toLowerCase(Locale.ROOT)); } @Test |