X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ECOMP-PDP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fpdp%2Frest%2Fapi%2Fservices%2FDeletePolicyService.java;h=3b1ea23fb8b1f497a5099dfb1b8672facc2d9569;hb=e92ff832cf993db876f22b2d27562fedf59f5043;hp=d0978fc5b70fa3406131835b097c962522c7e8d2;hpb=570290dc6ba8198e653022c2f6f8e5d01cfa8d1b;p=policy%2Fengine.git diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/DeletePolicyService.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/DeletePolicyService.java index d0978fc5b..3b1ea23fb 100644 --- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/DeletePolicyService.java +++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/DeletePolicyService.java @@ -31,7 +31,7 @@ import org.openecomp.policy.xacml.std.pap.StdPAPPolicy; import org.springframework.http.HttpStatus; public class DeletePolicyService { - private static Logger LOGGER = FlexLogger.getLogger(DeletePolicyService.class.getName()); + private static final Logger LOGGER = FlexLogger.getLogger(DeletePolicyService.class.getName()); private String deleteResult = null; private HttpStatus status = HttpStatus.BAD_REQUEST; @@ -53,7 +53,7 @@ public class DeletePolicyService { requestUUID = UUID.fromString(requestID); } catch (IllegalArgumentException e) { requestUUID = UUID.randomUUID(); - LOGGER.info("Generated Random UUID: " + requestUUID.toString()); + LOGGER.info("Generated Random UUID: " + requestUUID.toString(), e); } }else{ requestUUID = UUID.randomUUID(); @@ -74,7 +74,7 @@ public class DeletePolicyService { if(deleteResult==null){ return; } - if (deleteResult.contains("BAD REQUEST")||deleteResult.contains("PE300")||deleteResult.contains("not exist")||deleteResult.contains("Invalid policyName")) { + if (deleteResult.contains("BAD REQUEST")||deleteResult.contains("PE300")||deleteResult.contains("PE200")||deleteResult.contains("not exist")||deleteResult.contains("Invalid policyName")) { status = HttpStatus.BAD_REQUEST; } else if (deleteResult.contains("locked down")){ status = HttpStatus.ACCEPTED; @@ -174,6 +174,10 @@ public class DeletePolicyService { private boolean getValidation() { // While Validating, extract the required values. + if (deletePolicyParameters.getPolicyName()==null||deletePolicyParameters.getPolicyName().trim().isEmpty()){ + message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given."; + return false; + } if (!deletePolicyParameters.getPolicyName().contains("xml")) { if (deletePolicyParameters.getPolicyName() != null && deletePolicyParameters.getPolicyName().contains(".")) { @@ -188,10 +192,6 @@ public class DeletePolicyService { } else { policyName = deletePolicyParameters.getPolicyName(); } - if (deletePolicyParameters.getPolicyName()==null||deletePolicyParameters.getPolicyName().trim().isEmpty()){ - message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given."; - return false; - } policyType = deletePolicyParameters.getPolicyType(); if(policyType== null || policyType.trim().isEmpty()){ message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No PolicyType given.";