aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCoreBPMN/src
diff options
context:
space:
mode:
authorsurya-huawei <a.u.surya@huawei.com>2017-09-26 16:12:10 +0530
committersurya-huawei <a.u.surya@huawei.com>2017-09-26 16:17:39 +0530
commitb66f9aae658bdb099cef166ba97acd923b87648c (patch)
tree240fc2eaa3fa39a17710498f95534034e1d968f4 /bpmn/MSOCoreBPMN/src
parent00f6a9c613096e3d4623b8e8486992be727d92da (diff)
Use try-with-resources
*Replace try with try-with-resources This is done to close resources automatically and not worry about finally block *Replace explicit type info with diamond operator This is done to reduce verbosity of generics code Issue-Id: SO-118 Change-Id: I948ffd26bfe6022496ca4a272de2619aef0dbd88 Signed-off-by: surya-huawei <a.u.surya@huawei.com>
Diffstat (limited to 'bpmn/MSOCoreBPMN/src')
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java17
1 files changed, 5 insertions, 12 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java
index 4e67bd171d..6059a357b6 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java
@@ -248,19 +248,11 @@ public class PropertyConfiguration {
Map<String, String> properties = new HashMap<>();
Properties newProperties = new Properties();
- FileReader reader = null;
- try {
- reader = new FileReader(file);
+ try (FileReader reader = new FileReader(file)) {
newProperties.load(reader);
- } finally {
- if (reader != null) {
- try {
- reader.close();
- LOGGER.debug("Closed " + fileName);
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- }
- }
+ }
+ catch (Exception e) {
+ LOGGER.debug("Exception :",e);
}
for (Entry<Object, Object> entry : newProperties.entrySet()) {
@@ -291,6 +283,7 @@ public class PropertyConfiguration {
interrupt();
}
+ @Override
public void run() {
LOGGER.info(MessageEnum.BPMN_GENERAL_INFO, "BPMN",
"FileWatcherThread started");