summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2017-09-25 16:43:34 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-25 16:43:34 +0000
commit090640d3442ea55f6786a99c5d0c3c2b99672c78 (patch)
tree61b1d6381220739898814dd25ee97aa583fe3dfd
parentdf33c93a433d676c2141db69eb71c047fb5c5a09 (diff)
parentb8248da19467df661180b0a66f2bdaae665c6bed (diff)
Merge "Changed try to try with resource"
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java23
1 files changed, 3 insertions, 20 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java
index 6249040342..b27a2fa64e 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java
@@ -67,29 +67,12 @@ public class ReadConfigTask extends BaseTask {
synchronized (ReadConfigTask.class) {
if (properties == null) {
properties = new Properties();
-
- InputStream stream = null;
-
- try {
- stream = getClass().getResourceAsStream(thePropertiesFile);
-
- if (stream == null) {
- throw new IOException("Resource not found: " + thePropertiesFile);
- }
+ try (InputStream stream = getClass().getResourceAsStream(thePropertiesFile)) {
properties.load(stream);
- stream.close();
- stream = null;
-
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (Exception e) {
- msoLogger.debug("Exception:", e);
- }
- }
+ } catch (Exception e) {
+ msoLogger.debug("Exception at readResourceFile stream: " + e);
}
}
}