summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsurya-huawei <a.u.surya@huawei.com>2017-09-14 11:38:05 +0530
committerSURYA A U <a.u.surya@huawei.com>2017-09-14 06:14:59 +0000
commit8a2cc38d7e8a3c259d3872655732a15051022c4e (patch)
tree74da919cfcb1b4432d490478ef3b499576114b27
parent39975ca97ae77b06f0aab34396f7bceda7e6e8e3 (diff)
Fix critical issues
few critical/major issues in core/sli module Issue-Id: CCSDK-87 Change-Id: Ib7ef026ecb7fcf658ea8fc66ad5d9b739f02c55b Signed-off-by: surya-huawei <a.u.surya@huawei.com>
-rw-r--r--sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java22
1 files changed, 6 insertions, 16 deletions
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
index 8ab308eb..60dd6b46 100644
--- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
+++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
@@ -65,23 +65,13 @@ public class MdsalHelper {
public static void loadProperties(String propertiesFile) {
File file = new File(propertiesFile);
Properties properties = new Properties();
- InputStream input = null;
if (file.isFile() && file.canRead()) {
- try {
- input = new FileInputStream(file);
- properties.load(input);
- MdsalHelper.setYangMappingProperties(properties);
- LOG.info("Loaded properties from " + propertiesFile);
+ try (InputStream input = new FileInputStream(file)) {
+ properties.load(input);
+ MdsalHelper.setYangMappingProperties(properties);
+ LOG.info("Loaded properties from " + propertiesFile);
} catch (Exception e) {
- LOG.error("Failed to load properties " + propertiesFile + "\n", e);
- } finally {
- if (input != null) {
- try {
- input.close();
- } catch (IOException e) {
- LOG.error("Failed to close properties file " + propertiesFile + "\n", e);
- }
- }
+ LOG.error("Failed to load properties " + propertiesFile + "\n", e);
}
}else{
LOG.error("Failed to load the properties file " + propertiesFile + "\n");
@@ -127,7 +117,7 @@ public class MdsalHelper {
for (int i = 0; i < fromList.size(); i++) {
toProperties(props, pfx + "[" + i + "]", fromList.get(i), fromClass);
}
- props.setProperty(pfx + "_length", "" + fromList.size());
+ props.setProperty(pfx + "_length", Integer.toString(fromList.size()));
} else if (isYangGenerated(fromClass)) {
// Class is yang generated.