mirror of https://github.com/apache/lucene.git
Fix more locale bugs in SQL handler ans streams
This commit is contained in:
parent
e78002bdc1
commit
8dddd88d30
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue