InputStream not closed in DefaultPropertiesProvider
psamsotha opened this issue · 1 comments
psamsotha commented
InputStream
is never closed in loadPropsFromPath
in the DefaultPropertiesProvider
private Properties loadPropsFromPath(String path) {
Properties properties = new Properties();
InputStream is = this.getClass().getResourceAsStream(path);
if (is == null) {
is = this.getClass().getClassLoader().getResourceAsStream(path);
}
if (is == null) {
LOGGER.log(Level.WARNING, "Error loading resource with path {0}. "
+ "Properties will not correctly set", new Object[]{path});
}
try {
properties.load(is);
} catch (IOException ex) {
LOGGER.log(Level.WARNING, "Error loading Properties.", ex);
// does not fail.
}
return properties;
}
psamsotha commented
This issue if fixed for next 0.1.1 release.
private Properties loadPropsFromPath(String path) {
Properties properties = new Properties();
InputStream is = this.getClass().getResourceAsStream(path);
if (is == null) {
is = this.getClass().getClassLoader().getResourceAsStream(path);
}
if (is == null) {
LOGGER.log(Level.WARNING, "Error loading resource with path {0}. "
+ "Properties will not correctly set", new Object[]{path});
}
try {
properties.load(is);
} catch (IOException ex) {
LOGGER.log(Level.WARNING, "Error loading Properties.", ex);
// does not fail.
} finally {
if (is != null) {
try {
is.close();
} catch (IOException ex) {
throw new RuntimeException("Error closing stream.", ex);
}
}
}
return properties;
}