diff options
Diffstat (limited to 'ONAP-PDP-REST')
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; |