From a417a2cd6a612e7ed1a99b14230c3f08e455f9c1 Mon Sep 17 00:00:00 2001 From: Erick Erickson Date: Mon, 16 Apr 2018 21:51:02 -0700 Subject: [PATCH] SOLR-10169: PeerSync will hit an NPE on no response errors when looking for fingerprint. --- solr/CHANGES.txt | 4 +++- .../core/src/java/org/apache/solr/update/PeerSync.java | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index dd4114a9268..e01036684fa 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -161,7 +161,9 @@ Bug Fixes (Amrit Sarkar, Varun Thacker) * SOLR-11840: Fix bin/solr help-text inconsistencies (Jason Gerlowski) - + +* SOLR-10169: PeerSync will hit an NPE on no response errors when looking for fingerprint. (Erick Erickson) + Optimizations ---------------------- diff --git a/solr/core/src/java/org/apache/solr/update/PeerSync.java b/solr/core/src/java/org/apache/solr/update/PeerSync.java index 10b3ea11858..3511a6cb473 100644 --- a/solr/core/src/java/org/apache/solr/update/PeerSync.java +++ b/solr/core/src/java/org/apache/solr/update/PeerSync.java @@ -388,9 +388,13 @@ public class PeerSync implements SolrMetricProducer { ShardResponse srsp = shardHandler.takeCompletedOrError(); if (srsp == null) break; - Object replicaFingerprint = srsp.getSolrResponse().getResponse().get("fingerprint"); + Object replicaFingerprint = null; + if (srsp.getSolrResponse() != null && srsp.getSolrResponse().getResponse() != null) { + replicaFingerprint = srsp.getSolrResponse().getResponse().get("fingerprint"); + } + if (replicaFingerprint == null) { - log.warn("Replica did not return a fingerprint - possibly an older Solr version"); + log.warn("Replica did not return a fingerprint - possibly an older Solr version or exception"); continue; } @@ -402,7 +406,7 @@ public class PeerSync implements SolrMetricProducer { return true; } } catch(IOException e) { - log.warn("Could not cofirm if we are already in sync. Continue with PeerSync"); + log.warn("Could not confirm if we are already in sync. Continue with PeerSync"); } }