summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/FileRecorder.java10
1 files changed, 2 insertions, 8 deletions
diff --git a/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/FileRecorder.java b/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/FileRecorder.java
index 4a60de95..772906e5 100644
--- a/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/FileRecorder.java
+++ b/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/FileRecorder.java
@@ -82,7 +82,6 @@ public class FileRecorder implements SvcLogicRecorder {
}
File recordFile = new File(fileName);
- PrintWriter recPrinter = null;
FileWriter fileWriter = null;
Date now = new Date();
@@ -94,10 +93,9 @@ public class FileRecorder implements SvcLogicRecorder {
record = record.replaceFirst("__TIMESTAMP__", dateFmt.format(now));
}
- try
+ try ( PrintWriter recPrinter = new PrintWriter(fileWriter = new
+ FileWriter(recordFile, true)))
{
-
- recPrinter = new PrintWriter(fileWriter = new FileWriter(recordFile, true));
recPrinter.println(record);
}
catch (Exception e)
@@ -106,10 +104,6 @@ public class FileRecorder implements SvcLogicRecorder {
}
finally
{
- if (recPrinter != null)
- {
- recPrinter.close();
- }
if (fileWriter != null)
{
try {