Make sure InputStream is closed.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1649701 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian Crum
2015-01-06 01:05:29 +00:00
parent a02828a34e
commit b20c4adfbc
@@ -1093,18 +1093,27 @@ public class UtilProperties implements Serializable {
super(defaults);
}
public ExtendedProperties(URL url, Locale locale) throws IOException, InvalidPropertiesFormatException {
InputStream in = new BufferedInputStream(url.openStream());
if (url.getFile().endsWith(".xml")) {
xmlToProperties(in, locale, this);
} else {
load(in);
InputStream in = null;
try {
in = new BufferedInputStream(url.openStream());
if (url.getFile().endsWith(".xml")) {
xmlToProperties(in, locale, this);
} else {
load(in);
}
} finally {
if (in != null) {
in.close();
}
}
in.close();
}
@Override
public void loadFromXML(InputStream in) throws IOException, InvalidPropertiesFormatException {
xmlToProperties(in, null, this);
in.close();
try {
xmlToProperties(in, null, this);
} finally {
in.close();
}
}
}
}