Close input streams after passing them to java.util.Properties.load().
This commit is contained in:
parent
6d6f9ff341
commit
95cb0c224f
2 changed files with 8 additions and 2 deletions
|
@ -17,6 +17,7 @@
|
||||||
package helma.util;
|
package helma.util;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import helma.framework.core.*;
|
import helma.framework.core.*;
|
||||||
import helma.framework.repository.Resource;
|
import helma.framework.repository.Resource;
|
||||||
|
@ -222,7 +223,9 @@ public class ResourceProperties extends Properties {
|
||||||
Repository repository = (Repository) iterator.next();
|
Repository repository = (Repository) iterator.next();
|
||||||
Resource res = repository.getResource(resourceName);
|
Resource res = repository.getResource(resourceName);
|
||||||
if (res != null && res.exists()) {
|
if (res != null && res.exists()) {
|
||||||
temp.load(res.getInputStream());
|
InputStream in = res.getInputStream();
|
||||||
|
temp.load(in);
|
||||||
|
in.close();
|
||||||
}
|
}
|
||||||
} catch (IOException iox) {
|
} catch (IOException iox) {
|
||||||
iox.printStackTrace();
|
iox.printStackTrace();
|
||||||
|
@ -252,7 +255,9 @@ public class ResourceProperties extends Properties {
|
||||||
try {
|
try {
|
||||||
Resource res = (Resource) iterator.next();
|
Resource res = (Resource) iterator.next();
|
||||||
if (res.exists()) {
|
if (res.exists()) {
|
||||||
temp.load(res.getInputStream());
|
InputStream in = res.getInputStream();
|
||||||
|
temp.load(in);
|
||||||
|
in.close();
|
||||||
}
|
}
|
||||||
} catch (IOException iox) {
|
} catch (IOException iox) {
|
||||||
iox.printStackTrace();
|
iox.printStackTrace();
|
||||||
|
|
|
@ -164,6 +164,7 @@ public final class SystemProperties extends Properties {
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Properties newProps = new SystemProperties();
|
Properties newProps = new SystemProperties();
|
||||||
newProps.load(in);
|
newProps.load(in);
|
||||||
|
in.close();
|
||||||
|
|
||||||
if (additionalProps == null) {
|
if (additionalProps == null) {
|
||||||
additionalProps = new HashMap();
|
additionalProps = new HashMap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue