From 95cb0c224f6754cd6a045a451a41bd805dae08d3 Mon Sep 17 00:00:00 2001 From: hns Date: Tue, 17 Mar 2009 14:41:10 +0000 Subject: [PATCH] Close input streams after passing them to java.util.Properties.load(). --- src/helma/util/ResourceProperties.java | 9 +++++++-- src/helma/util/SystemProperties.java | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/helma/util/ResourceProperties.java b/src/helma/util/ResourceProperties.java index 58d6ed21..96f34bc1 100644 --- a/src/helma/util/ResourceProperties.java +++ b/src/helma/util/ResourceProperties.java @@ -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(); diff --git a/src/helma/util/SystemProperties.java b/src/helma/util/SystemProperties.java index f70ce60b..9014fb58 100644 --- a/src/helma/util/SystemProperties.java +++ b/src/helma/util/SystemProperties.java @@ -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();