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%2FPAPRestConfig.java;fp=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2FPAPRestConfig.java;h=1b9afe5477ac5bba0e5c8210e1a241129438a69d;hb=2db31606da32d9f5d3a16854385de8e496cd28f6;hp=7e514ef245f1b9f052b4188ba1636f526cdd3d8b;hpb=240bbdbdc76e0e91af9f18164eadb2708d14c6fb;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java index 7e514ef24..1b9afe547 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java @@ -57,8 +57,9 @@ public class PAPRestConfig extends WebMvcConfigurerAdapter { @PostConstruct public void init(){ Properties prop = new Properties(); - - try(InputStream input = new FileInputStream("xacml.pap.properties")) { + InputStream input = null; + try { + input = new FileInputStream("xacml.pap.properties"); // load a properties file prop.load(input); setDbDriver(prop.getProperty("javax.persistence.jdbc.driver")); @@ -67,6 +68,14 @@ public class PAPRestConfig extends WebMvcConfigurerAdapter { setDbPassword( CryptoUtils.decryptTxtNoExStr(prop.getProperty("javax.persistence.jdbc.password", ""))); }catch(Exception e){ LOGGER.error("Exception Occured while loading properties file"+e); + }finally{ + if(input != null){ + try { + input.close(); + } catch (IOException e) { + LOGGER.error("Exception Occured while clsoing the stream"+e); + } + } } }