Fix more locale bugs in SQL handler ans streams

This commit is contained in:
Uwe Schindler 2016-02-09 08:32:48 +01:00
parent e78002bdc1
commit 8dddd88d30
2 changed files with 6 additions and 8 deletions

View File

@ -165,13 +165,13 @@ public class SQLHandler extends RequestHandlerBase implements SolrCoreAware {
TupleStream sqlStream = null; TupleStream sqlStream = null;
if(sqlVistor.table.toUpperCase(Locale.getDefault()).contains("_CATALOGS_")) { if(sqlVistor.table.toUpperCase(Locale.ROOT).contains("_CATALOGS_")) {
if (!sqlVistor.fields.contains("TABLE_CAT")) { if (!sqlVistor.fields.contains("TABLE_CAT")) {
throw new IOException("When querying _CATALOGS_, fields must contain column TABLE_CAT"); throw new IOException("When querying _CATALOGS_, fields must contain column TABLE_CAT");
} }
sqlStream = new CatalogsStream(defaultZkhost); sqlStream = new CatalogsStream(defaultZkhost);
} else if(sqlVistor.table.toUpperCase(Locale.getDefault()).contains("_SCHEMAS_")) { } else if(sqlVistor.table.toUpperCase(Locale.ROOT).contains("_SCHEMAS_")) {
if (!sqlVistor.fields.contains("TABLE_SCHEM") || !sqlVistor.fields.contains("TABLE_CATALOG")) { if (!sqlVistor.fields.contains("TABLE_SCHEM") || !sqlVistor.fields.contains("TABLE_CATALOG")) {
throw new IOException("When querying _SCHEMAS_, fields must contain both TABLE_SCHEM and TABLE_CATALOG"); throw new IOException("When querying _SCHEMAS_, fields must contain both TABLE_SCHEM and TABLE_CATALOG");
} }
@ -657,7 +657,7 @@ public class SQLHandler extends RequestHandlerBase implements SolrCoreAware {
} }
if(!sortItem.getOrdering().toString().toLowerCase(Locale.getDefault()).contains(direction.toLowerCase(Locale.getDefault()))) { if(!sortItem.getOrdering().toString().toLowerCase(Locale.ROOT).contains(direction.toLowerCase(Locale.ROOT))) {
return false; return false;
} }
} }
@ -838,7 +838,7 @@ public class SQLHandler extends RequestHandlerBase implements SolrCoreAware {
} }
private static String ascDesc(String s) { private static String ascDesc(String s) {
if(s.toLowerCase(Locale.getDefault()).contains("desc")) { if(s.toLowerCase(Locale.ROOT).contains("desc")) {
return "desc"; return "desc";
} else { } else {
return "asc"; return "asc";
@ -846,7 +846,7 @@ public class SQLHandler extends RequestHandlerBase implements SolrCoreAware {
} }
private static ComparatorOrder ascDescComp(String s) { private static ComparatorOrder ascDescComp(String s) {
if(s.toLowerCase(Locale.getDefault()).contains("desc")) { if(s.toLowerCase(Locale.ROOT).contains("desc")) {
return ComparatorOrder.DESCENDING; return ComparatorOrder.DESCENDING;
} else { } else {
return ComparatorOrder.ASCENDING; return ComparatorOrder.ASCENDING;

View File

@ -300,11 +300,9 @@ public class CloudSolrStream extends TupleStream implements Expressible {
Collection<Slice> slices = clusterState.getActiveSlices(this.collection); Collection<Slice> slices = clusterState.getActiveSlices(this.collection);
if(slices == null) { if(slices == null) {
String colLower = this.collection.toLowerCase(Locale.getDefault());
//Try case insensitive match //Try case insensitive match
for(String col : clusterState.getCollections()) { for(String col : clusterState.getCollections()) {
if(col.toLowerCase(Locale.getDefault()).equals(colLower)) { if(col.equalsIgnoreCase(this.collection)) {
slices = clusterState.getActiveSlices(col); slices = clusterState.getActiveSlices(col);
break; break;
} }