SOLR-6530: Protect against NPE when there are no live replicas

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1633276 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2014-10-21 06:10:18 +00:00
parent c1bdf27d97
commit 58fe66dba7
1 changed files with 6 additions and 4 deletions

View File

@ -850,12 +850,14 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
List<ZkCoreNodeProps> myReplicas = zkController.getZkStateReader().getReplicaProps(collection, List<ZkCoreNodeProps> myReplicas = zkController.getZkStateReader().getReplicaProps(collection,
cloudDesc.getShardId(), cloudDesc.getCoreNodeName()); cloudDesc.getShardId(), cloudDesc.getCoreNodeName());
boolean foundErrorNodeInReplicaList = false; boolean foundErrorNodeInReplicaList = false;
if (myReplicas != null) {
for (ZkCoreNodeProps replicaProp : myReplicas) { for (ZkCoreNodeProps replicaProp : myReplicas) {
if (((Replica) replicaProp.getNodeProps()).getName().equals(((Replica)stdNode.getNodeProps().getNodeProps()).getName())) { if (((Replica) replicaProp.getNodeProps()).getName().equals(((Replica)stdNode.getNodeProps().getNodeProps()).getName())) {
foundErrorNodeInReplicaList = true; foundErrorNodeInReplicaList = true;
break; break;
} }
} }
}
if (cloudDesc.getCoreNodeName().equals(leaderCoreNodeName) && foundErrorNodeInReplicaList) { if (cloudDesc.getCoreNodeName().equals(leaderCoreNodeName) && foundErrorNodeInReplicaList) {
try { try {