sonar blocker for NullPointerException 11/26011/1
authorSoumendu Sekhar Acharya <sa00498080@techmahindra.com>
Mon, 11 Dec 2017 09:56:33 +0000 (15:26 +0530)
committerSoumendu Sekhar Acharya <sa00498080@techmahindra.com>
Mon, 11 Dec 2017 09:57:08 +0000 (15:27 +0530)
NullPointerException might be thrown as 'filePath' is nullable
Sonar Link:
https://sonar.onap.org/component_issues/index?id=org.onap.dmaap.messagerouter.messageservice%3AdmaapMR1#resolved=false|severities=BLOCKER|assignees=soumendu
Location:
src/main/java/com/att/nsa/dmaap/service/MMRestService.java
Line No-65

Change-Id: I042592bee40553f262baf5861ef61e8404f45a80
Issue-ID: DMAAP-184
Signed-off-by: Soumendu Sekhar Acharya <sa00498080@techmahindra.com>
src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMap.java

index 0f7744c..7f12696 100644 (file)
@@ -62,6 +62,7 @@ public class ServicePropertiesMap
                                filePath = file.getPath();
                        }
                        
+                       if(filePath != null) {
                        if(filePath.lastIndexOf(".json")>0){
                                
                                ObjectMapper om = new ObjectMapper();
@@ -89,6 +90,7 @@ public class ServicePropertiesMap
                                
                                mapOfMaps.put(file.getName(), propMap);
                        }
+                       }
 
                        logger.info("File - " + file.getName() + " is loaded into the map and the "
                                        + "corresponding system properties have been refreshed");