Fix sonar issue in sdc/dcae-d/ci
Fix use try-with-resources issue in ExtentManager.java
Issue-ID: SDC-1895
Change-Id: I838dbf8cfa64bb49ddeb0481be39da8b6847cd81
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
diff --git a/src/main/java/org/onap/dcae/ci/report/ExtentManager.java b/src/main/java/org/onap/dcae/ci/report/ExtentManager.java
index ae6e52d..e5cd442 100644
--- a/src/main/java/org/onap/dcae/ci/report/ExtentManager.java
+++ b/src/main/java/org/onap/dcae/ci/report/ExtentManager.java
@@ -85,13 +85,10 @@
private static void createVersionsInfoFile(String path, String file, String envData, String suiteName) {
File myFoo = new File(path + file);
- FileOutputStream fooStream;
- try {
- fooStream = new FileOutputStream(myFoo, false);
+ try(FileOutputStream fooStream = new FileOutputStream(myFoo, false)) {
String versions = ("env=\"" + envData + "\"\n" + "suiteName=\"" + suiteName + "\"\n");
byte[] myBytes = versions.getBytes();
fooStream.write(myBytes);
- fooStream.close();
} catch (IOException e) {
e.printStackTrace();
}