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
This commit is contained in:
Joel Bernstein 2015-12-16 21:41:56 +00:00
parent d200689b2b
commit 352ae7ed5f
1 changed files with 5 additions and 3 deletions

View File

@ -361,11 +361,13 @@ public class CloudSolrStream extends TupleStream implements Expressible {
* Closes the CloudSolrStream * Closes the CloudSolrStream
**/ **/
public void close() throws IOException { public void close() throws IOException {
if(solrStreams != null) {
for (TupleStream solrStream : solrStreams) { for (TupleStream solrStream : solrStreams) {
solrStream.close(); solrStream.close();
} }
}
if(cache == null) { if(cache == null && cloudSolrClient != null) {
cloudSolrClient.close(); cloudSolrClient.close();
} }
} }