diff options
author | AvinashS <avinash.s@huawei.com> | 2017-09-20 18:18:48 +0530 |
---|---|---|
committer | AvinashS <avinash.s@huawei.com> | 2017-09-20 18:18:48 +0530 |
commit | ce2b1e181d2ef074d4f12eeec4342c4020273327 (patch) | |
tree | 850a1df52c9bbd8dd685062ae61db78f32621e6c /csarvalidation/src | |
parent | a04f31a2b6aa49cc0646a35bf6f7f7566bb1c331 (diff) |
File reader needs close
Potential file stream leak
Change-Id: Ib72a7f07bd687c1858b2e06d0d2dcea2271cc519
IssueId: VNFSDK-93
Signed-off-by: AvinashS <avinash.s@huawei.com>
Diffstat (limited to 'csarvalidation/src')
-rw-r--r-- | csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java b/csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java index 7d252e1..891f83e 100644 --- a/csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java +++ b/csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java @@ -100,10 +100,8 @@ public class CsarValidator { String cfile = csarFiles.get(CommonConstants.CSAR_META); if (!cfile.isEmpty()) { File file = new File(cfile); - BufferedReader reader = null; - try { - reader = new BufferedReader(new FileReader(file)); + try(BufferedReader reader = new BufferedReader(new FileReader(file))) { String tempString = null; while ((tempString = reader.readLine()) != null) { if (!tempString.equals("")) { @@ -133,17 +131,7 @@ public class CsarValidator { } } catch (IOException e2) { LOG.error("Exception caught while validateCsarMeta ! " + e2.getMessage()); - } finally { - if (reader != null) { - try { - reader.close(); - - } catch (IOException e1) { - LOG.error("close reader failed ! " + e1.getMessage()); - } - } - - } + } } return false; |