aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
authorAbhai Singh <Abhai.Singh@amdocs.com>2017-12-28 19:26:59 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-31 10:20:08 +0000
commit76d9fa786f28e4835c55895824028bc2bb757dfa (patch)
tree742a955e738ac0580528edc8bd334edcc9cabeb6 /openecomp-be
parent923fdf3868103ec83577a35702d688fd38272f2a (diff)
Fix Sonar violations - ValidationUtil
Fixed few reported sonar issues. Fixed as per review comment Change-Id: Id3cbdcefe120eb9d807f7b66e1b0f329881ef658 Issue-ID: SDC-343 Signed-off-by: Abhai Singh <Abhai.Singh@amdocs.com>
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java
index 76b4aff1f5..925949bc69 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java
@@ -38,7 +38,9 @@ import static java.util.Objects.nonNull;
public class ValidationUtil {
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
- private final static Logger log = (Logger) LoggerFactory.getLogger(ValidationUtil.class.getName());
+ private static final Logger LOG = LoggerFactory.getLogger(ValidationUtil.class.getName());
+
+ private ValidationUtil(){}
public static void removeExposedResourcesCalledByGetResource(String fileName,
Set<String> actualExposedResources,
@@ -64,10 +66,8 @@ public class ValidationUtil {
Map<String, Resource> resourcesMap) {
for (String referencedResourceName : referencedResources) {
Resource currResource = resourcesMap.get(referencedResourceName);
- if (Objects.nonNull(currResource)) {
- if (isExpectedToBeExposed(currResource.getType())) {
+ if (Objects.nonNull(currResource) && isExpectedToBeExposed(currResource.getType())) {
actualExposedResources.add(referencedResourceName);
- }
}
}
}
@@ -89,7 +89,7 @@ public class ValidationUtil {
public static boolean evalPattern(Object paramVal, String[] regexList) {
String value = "";
if (paramVal instanceof String) {
- value = ((String) paramVal);
+ value = (String) paramVal;
}
if (paramVal instanceof Integer) {
value = paramVal.toString();
@@ -140,7 +140,7 @@ public class ValidationUtil {
throw new Exception("The file '" + envFileName + "' has no content");
}
} catch (Exception exception) {
- log.debug("",exception);
+ LOG.debug("",exception);
mdcDataDebugMessage.debugExitMessage("file", envFileName);
return null;
}
@@ -157,8 +157,7 @@ public class ValidationUtil {
mdcDataDebugMessage.debugEntryMessage("file", fileName);
String propertyValue = getWantedNameFromPropertyValueGetParam(nameValue);
- if (nonNull(propertyValue)) {
- if (!evalPattern(propertyValue, regexList)) {
+ if (nonNull(propertyValue) && !evalPattern(propertyValue, regexList)) {
globalContext.addMessage(
fileName,
ErrorLevel.WARNING,
@@ -171,7 +170,6 @@ public class ValidationUtil {
mdcDataDebugMessage.debugExitMessage("file", fileName);
return true;
}
- }
mdcDataDebugMessage.debugExitMessage("file", fileName);
return false;
@@ -189,7 +187,7 @@ public class ValidationUtil {
try {
manifestContent = JsonUtil.json2Object(manifest.get(), ManifestContent.class);
} catch (Exception exception) {
- log.debug("",exception);
+ LOG.debug("",exception);
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
LoggerTragetServiceName.VALIDATE_MANIFEST_CONTENT, ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_MANIFEST);