X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fpolicycontroller%2FPolicyCreation.java;h=2af8a6ee1ae64530447ab615e78a0e7bc6f7c583;hp=64324d4320a082deb23bb9d9dad7623a76699de0;hb=b6bae924c4a794cd772ac1524089fc8739e310b1;hpb=0eb828b9e122865eb6e9649f766d2caf25eba771 diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java index 64324d432..2af8a6ee1 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java @@ -193,6 +193,15 @@ public class PolicyCreation extends AbstractPolicyCreation{ return new ResponseEntity(body, status); } }else{ + // if policy does not exist and the request is updatePolicy return error + if(policyData.isEditPolicy()){ + body = "policyNotAvailableForEdit"; + status = HttpStatus.NOT_FOUND; + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + response.addHeader("error", body); + response.addHeader("message", policyData.getPolicyName() + " does not exist on the PAP and cannot be updated."); + return new ResponseEntity(body, status); + } version = 1; if(userId == null){ createdBy = "API";