diff --git a/framework/base/src/org/ofbiz/base/util/UtilProperties.java b/framework/base/src/org/ofbiz/base/util/UtilProperties.java index 870c62a0f5..3bd7b44ef4 100644 --- a/framework/base/src/org/ofbiz/base/util/UtilProperties.java +++ b/framework/base/src/org/ofbiz/base/util/UtilProperties.java @@ -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(); + } } } }