r9542 - helma/helma/trunk/src/helma/util

[email protected]
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090317144110.BF4A83D0D6@mia>
Author: hannes
Date: 2009-03-17 15:41:10 +0100 (Tue, 17 Mar 2009)
New Revision: 9542

Modified:
   helma/helma/trunk/src/helma/util/ResourceProperties.java
   helma/helma/trunk/src/helma/util/SystemProperties.java
Log:
Close input streams after passing them to java.util.Properties.load().

Details at http://dev.helma.org/trac/helma/changeset/9542

Modified: helma/helma/trunk/src/helma/util/ResourceProperties.java
===================================================================
--- helma/helma/trunk/src/helma/util/ResourceProperties.java	2009-03-17 14:26:11 UTC (rev 9541)
+++ helma/helma/trunk/src/helma/util/ResourceProperties.java	2009-03-17 14:41:10 UTC (rev 9542)
@@ -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 @@
                         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 @@
                     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();

Modified: helma/helma/trunk/src/helma/util/SystemProperties.java
===================================================================
--- helma/helma/trunk/src/helma/util/SystemProperties.java	2009-03-17 14:26:11 UTC (rev 9541)
+++ helma/helma/trunk/src/helma/util/SystemProperties.java	2009-03-17 14:41:10 UTC (rev 9542)
@@ -164,6 +164,7 @@
                                throws IOException {
         Properties newProps = new SystemProperties();
         newProps.load(in);
+        in.close();
 
         if (additionalProps == null) {
             additionalProps = new HashMap();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.