summaryrefslogtreecommitdiffstats
path: root/LogParser/src
diff options
context:
space:
mode:
authorrb7147 <rb7147@att.com>2017-06-16 14:36:01 -0400
committerrb7147 <rb7147@att.com>2017-06-16 14:36:47 -0400
commit620d69f26cbbea1deb5000c7a341e8012a5ad080 (patch)
tree3f8e2881dfa495e150fdef62db1b85d2b4605718 /LogParser/src
parenta084c4de015521f842a3fef0d7f1f7c340237bc3 (diff)
[Policy-24] Updated the Database Configuration
Change-Id: Ie358df4bfef5fb9cfe136f52a9d35f119c55bc97 Signed-off-by: rb7147 <rb7147@att.com>
Diffstat (limited to 'LogParser/src')
-rw-r--r--LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java34
1 files changed, 23 insertions, 11 deletions
diff --git a/LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java b/LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java
index 5ddb623c0..73ecf797e 100644
--- a/LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java
+++ b/LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java
@@ -141,15 +141,19 @@ public class ParseLog {
if (debugfile.isFile()){
// log4jlogger must use .info
- try (Stream<String> lines = Files.lines(debugfilePath, Charset.defaultCharset()).onClose(() -> log4jlogger.info("Last-"+dataFileName+"-line-Read:" + debuglastNumberRead)).skip(debuglastNumberRead)) {
-
+ Stream<String> lines = null;
+ try {
+ lines = Files.lines(debugfilePath, Charset.defaultCharset()).onClose(() -> log4jlogger.info("Last-"+dataFileName+"-line-Read:" + debuglastNumberRead)).skip(debuglastNumberRead);
lines.forEachOrdered(line -> process(line, type, LOGTYPE.DEBUG));
- lines.close();
} catch (IOException e) {
logger.error("Error processing line in " + dataFileName + ":" + e);
logger.error("break the loop.");
isStop = true;
- }
+ }finally{
+ if(lines != null){
+ lines.close();
+ }
+ }
}
try {
Thread.sleep(sleepTimer);
@@ -207,15 +211,19 @@ public class ParseLog {
while (!isStop){
if (errorfile.isFile()){
// log4jlogger must use .info
- try (Stream<String> lines = Files.lines(errorfilePath, Charset.defaultCharset()).onClose(() -> log4jlogger.info("Last-"+dataFileName+"-line-Read:" + errorlastNumberRead)).skip(errorlastNumberRead)) {
-
+ Stream<String> lines = null;
+ try{
+ lines = Files.lines(errorfilePath, Charset.defaultCharset()).onClose(() -> log4jlogger.info("Last-"+dataFileName+"-line-Read:" + errorlastNumberRead)).skip(errorlastNumberRead);
lines.forEachOrdered(line -> process(line, type, LOGTYPE.ERROR));
- lines.close();
} catch (IOException e) {
logger.error("Error processing line in " + dataFileName + ":" + e);
logger.error("break the loop.");
isStop = true;
- }
+ }finally{
+ if(lines != null){
+ lines.close();
+ }
+ }
}
try {
Thread.sleep(sleepTimer);
@@ -271,14 +279,18 @@ public class ParseLog {
if (file.isFile()){
// log4jlogger must use .info
- try (Stream<String> lines = Files.lines(filePath, Charset.defaultCharset()).onClose(() -> log4jlogger.info("Last-"+dataFileName+"-line-Read:" + lastNumberRead)).skip(lastNumberRead)) {
-
+ Stream<String> lines = null;;
+ try {
+ lines = Files.lines(filePath, Charset.defaultCharset()).onClose(() -> log4jlogger.info("Last-"+dataFileName+"-line-Read:" + lastNumberRead)).skip(lastNumberRead);
lines.forEachOrdered(line -> process(line, type, LOGTYPE.INFO));
- lines.close();
} catch (IOException e) {
logger.error("Error processing line in " + dataFileName + ":" + e);
logger.error("break the loop.");
isStop = true;
+ }finally{
+ if(lines != null){
+ lines.close();
+ }
}
}
try {