From 352ae7ed5f13f746a58feb3dbae380e2d880c1ed Mon Sep 17 00:00:00 2001 From: Joel Bernstein Date: Wed, 16 Dec 2015 21:41:56 +0000 Subject: [PATCH] SOLR-8191: Gaurd against CloudSolrStream close method NullPointerException git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1720460 13f79535-47bb-0310-9956-ffa450edef68 --- .../solr/client/solrj/io/stream/CloudSolrStream.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CloudSolrStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CloudSolrStream.java index 979582a1a99..806a34284fe 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CloudSolrStream.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CloudSolrStream.java @@ -361,11 +361,13 @@ public class CloudSolrStream extends TupleStream implements Expressible { * Closes the CloudSolrStream **/ public void close() throws IOException { - for(TupleStream solrStream : solrStreams) { - solrStream.close(); + if(solrStreams != null) { + for (TupleStream solrStream : solrStreams) { + solrStream.close(); + } } - if(cache == null) { + if(cache == null && cloudSolrClient != null) { cloudSolrClient.close(); } }