summaryrefslogtreecommitdiffstats
path: root/ONAP-PDP-REST
diff options
context:
space:
mode:
authorMichael Mokry <mm117s@att.com>2017-12-11 10:07:43 -0600
committerMichael Mokry <mm117s@att.com>2017-12-11 10:26:55 -0600
commit82e81ac60d97b93847a26accc071e7043d831ab0 (patch)
treed088b473cf9c83a3b1f798e5d5e5499082107c58 /ONAP-PDP-REST
parent428150834ee60899b9a8da019bae3c8bf009adf1 (diff)
Adding SONAR fixes for
- pushPolicy defect fixes for POLICY-486 - Common Policy Validation feature for POLIYC-449 Change-Id: I8d54aa5a9b819c6eb4427dfa47c4ce963a21c2e0 Issue-ID: POLICY-449,POLICY-486 Signed-off-by: Michael Mokry <mm117s@att.com>
Diffstat (limited to 'ONAP-PDP-REST')
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/CreateUpdatePolicyServiceImpl.java18
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/utils/PolicyApiUtils.java7
2 files changed, 10 insertions, 15 deletions
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/CreateUpdatePolicyServiceImpl.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/CreateUpdatePolicyServiceImpl.java
index 483e13c23..9939de966 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/CreateUpdatePolicyServiceImpl.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/CreateUpdatePolicyServiceImpl.java
@@ -244,17 +244,13 @@ public class CreateUpdatePolicyServiceImpl implements CreateUpdatePolicyService
return false;
}
- if(policyParameters.getPolicyClass() != null){
- if ("Config".equals(policyParameters.getPolicyClass().toString())){
- String policyConfigType = policyParameters.getPolicyConfigType().toString();
- if(!"BRMS_Param".equalsIgnoreCase(policyConfigType)){
- if(Strings.isNullOrEmpty(policyParameters.getConfigBody())){
- message = XACMLErrorConstants.ERROR_DATA_ISSUE + "ConfigBody: No Config Body given";
- LOGGER.error("Common validation did not return success: " + message);
- return false;
- }
- }
- }
+ if(policyParameters.getPolicyClass() != null && "Config".equals(policyParameters.getPolicyClass().toString())){
+ String policyConfigType = policyParameters.getPolicyConfigType().toString();
+ if(!"BRMS_Param".equalsIgnoreCase(policyConfigType) && Strings.isNullOrEmpty(policyParameters.getConfigBody())){
+ message = XACMLErrorConstants.ERROR_DATA_ISSUE + "ConfigBody: No Config Body given";
+ LOGGER.error("Common validation did not return success: " + message);
+ return false;
+ }
}
try {
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/utils/PolicyApiUtils.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/utils/PolicyApiUtils.java
index 472d3aa95..197db26c1 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/utils/PolicyApiUtils.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/utils/PolicyApiUtils.java
@@ -62,8 +62,7 @@ public class PolicyApiUtils {
public static String formatResponse(StringBuilder responseString){
LOGGER.info("Formatting response message from Policy Validator");
- String response = null;
- response = responseString.toString().replace("<br>", " | ");
+ String response = responseString.toString().replace("<br>", " | ");
response = response.replaceAll("(<b>|<\\/b>|<br>|<i>|<\\/i>|@#)", "");
return response;
@@ -126,8 +125,8 @@ public class PolicyApiUtils {
|| "PUT".equals(json.getString("method").trim())
|| "POST".equals(json.getString("method").trim())){
- message = SUCCESS;
-
+ //Successful Validation
+
}else{
message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Method value.";
return message;