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%2Fcomponents%2FPolicyDBDao.java;h=a8449e30716bfb8c9f0330ed8a6fb333b9af3450;hp=60b35fb09e07505ddd4d9c6de251aa4bc51b5d68;hb=2db31606da32d9f5d3a16854385de8e496cd28f6;hpb=240bbdbdc76e0e91af9f18164eadb2708d14c6fb 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 60b35fb09..a8449e307 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,15 +1923,18 @@ public class PolicyDBDao { private String readConfigFile(String configPath){ String configDataString = null; - - try(InputStream configContentStream = new FileInputStream(configPath)) { + InputStream configContentStream = null; + try { + 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");