mirror of https://github.com/apache/lucene.git
SOLR-4914: Close input streams as well
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1502507 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fbee7ef942
commit
bc645837a2
|
@ -82,8 +82,7 @@ public class CorePropertiesLocator implements CoresLocator {
|
|||
logger.error("Couldn't persist core properties to {}: {}", propfile.getAbsolutePath(), e);
|
||||
}
|
||||
finally {
|
||||
if (os != null)
|
||||
IOUtils.closeQuietly(os);
|
||||
IOUtils.closeQuietly(os);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,16 +129,22 @@ public class CorePropertiesLocator implements CoresLocator {
|
|||
}
|
||||
|
||||
protected CoreDescriptor buildCoreDescriptor(File propertiesFile, CoreContainer cc) {
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
File instanceDir = propertiesFile.getParentFile();
|
||||
Properties coreProperties = new Properties();
|
||||
coreProperties.load(new FileInputStream(propertiesFile));
|
||||
fis = new FileInputStream(propertiesFile);
|
||||
coreProperties.load(fis);
|
||||
String name = createName(coreProperties, instanceDir);
|
||||
return new CoreDescriptor(cc, name, instanceDir.getAbsolutePath(), coreProperties);
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
logger.error("Couldn't load core descriptor from {}:{}", propertiesFile.getAbsolutePath(), e.toString());
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
IOUtils.closeQuietly(fis);
|
||||
}
|
||||
}
|
||||
|
||||
protected static String createName(Properties p, File instanceDir) {
|
||||
|
|
Loading…
Reference in New Issue