diff options
Diffstat (limited to 'ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java')
-rw-r--r-- | ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java | 9 |
1 files changed, 6 insertions, 3 deletions
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"); |