Skip to content

Apache Lucene open-source search software

LUCENE-9967: don't throw NullPointerException while handling a different root-cause exception in ReplicaNode.start

Mike McCandless654e97819071
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index d88fd79b3eb..79db029b684 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -229,7 +229,6 @@ Improvements
Bug fixes
-
* LUCENE-9686: Fix read past EOF handling in DirectIODirectory. (Zach Chen,
Julie Tibshirani)
@@ -395,6 +394,9 @@ Bug Fixes
the total count for a dimension. Prior to this fix, multi-value docs could contribute a > 1
count to the dimension count. (Greg Miller)
+* LUCEDNE-9967: Do not throw NullPointerException while trying to handle another exception in
+ ReplicaNode.start (Steven Schlansker)
+
Other
---------------------
diff --git a/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/ReplicaNode.java b/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/ReplicaNode.java
index 2e616a8717c..ee0becb3096 100644
--- a/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/ReplicaNode.java
+++ b/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/ReplicaNode.java
@@ -29,6 +29,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -332,7 +333,7 @@ public abstract class ReplicaNode extends Node {
message("top: done start");
state = "idle";
} catch (Throwable t) {
- if (t.getMessage().startsWith("replica cannot start") == false) {
+ if (Objects.toString(t.getMessage()).startsWith("replica cannot start") == false) {
message("exc on start:");
t.printStackTrace(printStream);
} else {