sonar design for error-handling 69/30269/1
authorDushyant Singh Thakur <dt00503496@techmahindra.com>
Mon, 5 Feb 2018 13:13:29 +0000 (18:43 +0530)
committerDushyant Singh Thakur <dt00503496@techmahindra.com>
Mon, 5 Feb 2018 13:13:29 +0000 (18:43 +0530)
Used a logger to log the exception
Sonar Link:
https://sonar.onap.org/component_issues?id=org.onap.dmaap.messagerouter.mirroragent%3AdmaapMMAgent#assignees=dthakur
Location:
src/main/java/com/att/nsa/dmaapMMAgent/MirrorMakerAgent.java
Line No-169

Change-Id: I751b0052bffc4dcb641b62db4f4676a664185ce8
Issue-ID: DMAAP-225
Signed-off-by: Dushyant Singh Thakur <dt00503496@techmahindra.com>
src/main/java/com/att/nsa/dmaapMMAgent/MirrorMakerAgent.java

index 3efbf4f..bd2a2a5 100644 (file)
@@ -166,7 +166,7 @@ public class MirrorMakerAgent {
                                prop.store(out, "");
 
                        } catch (Exception e) {
-                               e.printStackTrace();
+                               logger.error("Exception at checkPropertiesFile " +e);
                        }
                } finally {
                        if (input != null) {
@@ -380,7 +380,7 @@ public class MirrorMakerAgent {
                        }
                }
                logger.info("Adding new MirrorMaker:" + newMirrorMaker.name);
-               if (!exists && mirrorMakers != null) {
+               if (exists == false && mirrorMakers != null) {
                        mirrorMakers.getListMirrorMaker().add(newMirrorMaker);
                } else if (exists == false && mirrorMakers == null) {
                        mirrorMakers = new ListMirrorMaker();