X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2FPAPRestConfig.java;h=f34d4739f19ef384210f0d1308852e9253c8de71;hp=9ccccff05d1d0a57fa28ef4eaa0cd11f2b117706;hb=1e61676b77dd09659027b8984f050df7e8538526;hpb=f18fbfc026de9cf02126f57844c37abfee607394 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 9ccccff05..f34d4739f 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 @@ -24,8 +24,10 @@ package org.onap.policy.pap.xacml.rest; import java.io.FileInputStream; import java.io.InputStream; import java.util.Properties; + import javax.annotation.PostConstruct; import javax.sql.DataSource; + import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; import org.hibernate.SessionFactory; import org.onap.policy.common.logging.flexlogger.FlexLogger; @@ -45,9 +47,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc @EnableTransactionManagement -@ComponentScan(basePackages = { "org.onap.*", "com.*" }) +@ComponentScan(basePackages = {"org.onap.*", "com.*"}) public class PAPRestConfig extends WebMvcConfigurerAdapter { - private static final Logger LOGGER = FlexLogger.getLogger(PAPRestConfig.class); + private static final Logger LOGGER = FlexLogger.getLogger(PAPRestConfig.class); private static String dbDriver = null; private static String dbUrl = null; @@ -55,9 +57,9 @@ public class PAPRestConfig extends WebMvcConfigurerAdapter { private static String dbPassword = null; @PostConstruct - public void init(){ + public void init() { Properties prop = new Properties(); - try(InputStream 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")); @@ -65,8 +67,8 @@ public class PAPRestConfig extends WebMvcConfigurerAdapter { setDbUserName(prop.getProperty("javax.persistence.jdbc.user")); PeCryptoUtils.initAesKey(prop.getProperty(XACMLRestProperties.PROP_AES_KEY)); setDbPassword(PeCryptoUtils.decrypt(prop.getProperty("javax.persistence.jdbc.password"))); - }catch(Exception e){ - LOGGER.error("Exception Occured while loading properties file"+e); + } catch (Exception e) { + LOGGER.error("Exception Occured while loading properties file" + e); } }