From 372a592f90c929478ba6bded3366c2d4337e2835 Mon Sep 17 00:00:00 2001 From: Erick Erickson Date: Mon, 4 Mar 2013 14:20:39 +0000 Subject: [PATCH] SOLR-4525, another place where I missed closing the stream git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1452321 13f79535-47bb-0310-9956-ffa450edef68 --- solr/core/src/java/org/apache/solr/cloud/ZkCLI.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java b/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java index 8e42d09ef00..f94722b08ce 100644 --- a/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java +++ b/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java @@ -17,6 +17,7 @@ import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.apache.commons.cli.PosixParser; +import org.apache.commons.io.IOUtils; import org.apache.solr.common.cloud.OnReconnect; import org.apache.solr.common.cloud.SolrZkClient; import org.apache.solr.core.ConfigSolr; @@ -183,21 +184,24 @@ public class ZkCLI { } InputStream is = new FileInputStream(configFile); - //ConfigSolrXmlThunk cfg = new ConfigSolrXmlThunk(null, loader, is, false, true); - ConfigSolr cfg; + + try { if (isXml) { cfg = new ConfigSolrXmlBackCompat(loader, null, is, null, false); } else { cfg = new SolrProperties(null, is, null); } + } finally { + IOUtils.closeQuietly(is); + } - if(!ZkController.checkChrootPath(zkServerAddress, true)) { + if(!ZkController.checkChrootPath(zkServerAddress, true)) { System.out.println("A chroot was specified in zkHost but the znode doesn't exist. "); System.exit(1); } - + ZkController.bootstrapConf(zkClient, cfg, solrHome); } else if (line.getOptionValue(CMD).equals(UPCONFIG)) {