aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PDP-REST
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-01-03 16:35:39 +0000
committerGerrit Code Review <gerrit@onap.org>2018-01-03 16:35:39 +0000
commit84dfe2ecbdb18041ddfc49ac0beeb650238ff37c (patch)
tree233e2676cb42534976fe7eefda8ced6aeb563cad /ONAP-PDP-REST
parent85e767c65b23a1fef35e5a0199a57bf755070815 (diff)
parent82e81ac60d97b93847a26accc071e7043d831ab0 (diff)
Merge "Adding SONAR fixes for"
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;