Enum -> toString -> toLowerCase fails for TR locale (for opType especially)

This commit is contained in:
Ozgur Orhan 2012-06-13 14:08:19 +03:00 committed by Shay Banon
parent cecb762ede
commit b80eee305e
5 changed files with 6 additions and 6 deletions

View File

@ -234,7 +234,7 @@ public class TransportBulkAction extends TransportAction<BulkRequest, BulkRespon
for (BulkItemRequest request : requests) {
if (request.request() instanceof IndexRequest) {
IndexRequest indexRequest = (IndexRequest) request.request();
responses[request.id()] = new BulkItemResponse(request.id(), indexRequest.opType().toString().toLowerCase(),
responses[request.id()] = new BulkItemResponse(request.id(), indexRequest.opType().toString().toLowerCase(Locale.ENGLISH),
new BulkItemResponse.Failure(indexRequest.index(), indexRequest.type(), indexRequest.id(), message));
} else if (request.request() instanceof DeleteRequest) {
DeleteRequest deleteRequest = (DeleteRequest) request.request();

View File

@ -183,7 +183,7 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
}
// add the response
responses[i] = new BulkItemResponse(item.id(), indexRequest.opType().toString().toLowerCase(),
responses[i] = new BulkItemResponse(item.id(), indexRequest.opType().toString().toLowerCase(Locale.ENGLISH),
new IndexResponse(indexRequest.index(), indexRequest.type(), indexRequest.id(), version));
} catch (Exception e) {
// rethrow the failure if we are going to retry on primary and let parent failure to handle it
@ -195,7 +195,7 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
} else {
logger.debug("[{}][{}] failed to bulk item (index) {}", e, shardRequest.request.index(), shardRequest.shardId, indexRequest);
}
responses[i] = new BulkItemResponse(item.id(), indexRequest.opType().toString().toLowerCase(),
responses[i] = new BulkItemResponse(item.id(), indexRequest.opType().toString().toLowerCase(Locale.ENGLISH),
new BulkItemResponse.Failure(indexRequest.index(), indexRequest.type(), indexRequest.id(), ExceptionsHelper.detailedMessage(e)));
// nullify the request so it won't execute on the replicas
request.items()[i] = null;

View File

@ -536,7 +536,7 @@ public class IndexMetaData {
builder.startObject(indexMetaData.index(), XContentBuilder.FieldCaseConversion.NONE);
builder.field("version", indexMetaData.version());
builder.field("state", indexMetaData.state().toString().toLowerCase());
builder.field("state", indexMetaData.state().toString().toLowerCase(Locale.ENGLISH));
boolean binary = params.paramAsBoolean("binary", false);

View File

@ -167,7 +167,7 @@ public class TextQueryBuilder extends BaseQueryBuilder implements BoostableQuery
builder.field("query", text);
if (type != null) {
builder.field("type", type.toString().toLowerCase());
builder.field("type", type.toString().toLowerCase(Locale.ENGLISH));
}
if (operator != null) {
builder.field("operator", operator.toString());

View File

@ -182,7 +182,7 @@ public class RestClusterStateAction extends BaseRestHandler {
for (IndexMetaData indexMetaData : state.metaData()) {
builder.startObject(indexMetaData.index(), XContentBuilder.FieldCaseConversion.NONE);
builder.field("state", indexMetaData.state().toString().toLowerCase());
builder.field("state", indexMetaData.state().toString().toLowerCase(Locale.ENGLISH));
builder.startObject("settings");
Settings settings = settingsFilter.filterSettings(indexMetaData.settings());