diff options
author | varun gudisena <vg411h@att.com> | 2017-09-22 23:58:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-22 23:58:06 +0000 |
commit | 648be3c324aa6d9c5b868106cffbf1c97c94c046 (patch) | |
tree | 606f888791182b20bf529d6baf6a64e42b24a8ab /src/main | |
parent | f5b284e5e0eacfec3312d3318ec769269e1ec2a5 (diff) | |
parent | 1a1d919bbba5346ab8a1e459595f5062fcb35fe9 (diff) |
Merge "Fix for Sonar Blocker issues"
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMap.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMap.java b/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMap.java index 731428d..0f7744c 100644 --- a/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMap.java +++ b/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMap.java @@ -52,12 +52,15 @@ public class ServicePropertiesMap */ public static void refresh(File file) throws Exception { + String filePath= null; try { logger.info("Loading properties - " + (file != null?file.getName():"")); //Store .json & .properties files into map of maps - String filePath = file.getPath(); + if (file != null) { + filePath = file.getPath(); + } if(filePath.lastIndexOf(".json")>0){ @@ -65,9 +68,10 @@ public class ServicePropertiesMap TypeReference<HashMap<String, String>> typeRef = new TypeReference<HashMap<String, String>>() {}; HashMap<String, String> propMap = om.readValue(file, typeRef); - HashMap<String, String> lcasePropMap = new HashMap<String, String>(); - for (String key : propMap.keySet() ) + HashMap<String, String> lcasePropMap = new HashMap<>(); + for (Map.Entry<String,String> entry : propMap.entrySet()) { + String key = entry.getKey(); String lcaseKey = ifNullThenEmpty(key); lcasePropMap.put(lcaseKey, propMap.get(key)); } @@ -81,7 +85,7 @@ public class ServicePropertiesMap prop.load(fis); @SuppressWarnings("unchecked") - HashMap<String, String> propMap = new HashMap<String, String>((Map)prop); + HashMap<String, String> propMap = new HashMap<>((Map)prop); mapOfMaps.put(file.getName(), propMap); } @@ -111,7 +115,7 @@ public class ServicePropertiesMap * @param fileName fileName * @return mapProp */ - public static HashMap<String, String> getProperties(String fileName){ + public static Map<String, String> getProperties(String fileName){ return mapOfMaps.get(fileName); } |