From f70138214b175024785d9f98f6aa671e1791cae0 Mon Sep 17 00:00:00 2001 From: Noble Paul Date: Thu, 16 Jan 2014 16:24:34 +0000 Subject: [PATCH] SOLR-5476 removing forbidden API usage git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1558846 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/solr/cloud/OverseerCollectionProcessor.java | 7 ++++--- .../org/apache/solr/handler/admin/CollectionsHandler.java | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java index 57c7d26a093..7507cf93290 100644 --- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java +++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java @@ -69,6 +69,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -352,7 +353,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread { deleteReplica(zkStateReader.getClusterState(), message, results); } else if (MIGRATE.equals(operation)) { migrate(zkStateReader.getClusterState(), message, results); - } else if(REMOVEROLE.toString().toLowerCase().equals(operation) || ADDROLE.toString().toLowerCase().equals(operation) ){ + } else if(REMOVEROLE.toString().toLowerCase(Locale.ROOT).equals(operation) || ADDROLE.toString().toLowerCase(Locale.ROOT).equals(operation) ){ processRoleCommand(message, operation); } @@ -388,10 +389,10 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread { List nodeList= (List) roles.get(roleName); if(nodeList == null) roles.put(roleName, nodeList = new ArrayList()); - if(ADDROLE.toString().toLowerCase().equals(operation) ){ + if(ADDROLE.toString().toLowerCase(Locale.ROOT).equals(operation) ){ log.info("Overseer role added to {}", node); if(!nodeList.contains(node)) nodeList.add(node); - } else if(REMOVEROLE.toString().toLowerCase().equals(operation)) { + } else if(REMOVEROLE.toString().toLowerCase(Locale.ROOT).equals(operation)) { log.info("Overseer role removed from {}", node); nodeList.remove(node); } diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java index 0fd39f01e7f..94c4d5f1e7e 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java @@ -53,6 +53,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -198,11 +199,11 @@ public class CollectionsHandler extends RequestHandlerBase { private void handleRole(CollectionAction action, SolrQueryRequest req, SolrQueryResponse rsp) throws KeeperException, InterruptedException { req.getParams().required().check("role", "node"); - Map map = ZkNodeProps.makeMap(Overseer.QUEUE_OPERATION, action.toString().toLowerCase()); + Map map = ZkNodeProps.makeMap(Overseer.QUEUE_OPERATION, action.toString().toLowerCase(Locale.ROOT)); copyIfNotNull(req.getParams(), map,"role", "node"); ZkNodeProps m = new ZkNodeProps(map); if(!KNOWN_ROLES.contains(m.getStr("role"))) throw new SolrException(ErrorCode.BAD_REQUEST,"Unknown role. Supported roles are ,"+ KNOWN_ROLES); - handleResponse(action.toString().toLowerCase(), m, rsp); + handleResponse(action.toString().toLowerCase(Locale.ROOT), m, rsp); } public static long DEFAULT_ZK_TIMEOUT = 60*1000;