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%2FCreateBrmsRawPolicy.java;h=0bac0e06680868d7cca18784da9bd8ab1ba85976;hb=eef3c224cb6cad4b82a96938ade1e42ca881eea2;hp=a6240e0eef30eec921330d738235edfb2aa595be;hpb=44fd25bcbb86f8600ec88eeeac6bb8312672c470;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java index a6240e0ee..0bac0e066 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java @@ -72,15 +72,13 @@ public class CreateBrmsRawPolicy extends Policy { // Saving the Configurations file at server location for CreateBrmsRawPolicy policy. protected void saveConfigurations(String policyName, String jsonBody) { - try { - if (policyName.endsWith(".xml")) { - policyName = policyName.substring(0, - policyName.lastIndexOf(".xml")); - } - PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName + ".txt"); + + if (policyName.endsWith(".xml")) { + policyName = policyName.substring(0, + policyName.lastIndexOf(".xml")); + } + try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName + ".txt")){ out.println(jsonBody); - out.close(); - } catch (Exception e) { PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsRawPolicy", "Exception saving configurations file"); }