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%2FConfigPolicy.java;fp=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcomponents%2FConfigPolicy.java;h=b808e5882910b0fe94e004b57cbd1a277ed98efb;hb=a97e1eafd731937aab373213ab04c3296cc97595;hp=48eb784a7c2219d48b07557122c10aac5a7ce0e9;hpb=54eaa820dd76f8da6076b6aad3d2c75c68236693;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java index 48eb784a7..b808e5882 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java @@ -80,24 +80,15 @@ public class ConfigPolicy extends Policy { // Saving the Configurations file at server location for config policy. protected void saveConfigurations(String policyName) { - BufferedWriter bw = null; - try { - String fileName = getConfigFile(policyName); - bw = new BufferedWriter(new FileWriter(CONFIG_HOME + File.separator + fileName)); + + String fileName = getConfigFile(policyName); + try(BufferedWriter bw = new BufferedWriter(new FileWriter(CONFIG_HOME + File.separator + fileName))) { bw.write(configBodyData); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Configuration is succesfully saved"); } } catch (IOException e) { LOGGER.error("Exception Occured while writing Configuration Data"+e); - } finally { - if(bw != null){ - try { - bw.close(); - } catch (Exception e) { - LOGGER.error("Exception Occured while closing the BufferedWriter"+e); - } - } } }