Close input streams after passing them to java.util.Properties.load().

This commit is contained in:
hns 2009-03-17 14:41:10 +00:00
parent 6d6f9ff341
commit 95cb0c224f
2 changed files with 8 additions and 2 deletions

View file

@ -17,6 +17,7 @@
package helma.util;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import helma.framework.core.*;
import helma.framework.repository.Resource;
@ -222,7 +223,9 @@ public class ResourceProperties extends Properties {
Repository repository = (Repository) iterator.next();
Resource res = repository.getResource(resourceName);
if (res != null && res.exists()) {
temp.load(res.getInputStream());
InputStream in = res.getInputStream();
temp.load(in);
in.close();
}
} catch (IOException iox) {
iox.printStackTrace();
@ -252,7 +255,9 @@ public class ResourceProperties extends Properties {
try {
Resource res = (Resource) iterator.next();
if (res.exists()) {
temp.load(res.getInputStream());
InputStream in = res.getInputStream();
temp.load(in);
in.close();
}
} catch (IOException iox) {
iox.printStackTrace();

View file

@ -164,6 +164,7 @@ public final class SystemProperties extends Properties {
throws IOException {
Properties newProps = new SystemProperties();
newProps.load(in);
in.close();
if (additionalProps == null) {
additionalProps = new HashMap();