You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2016/08/02 01:07:37 UTC

[17/40] lucene-solr:apiv2: SOLR-9339: NPE in CloudSolrClient when the response is null

SOLR-9339: NPE in CloudSolrClient when the response is null


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/9a24dc5d
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/9a24dc5d
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/9a24dc5d

Branch: refs/heads/apiv2
Commit: 9a24dc5d2ca890a50dc9751cb3abfd93c9939fee
Parents: 4ed68bc
Author: Noble Paul <no...@apache.org>
Authored: Tue Jul 26 13:08:28 2016 +0530
Committer: Noble Paul <no...@apache.org>
Committed: Tue Jul 26 13:08:28 2016 +0530

----------------------------------------------------------------------
 solr/CHANGES.txt                                                   | 2 ++
 .../java/org/apache/solr/client/solrj/impl/CloudSolrClient.java    | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9a24dc5d/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index e392df3..4da2d0e 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -163,6 +163,8 @@ Bug Fixes
 
 * SOLR-9334: CloudSolrClient.collectionStateCache is unbounded (noble)
 
+* SOLR-9339: NPE in CloudSolrClient when the response is null (noble)
+
 
 Optimizations
 ----------------------

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9a24dc5d/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
----------------------------------------------------------------------
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 b4c9b4f..1f1c675 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
@@ -1060,7 +1060,7 @@ public class CloudSolrClient extends SolrClient {
     try {
       resp = sendRequest(request, collection);
       //to avoid an O(n) operation we always add STATE_VERSION to the last and try to read it from there
-      Object o = resp.get(STATE_VERSION, resp.size()-1);
+      Object o = resp == null || resp.size() == 0 ? null : resp.get(STATE_VERSION, resp.size() - 1);
       if(o != null && o instanceof Map) {
         //remove this because no one else needs this and tests would fail if they are comparing responses
         resp.remove(resp.size()-1);