summaryrefslogtreecommitdiffstats
path: root/compatibility-server/src
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 /compatibility-server/src
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 'compatibility-server/src')
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/FieldGroup.java3
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/data/util/filter/Like.java16
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/data/util/filter/SimpleStringFilter.java15
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/connection/SimpleJDBCConnectionPool.java8
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/FreeformQuery.java3
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/TableQuery.java9
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/generator/filter/LikeTranslator.java4
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractColorPicker.java5
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java4
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/ui/themes/Runo.java4
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java3
11 files changed, 47 insertions, 27 deletions
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;
}