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:
Alan Woodward 2013-07-12 10:50:31 +00:00
parent fbee7ef942
commit bc645837a2
1 changed files with 9 additions and 4 deletions

View File

@ -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) {