diff options
author | shashikanth <shashikanth.vh@huawei.com> | 2017-09-25 18:41:45 +0530 |
---|---|---|
committer | shashikanth <shashikanth.vh@huawei.com> | 2017-09-25 18:41:46 +0530 |
commit | b8248da19467df661180b0a66f2bdaae665c6bed (patch) | |
tree | 2b09a53efd36f3445a5fd6a5332bddced763ab97 /bpmn/MSOCoreBPMN/src/main/java | |
parent | cf8b91603edf8eaad3cb84c85a222c2e9793bf33 (diff) |
Changed try to try with resource
Change this condition so that it does not always evaluate to "false"
https://sonar.onap.org/component_issues?id=org.openecomp.so%3Aso#resolved=false|severities=BLOCKER
Issue-Id:SO-118
Change-Id: I0ebc001b3e7f6a13a2d309b69cc4133271a9e87e
Signed-off-by: shashikanth.vh <shashikanth.vh@huawei.com>
Diffstat (limited to 'bpmn/MSOCoreBPMN/src/main/java')
-rw-r--r-- | bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java | 23 |
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); } } } |