From f1a6b68d75e58f464b2ed4ee3702a6c1b14511a0 Mon Sep 17 00:00:00 2001 From: Noble Paul Date: Sat, 28 Oct 2017 11:57:42 +1030 Subject: [PATCH] SOLR-11484: fixing NPE --- .../apache/solr/client/solrj/impl/CloudSolrClient.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java index 772c74139c2..d746fe6b8a5 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java @@ -922,10 +922,12 @@ public class CloudSolrClient extends SolrClient { // so that the next attempt would fetch the fresh state // just re-read state for all of them, if it has not been retried // in retryExpiryTime time - for (DocCollection ext : requestedCollections) { - ExpiringCachedDocCollection cacheEntry = collectionStateCache.get(ext.getName()); - if (cacheEntry == null) continue; - cacheEntry.maybeStale = true; + if (requestedCollections != null) { + for (DocCollection ext : requestedCollections) { + ExpiringCachedDocCollection cacheEntry = collectionStateCache.get(ext.getName()); + if (cacheEntry == null) continue; + cacheEntry.maybeStale = true; + } } if (retryCount < MAX_STALE_RETRIES) {//if it is a communication error , we must try again //may be, we have a stale version of the collection state