SOLR-4525: Fix remaining issues with windows and not-closed files. Test is now passing. The problem here: The old code that used XML files did not need to close the streams, because XML parsers generally do it (for no good reason)...

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1452146 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2013-03-03 22:28:25 +00:00
parent 6ba62cd0a2
commit 326531d820
1 changed files with 7 additions and 1 deletions

View File

@ -49,6 +49,7 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.solr.cloud.CloudDescriptor;
import org.apache.solr.cloud.CurrentCoreDescriptorProvider;
@ -339,7 +340,12 @@ public class CoreContainer
*/
public void load(String dir, File configFile) throws FileNotFoundException {
this.configFile = configFile;
this.load(dir, new FileInputStream(configFile), configFile.getName().endsWith(".xml"), configFile.getName());
InputStream in = new FileInputStream(configFile);
try {
this.load(dir, in, configFile.getName().endsWith(".xml"), configFile.getName());
} finally {
IOUtils.closeQuietly(in);
}
}
/**