Skip to content

Commit

Permalink
Merge pull request #1775 from RAVEENSR/master
Browse files Browse the repository at this point in the history
Fix use of non-localized String.toLowerCase() issue
  • Loading branch information
TanyaM authored Jan 15, 2020
2 parents 9fe252f + c1e2d6e commit 12a83f3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.Locale;
import javax.sql.DataSource;

/**
Expand Down Expand Up @@ -80,7 +81,7 @@ private Connection initConnection() {
String databaseProductName = databaseMetaData.getDatabaseProductName();
// DB2 product name changes with the specific versions(For an example DB2/LINUXX8664, DB2/NT). Hence, checks
// whether the product name contains "DB2".
if (databaseProductName.toLowerCase().contains(DB2_DB_TYPE.toLowerCase())) {
if (databaseProductName.toLowerCase(Locale.ENGLISH).contains(DB2_DB_TYPE.toLowerCase(Locale.ENGLISH))) {
databaseProductName = DB2_DB_TYPE;
}
queryManager = new QueryManager(databaseProductName, databaseMetaData.getDatabaseProductVersion(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public DataProvider init(String topic, String sessionId, JsonElement jsonElement
String databaseVersion = connection.getMetaData().getDatabaseProductVersion();
// DB2 product name changes with the specific versions(For an example DB2/LINUXX8664, DB2/NT). Hence, checks
// whether the product name contains "DB2".
if (databaseName.toLowerCase().contains(DB2_DB_TYPE.toLowerCase())) {
if (databaseName.toLowerCase(Locale.ENGLISH).contains(DB2_DB_TYPE.toLowerCase(Locale.ENGLISH))) {
databaseName = DB2_DB_TYPE;
}
RDBMSQueryManager rdbmsQueryManager = new RDBMSQueryManager(databaseName, databaseVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.wso2.carbon.streaming.integrator.core.persistence.query.QueryManager;

import java.io.IOException;
import java.util.Locale;

/**
* Class used to get Database queries according to RDBMS type used.
Expand All @@ -50,7 +51,7 @@ public RDBMSQueryConfigurationEntry getDatabaseQueryEntries(String databaseType,
RDBMSQueryConfigurationEntry databaseQueryEntries = new RDBMSQueryConfigurationEntry();
// DB2 product name changes with the specific versions(For an example DB2/LINUXX8664, DB2/NT). Hence, checks
// whether the product name contains "DB2".
if (databaseType.toLowerCase().contains(DB2_DB_TYPE)) {
if (databaseType.toLowerCase(Locale.ENGLISH).contains(DB2_DB_TYPE)) {
databaseType = DB2_DB_TYPE;
}
try {
Expand Down

0 comments on commit 12a83f3

Please sign in to comment.