diff options
author | 2018-02-26 12:38:53 +0100 | |
---|---|---|
committer | 2018-02-26 19:11:11 +0000 | |
commit | 312e9f071ef0a8b3482278e8909f66f4c986ba89 (patch) | |
tree | 8aecf342768b9d86fb1f68bf107ef5c313b2c7f8 /appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/writer | |
parent | 534f94b92547efab097040209e61fa06e07f6e43 (diff) |
appc-config-generator-provider sonar fixes part 2
Sonar fixes in whole module
Change-Id: I55856a6ce73a73098dadb2c5b9428437349ed8a8
Issue-ID: APPC-671
Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Diffstat (limited to 'appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/writer')
-rw-r--r-- | appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/writer/FileWriterNode.java | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/writer/FileWriterNode.java b/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/writer/FileWriterNode.java index f7900b70a..a9047da5e 100644 --- a/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/writer/FileWriterNode.java +++ b/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/writer/FileWriterNode.java @@ -24,6 +24,8 @@ package org.onap.sdnc.config.generator.writer; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import java.io.File; import java.util.Map; import org.apache.commons.io.FileUtils; @@ -32,17 +34,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; import org.onap.sdnc.config.generator.ConfigGeneratorConstant; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; public class FileWriterNode implements SvcLogicJavaPlugin { private static final EELFLogger log = EELFManager.getInstance().getLogger(FileWriterNode.class); - - public void writeFile(Map<String, String> inParams, SvcLogicContext ctx) - throws SvcLogicException { + throws SvcLogicException { log.info("Received writeFile call with params : " + inParams); String responsePrefix = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX); try { @@ -50,27 +48,22 @@ public class FileWriterNode implements SvcLogicJavaPlugin { String fileName = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_FILE_NAME); String fileContents = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_REQUEST_DATA); - File file = new File(fileName); File filePath = file.getParentFile(); FileUtils.forceMkdir(filePath); FileUtils.writeStringToFile(file, fileContents, - ConfigGeneratorConstant.STRING_ENCODING); - + ConfigGeneratorConstant.STRING_ENCODING); ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, - ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS); + ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS); } catch (Exception e) { ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, - ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE); + ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE); ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE, - e.getMessage()); - log.error("Failed in writeFile " + e.getMessage()); + e.getMessage()); + log.error("Failed in writeFile", e); throw new SvcLogicException(e.getMessage()); } } - - - } |