SOLR-8414: AbstractDistribZkTestBase.verifyReplicaStatus could throw NPE

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1719981 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christine Poerschke 2015-12-14 18:16:44 +00:00
parent 1d6b78efdb
commit f81f939b54
2 changed files with 8 additions and 3 deletions

View File

@ -312,6 +312,8 @@ Other Changes
* SOLR-8352: randomise unload order in UnloadDistributedZkTest.testUnloadShardAndCollection (Christine Poerschke) * SOLR-8352: randomise unload order in UnloadDistributedZkTest.testUnloadShardAndCollection (Christine Poerschke)
* SOLR-8414: AbstractDistribZkTestBase.verifyReplicaStatus could throw NPE (Christine Poerschke)
================== 5.4.0 ================== ================== 5.4.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

View File

@ -224,11 +224,14 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes
while(maxIterations-->0) { while(maxIterations-->0) {
Slice slice = reader.getClusterState().getSlice(collection, shard); Slice slice = reader.getClusterState().getSlice(collection, shard);
if(slice!=null) { if(slice!=null) {
coreState = slice.getReplicasMap().get(coreNodeName).getState(); Replica replica = slice.getReplicasMap().get(coreNodeName);
if (replica != null) {
coreState = replica.getState();
if(coreState == expectedState) { if(coreState == expectedState) {
return; return;
} }
} }
}
Thread.sleep(50); Thread.sleep(50);
} }
fail("Illegal state, was: " + coreState + " expected:" + expectedState + " clusterState:" + reader.getClusterState()); fail("Illegal state, was: " + coreState + " expected:" + expectedState + " clusterState:" + reader.getClusterState());