From 24c6b1682bb59691f8d5e631b1074355b7d82a54 Mon Sep 17 00:00:00 2001 From: "Tej, Tarun" Date: Thu, 7 Sep 2017 19:21:28 -0400 Subject: Sonar Fixes Fixes to the sonar issues along with some cleanup code to remove warnings. Issue-Id: POLICY-113 Change-Id: I826562f7509c346210ac865cc6b31bce26bee2cf Signed-off-by: Tej, Tarun --- LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'LogParser') diff --git a/LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java b/LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java index 461220617..c3d631e1f 100644 --- a/LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java +++ b/LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java @@ -126,20 +126,13 @@ public class ParseLog { private static boolean processLine(Path debugfilePath, String dataFileName, int lastNmRead, LOGTYPE logType){ // log4jlogger must use .info - Stream lines = null; - try { - lines = Files.lines(debugfilePath, Charset.defaultCharset()).onClose(() -> log4jlogger.info(last+dataFileName+ lineRead + lastNmRead)).skip(lastNmRead); + try(Stream lines = Files.lines(debugfilePath, Charset.defaultCharset()).onClose(() -> log4jlogger.info(last+dataFileName+ lineRead + lastNmRead)).skip(lastNmRead)){ lines.forEachOrdered(line -> process(line, type, logType)); } catch (IOException e) { logger.error(loggingProcess + dataFileName, e); logger.error(breakLoop); return true; - }finally{ - if(lines != null){ - lines.close(); - } } - return false; } private static void processDebugLogParser(File debugfile, Path debugfilePath, String dataFileName){ -- cgit 1.2.3-korg