fix try block
[policy/engine.git] / ONAP-PAP-REST / src / main / java / org / onap / policy / pap / xacml / rest / PAPRestConfig.java
index 1b9afe5..7e514ef 100644 (file)
@@ -57,9 +57,8 @@ public class PAPRestConfig extends WebMvcConfigurerAdapter {
        @PostConstruct
        public void init(){
                Properties prop = new Properties();
-               InputStream input = null;
-               try {
-                       input = new FileInputStream("xacml.pap.properties");
+
+               try(InputStream input = new FileInputStream("xacml.pap.properties")) {
                        // load a properties file
                        prop.load(input);
                        setDbDriver(prop.getProperty("javax.persistence.jdbc.driver"));
@@ -68,14 +67,6 @@ 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);
-                               }
-                       }
                }
        }