Skip to content

Apache Lucene open-source search software

SOLR-8414: AbstractDistribZkTestBase.verifyReplicaStatus could throw NPE

Christine Poerschkef81f939b5411
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 844cd159ac0..39b8b313e1e 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -312,6 +312,8 @@ Other Changes
* SOLR-8352: randomise unload order in UnloadDistributedZkTest.testUnloadShardAndCollection (Christine Poerschke)
+* SOLR-8414: AbstractDistribZkTestBase.verifyReplicaStatus could throw NPE (Christine Poerschke)
+
================== 5.4.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
index 9d9812e81eb..648fe646b1d 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
@@ -224,9 +224,12 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes
while(maxIterations-->0) {
Slice slice = reader.getClusterState().getSlice(collection, shard);
if(slice!=null) {
- coreState = slice.getReplicasMap().get(coreNodeName).getState();
- if(coreState == expectedState) {
- return;
+ Replica replica = slice.getReplicasMap().get(coreNodeName);
+ if (replica != null) {
+ coreState = replica.getState();
+ if(coreState == expectedState) {
+ return;
+ }
}
}
Thread.sleep(50);