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%2FMicroServiceConfigPolicy.java;h=e0212112575118915fba26ab29dedd9d5c373b4b;hb=eef3c224cb6cad4b82a96938ade1e42ca881eea2;hp=b0e48a7f4c75693cf68a1abca63ebf1943e655f0;hpb=44fd25bcbb86f8600ec88eeeac6bb8312672c470;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java index b0e48a7f4..e02121125 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java @@ -88,13 +88,11 @@ public class MicroServiceConfigPolicy 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", ""); - } - PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName +".json"); + if(policyName.endsWith(".xml")){ + policyName = policyName.replace(".xml", ""); + } + try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName +".json")){ out.println(jsonBody); - out.close(); } catch (Exception e) { LOGGER.error("Exception Occured While writing Configuration data"+e); }