summaryrefslogtreecommitdiff
path: root/qadevOOo
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-22 10:39:04 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-03-22 14:43:52 +0100
commitd9a9f7f35e663896995625a44dc80d6c6c37cf9a (patch)
tree3e5cf6b41429a049020d5f0701448a37e38d1822 /qadevOOo
parent3f837a85191a646e2fd14a8871c0f74b28d5714e (diff)
cid#1474333 Resource leak on an exceptional path
Change-Id: I84ae0f078fade95f6219b2e949e60fb1d6b60f75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112877 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'qadevOOo')
-rw-r--r--qadevOOo/runner/helper/CfgParser.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/qadevOOo/runner/helper/CfgParser.java b/qadevOOo/runner/helper/CfgParser.java
index b65697e9b6c8..a93e725fd99b 100644
--- a/qadevOOo/runner/helper/CfgParser.java
+++ b/qadevOOo/runner/helper/CfgParser.java
@@ -91,9 +91,12 @@ public class CfgParser
try
{
FileInputStream propFile = new FileInputStream(name);
- prop.load(propFile);
- System.out.println("Parsing properties from " + name);
- propFile.close();
+ try {
+ prop.load(propFile);
+ System.out.println("Parsing properties from " + name);
+ } finally {
+ propFile.close();
+ }
}
catch (Exception e)
{
@@ -105,7 +108,11 @@ public class CfgParser
System.out.println("Parsing properties from " + name);
java.net.URLConnection connection = url.openConnection();
java.io.InputStream in = connection.getInputStream();
- prop.load(in);
+ try {
+ prop.load(in);
+ } finally {
+ in.close();
+ }
}
}
catch (Exception ex)