X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=LogParser%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fxacml%2Fparser%2FParseLog.java;fp=LogParser%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fxacml%2Fparser%2FParseLog.java;h=c3d631e1f5f08900f168e2acce69dc0e04e670da;hb=24c6b1682bb59691f8d5e631b1074355b7d82a54;hp=461220617247e69ebfcf3f803b84ced7fbdc9f4e;hpb=461b2b7eeca1586423349bc0c4c65f80f027292d;p=policy%2Fengine.git 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){