diff options
author | Santosh Yadav <santosh.k.yadav@ril.com> | 2018-02-08 16:54:32 +0530 |
---|---|---|
committer | Santosh Yadav <santosh.k.yadav@ril.com> | 2018-02-08 16:54:32 +0530 |
commit | 19b643d1d5a73ac551670dcd08026106043619cb (patch) | |
tree | 4170185cf6af2c16750d8b765e1e2ef708be3376 | |
parent | 1f2e5c89359ed7cd9e46325155dbd40c9115fcda (diff) |
close inputFileStream
used try catch resource
line no:367
Change-Id: I6c064ff34cba3a59a2924d25fa9ad58d97927a24
Issue-ID: VFC-698
Signed-off-by: Santosh Yadav <santosh.k.yadav@ril.com>
-rw-r--r-- | ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java index 1b97a6e..b15c83d 100644 --- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java +++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java @@ -339,17 +339,12 @@ public class TaskThread implements Runnable { public boolean processPMCsv(File tempfile) { - FileInputStream brs = null; - InputStreamReader isr = null; - BufferedReader br = null; - List<String> columnNames = new ArrayList<String>(); List<String> commonValues = new ArrayList<String>(); - try { + try (FileInputStream brs = new FileInputStream(tempfile); + InputStreamReader isr = new InputStreamReader(brs, Constant.ENCODING_UTF8); + BufferedReader br = new BufferedReader(isr)) { - brs = new FileInputStream(tempfile); - isr = new InputStreamReader(brs, Constant.ENCODING_UTF8); - br = new BufferedReader(isr); // common field String commonField = br.readLine(); String[] fields = commonField.split("\\|", -1); @@ -386,25 +381,12 @@ public class TaskThread implements Runnable { pmResultChannel.put(resultMap); } catch (InterruptedException e) { log.error("collectResultChannel.put(resultMap) error ", e); - throw new RuntimeException(e); } valuelist.clear(); } } catch (IOException e) { log.error("processPMCsv is fail ", e); return false; - } finally { - try { - if (br != null) - br.close(); - if (isr != null) - isr.close(); - if (brs != null) - brs.close(); - - } catch (Exception e) { - log.error(e); - } } return true; |