diff options
author | Carsten Lund <lund@research.att.com> | 2017-06-09 16:28:10 +0000 |
---|---|---|
committer | Carsten Lund <lund@research.att.com> | 2017-06-09 16:28:10 +0000 |
commit | 56cb73914fd05db40417a6219b5968c8eea8a0b6 (patch) | |
tree | ce0e9cfac07b1d51a493e305ab54bdecf5c65c42 /ncomp-utils-java-extra | |
parent | 03f9567726dfa0c6af315d88c316be9cb380d8ae (diff) |
[DCAE-15] Final update for rebased code.
Change-Id: I51a54dfc3bf645684dd94e8eea9bc55313bea176
Signed-off-by: Carsten Lund <lund@research.att.com>
Diffstat (limited to 'ncomp-utils-java-extra')
-rw-r--r-- | ncomp-utils-java-extra/pom.xml | 5 | ||||
-rw-r--r-- | ncomp-utils-java-extra/src/main/java/org/openecomp/ncomp/utils/extra/FileTail.java | 32 |
2 files changed, 22 insertions, 15 deletions
diff --git a/ncomp-utils-java-extra/pom.xml b/ncomp-utils-java-extra/pom.xml index 7740f13..99b2e09 100644 --- a/ncomp-utils-java-extra/pom.xml +++ b/ncomp-utils-java-extra/pom.xml @@ -10,6 +10,10 @@ + + + + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.target>1.7</maven.compiler.target> @@ -29,7 +33,6 @@ - <build> <plugins> diff --git a/ncomp-utils-java-extra/src/main/java/org/openecomp/ncomp/utils/extra/FileTail.java b/ncomp-utils-java-extra/src/main/java/org/openecomp/ncomp/utils/extra/FileTail.java index 623733d..c0c2e33 100644 --- a/ncomp-utils-java-extra/src/main/java/org/openecomp/ncomp/utils/extra/FileTail.java +++ b/ncomp-utils-java-extra/src/main/java/org/openecomp/ncomp/utils/extra/FileTail.java @@ -173,22 +173,26 @@ public class FileTail { continue; } RandomAccessFile rf = new RandomAccessFile(file, "r"); - rf.seek(p); - String line = null; - while ((line = rf.readLine()) != null) { - if (line.length() == 0) - continue; - if (logger.isDebugEnabled()) - logger.debug("New line from file: " + f + " " + line); - p = rf.getFilePointer(); - try { - handler.newLine(file.getAbsolutePath(),line,context); - } catch (Exception e) { - logger.warn("Handler error: " + f + " " + e + " line=" + line); - e.printStackTrace(); + try { + rf.seek(p); + String line = null; + while ((line = rf.readLine()) != null) { + if (line.length() == 0) + continue; + if (logger.isDebugEnabled()) + logger.debug("New line from file: " + f + " " + line); + p = rf.getFilePointer(); + try { + handler.newLine(file.getAbsolutePath(),line,context); + } catch (Exception e) { + logger.warn("Handler error: " + f + " " + e + " line=" + line); + e.printStackTrace(); + } } } - rf.close(); + finally { + rf.close(); + } } synchronized (this) { filePointerMap.put(f, p); |