summaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java13
1 files changed, 11 insertions, 2 deletions
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);
+ }
+ }
}
}