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%2FActionPolicy.java;h=43eb4348ed29611ad50fc34ffdf974642ca869e2;hb=1cb0fbfc4993c1f47f31b061d70b64f53247df95;hp=91530c7af89a2ad72f0b9edc08b9dca212bf3018;hpb=881074dbf97b3a2d52d28fdd404e083b8e974d0d;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ActionPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ActionPolicy.java index 91530c7af..43eb4348e 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ActionPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ActionPolicy.java @@ -256,15 +256,12 @@ public class ActionPolicy extends Policy { // Saving the json Configurations file if exists at server location for action policy. private void saveActionBody(String policyName, String actionBodyData) { - try { if(policyName.endsWith(".xml")){ policyName = policyName.replace(".xml", ""); } File file = new File(ACTION_HOME+ File.separator + policyName + ".json"); - FileWriter fw = new FileWriter(file.getAbsoluteFile()); - BufferedWriter bw = new BufferedWriter(fw); + try(BufferedWriter bw = new BufferedWriter(new FileWriter(file.getAbsoluteFile()))) { bw.write(actionBodyData); - bw.close(); if (LOGGER.isInfoEnabled()) { LOGGER.info("Action Body is succesfully saved at " + file.getAbsolutePath()); }