summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2017-09-14 18:21:17 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-14 18:21:17 +0000
commit6362018fd97d0b45527196279c0899c69be28e85 (patch)
tree7d161672e26f40a31d43e05cddb97af207b1c297
parent9f0995e647ba28ae429a0d46fb2686dbf61bb9d4 (diff)
parent8a2cc38d7e8a3c259d3872655732a15051022c4e (diff)
Merge "Fix critical issues"
-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.