summaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-10-20 10:10:02 +0200
committerPéter Török <31210544+torok-peter@users.noreply.github.com>2017-10-20 11:10:02 +0300
commita9c83ba07e4dec90eb7d6e332b91adde9613ebb4 (patch)
tree7907a6c389ae740572197d949e27c6fd3c25491c /shared
parent0a26d0e44169f9643e7d30ba370b8ecbbe128a56 (diff)
downloadvaadin-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(
Diffstat (limited to 'shared')
-rw-r--r--shared/src/main/java/com/vaadin/shared/VBrowserDetails.java3
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/PreloadMode.java4
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/dnd/criteria/Payload.java15
-rw-r--r--shared/src/main/java/com/vaadin/shared/util/SharedUtil.java6
4 files changed, 16 insertions, 12 deletions
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);
}