summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2018-11-19 22:44:45 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-19 22:44:45 +0000
commitc8138ebd7ccd1a8a225b31e5e63dabc010a3faab (patch)
treee69048376aa2be352390804b53162004b65df89a
parent1411eede8a4511e12b9b4fd4c10b40858ae3c84b (diff)
parent3e64dafb04f0f7d40613bcc67efbe999ed132b47 (diff)
Merge "Fix blocker sonar issue in sli/core"
-rw-r--r--sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/FileRecorder.java18
1 files changed, 2 insertions, 16 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 772906e59..ac3dbd2a9 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);
- FileWriter fileWriter = null;
Date now = new Date();
TimeZone tz = TimeZone.getTimeZone("UTC");
@@ -93,8 +92,8 @@ public class FileRecorder implements SvcLogicRecorder {
record = record.replaceFirst("__TIMESTAMP__", dateFmt.format(now));
}
- try ( PrintWriter recPrinter = new PrintWriter(fileWriter = new
- FileWriter(recordFile, true)))
+ try ( FileWriter fileWriter = new FileWriter(recordFile, true);
+ PrintWriter recPrinter = new PrintWriter(fileWriter))
{
recPrinter.println(record);
}
@@ -102,19 +101,6 @@ public class FileRecorder implements SvcLogicRecorder {
{
throw new SvcLogicException("Cannot write record to file", e);
}
- finally
- {
- if (fileWriter != null)
- {
- try {
- fileWriter.close();
- } catch (IOException e) {
-
- }
- }
- }
-
-
}
}