mirror of https://github.com/apache/lucene.git
SOLR-5476 removing forbidden API usage
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1558846 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d9b3ed94e7
commit
f70138214b
|
@ -69,6 +69,7 @@ import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -352,7 +353,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
|
||||||
deleteReplica(zkStateReader.getClusterState(), message, results);
|
deleteReplica(zkStateReader.getClusterState(), message, results);
|
||||||
} else if (MIGRATE.equals(operation)) {
|
} else if (MIGRATE.equals(operation)) {
|
||||||
migrate(zkStateReader.getClusterState(), message, results);
|
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);
|
processRoleCommand(message, operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,10 +389,10 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
|
||||||
|
|
||||||
List nodeList= (List) roles.get(roleName);
|
List nodeList= (List) roles.get(roleName);
|
||||||
if(nodeList == null) roles.put(roleName, nodeList = new ArrayList());
|
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);
|
log.info("Overseer role added to {}", node);
|
||||||
if(!nodeList.contains(node)) nodeList.add(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);
|
log.info("Overseer role removed from {}", node);
|
||||||
nodeList.remove(node);
|
nodeList.remove(node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
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 {
|
private void handleRole(CollectionAction action, SolrQueryRequest req, SolrQueryResponse rsp) throws KeeperException, InterruptedException {
|
||||||
req.getParams().required().check("role", "node");
|
req.getParams().required().check("role", "node");
|
||||||
Map<String, Object> map = ZkNodeProps.makeMap(Overseer.QUEUE_OPERATION, action.toString().toLowerCase());
|
Map<String, Object> map = ZkNodeProps.makeMap(Overseer.QUEUE_OPERATION, action.toString().toLowerCase(Locale.ROOT));
|
||||||
copyIfNotNull(req.getParams(), map,"role", "node");
|
copyIfNotNull(req.getParams(), map,"role", "node");
|
||||||
ZkNodeProps m = new ZkNodeProps(map);
|
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);
|
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;
|
public static long DEFAULT_ZK_TIMEOUT = 60*1000;
|
||||||
|
|
Loading…
Reference in New Issue