From 88d98921926c194899a393aa08f4793afc026b8c Mon Sep 17 00:00:00 2001 From: liboNet Date: Wed, 17 Apr 2019 05:25:58 +0800 Subject: Fix the sonar issue and clm issue . Fix the bugs by using try-with-resources method . Add unit test for GsonUtil . Fix the org.springframework : spring-web issue by removing the dependency in forwarding plugin Change-Id: I01f6461ea2a0f0363247dd3571dd56dcf68a7f90 Issue-ID: MULTICLOUD-569 Signed-off-by: liboNet --- .../distribution/reception/handling/sdc/SdcReceptionHandler.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'artifactbroker/plugins/reception-plugins/src/main') diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java index 37fb314..8bf69da 100644 --- a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java +++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java @@ -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); } -- cgit 1.2.3-korg