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/convert/ConvertNode.java | |
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/convert/ConvertNode.java')
-rw-r--r-- | appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/convert/ConvertNode.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/convert/ConvertNode.java b/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/convert/ConvertNode.java index d3ea34f9a..1f1ecf6bb 100644 --- a/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/convert/ConvertNode.java +++ b/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/convert/ConvertNode.java @@ -121,14 +121,7 @@ public class ConvertNode implements SvcLogicJavaPlugin { } private String tryFetchEscapedData(String unEscapeData, String dataType) throws InvalidParameterException { - if (StringUtils.isBlank(unEscapeData)) { - throw new InvalidParameterException("Unescape (" + ConfigGeneratorConstant.INPUT_PARAM_UNESCAPE_DATA - + ") param is missing for escapeData conversion." + unEscapeData); - } - if (StringUtils.isBlank(dataType)) { - throw new InvalidParameterException(DATA_TYPE_STR + ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE - + ")param is missing for escapeData conversion."); - } + validateInput(unEscapeData, dataType); if (ConfigGeneratorConstant.DATA_TYPE_JSON.equalsIgnoreCase(dataType)) { return StringEscapeUtils.escapeJavaScript(unEscapeData); } else if (ConfigGeneratorConstant.DATA_TYPE_XML.equalsIgnoreCase(dataType)) { @@ -142,6 +135,17 @@ public class ConvertNode implements SvcLogicJavaPlugin { } } + private void validateInput(String unEscapeData, String dataType) throws InvalidParameterException { + if (StringUtils.isBlank(unEscapeData)) { + throw new InvalidParameterException("Unescape (" + ConfigGeneratorConstant.INPUT_PARAM_UNESCAPE_DATA + + ") param is missing for escapeData conversion." + unEscapeData); + } + if (StringUtils.isBlank(dataType)) { + throw new InvalidParameterException(DATA_TYPE_STR + ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE + + ")param is missing for escapeData conversion."); + } + } + public void unEscapeData(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { log.trace("Received unEscapeData call with params : " + inParams); |