Skip to content

Commit

Permalink
Apply Locale.ROOT for string case change methods' locale
Browse files Browse the repository at this point in the history
  • Loading branch information
cppwfs committed Oct 18, 2024
1 parent 612710e commit d1cb4e9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
Expand Down Expand Up @@ -527,7 +528,7 @@ private Page<TaskExecution> queryForPageableResults(Pageable pageable, String se

if (sort != null) {
for (Sort.Order sortOrder : sort) {
if (validSortColumns.contains(sortOrder.getProperty().toUpperCase())) {
if (validSortColumns.contains(sortOrder.getProperty().toUpperCase(Locale.ROOT))) {
sortOrderMap.put(sortOrder.getProperty(),
sortOrder.isAscending() ? Order.ASCENDING : Order.DESCENDING);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import javax.sql.DataSource;
Expand Down Expand Up @@ -157,7 +158,7 @@ public void init(DataSource dataSource) throws Exception {
private String removeKeyWord(String keyWord, String clause) {
String temp = clause.trim();
String keyWordString = keyWord + " ";
if (temp.toLowerCase().startsWith(keyWordString) && temp.length() > keyWordString.length()) {
if (temp.toLowerCase(Locale.ROOT).startsWith(keyWordString) && temp.length() > keyWordString.length()) {
return temp.substring(keyWordString.length());
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.springframework.cloud.task.repository.database.support;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import javax.sql.DataSource;
Expand Down Expand Up @@ -135,7 +136,7 @@ public PagingQueryProvider getObject() throws Exception {

DatabaseType type;
try {
type = this.databaseType != null ? DatabaseType.valueOf(this.databaseType.toUpperCase())
type = this.databaseType != null ? DatabaseType.valueOf(this.databaseType.toUpperCase(Locale.ROOT))
: DatabaseType.fromMetaData(this.dataSource);
}
catch (MetaDataAccessException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.springframework.cloud.task.repository.support;

import java.sql.SQLException;
import java.util.Locale;

import javax.sql.DataSource;

Expand Down Expand Up @@ -84,7 +85,8 @@ public void setResourceLoader(ResourceLoader resourceLoader) {

private String getDatabaseType(DataSource dataSource) {
try {
return JdbcUtils.commonDatabaseName(DatabaseType.fromMetaData(dataSource).toString()).toLowerCase();
return JdbcUtils.commonDatabaseName(DatabaseType.fromMetaData(dataSource).toString())
.toLowerCase(Locale.ROOT);
}
catch (MetaDataAccessException ex) {
throw new IllegalStateException("Unable to detect database type", ex);
Expand Down

0 comments on commit d1cb4e9

Please sign in to comment.