X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcomponents%2FClosedLoopPolicy.java;h=7c05a31c608572795e3d505c9320bfda71864787;hb=eef3c224cb6cad4b82a96938ade1e42ca881eea2;hp=8e9c4b65976e5140ff4fa6d8ad1b932883aaaa48;hpb=44fd25bcbb86f8600ec88eeeac6bb8312672c470;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicy.java index 8e9c4b659..7c05a31c6 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicy.java @@ -70,27 +70,16 @@ public class ClosedLoopPolicy extends Policy { //save configuration of the policy based on the policyname private void saveConfigurations(String policyName, String jsonBody) { - try { + + if(policyName.endsWith(".xml")){ + policyName = policyName.replace(".xml", ""); + } + try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator+ policyName +".json")){ String body = jsonBody; - try { - try{ - //Remove the trapMaxAge in Verification Signature - body = body.replace(",\"trapMaxAge\":null", ""); - }catch(Exception e){ - LOGGER.debug("No Trap Max Age in JSON body", e); - } - this.policyAdapter.setJsonBody(body); - } catch (Exception e) { - LOGGER.error("Exception Occured"+e); - } - - if(policyName.endsWith(".xml")){ - policyName = policyName.replace(".xml", ""); - } - PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator+ policyName +".json"); + //Remove the trapMaxAge in Verification Signature + body = body.replace(",\"trapMaxAge\":null", ""); + this.policyAdapter.setJsonBody(body); out.println(body); - out.close(); - } catch (Exception e) { LOGGER.error("Exception Occured while writing Configuration Data"+e); }