Fix the sonar issue and clm issue
[multicloud/framework.git] / artifactbroker / plugins / reception-plugins / src / main / java / org / onap / policy / distribution / reception / handling / sdc / SdcReceptionHandler.java
index 37fb314..8bf69da 100644 (file)
@@ -338,10 +338,8 @@ public class SdcReceptionHandler extends AbstractReceptionHandler implements INo
     private static void writeFileByFileWriter(String filePath, String content) throws IOException {
         File file = new File(filePath);
         synchronized (file) {
-            try {
-                FileWriter fw = new FileWriter(filePath);
+            try (FileWriter fw = new FileWriter(filePath)) {
                 fw.write(content);
-                fw.close();
             } catch (final IOException exp) {
                 LOGGER.error("Failed to write File by File Writer ", exp);
             }