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%2FPolicyDBDao.java;h=60b35fb09e07505ddd4d9c6de251aa4bc51b5d68;hb=a97e1eafd731937aab373213ab04c3296cc97595;hp=a8449e30716bfb8c9f0330ed8a6fb333b9af3450;hpb=3ffc70781b1ae0053da7b302e6c00739ba077ae8;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java index a8449e307..60b35fb09 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java @@ -1923,18 +1923,15 @@ public class PolicyDBDao { private String readConfigFile(String configPath){ String configDataString = null; - InputStream configContentStream = null; - try { - configContentStream = new FileInputStream(configPath); + + try(InputStream configContentStream = new FileInputStream(configPath)) { configDataString = IOUtils.toString(configContentStream); } catch (FileNotFoundException e) { logger.error("Caught FileNotFoundException on new FileInputStream("+configPath+")",e); throw new IllegalArgumentException("The config file path does not exist"); } catch(IOException e2){ - logger.error("Caught IOException on newIOUtils.toString("+configContentStream+")",e2); + logger.error("Caught IOException on newIOUtils.toString(configContentStream)",e2); throw new IllegalArgumentException("The config file path cannot be read"); - } finally { - IOUtils.closeQuietly(configContentStream); } if(configDataString == null){ throw new IllegalArgumentException("The config file path cannot be read");