X-Git-Url: https://gerrit.onap.org/r/gitweb?p=dmaap%2Fmessagerouter%2Fmirroragent.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Fatt%2Fnsa%2FdmaapMMAgent%2FMirrorMakerAgent.java;h=8f189b3b16278d926c73f0ed4ccc327ec1a2082c;hp=3efbf4f533a35f2b0ab13cd1f3e5fc8c90a0f1dd;hb=eb61336d63865ab0e8319571660b81f7a76fec55;hpb=c4999261363c42758b50b31d33f910c5344fb339 diff --git a/src/main/java/com/att/nsa/dmaapMMAgent/MirrorMakerAgent.java b/src/main/java/com/att/nsa/dmaapMMAgent/MirrorMakerAgent.java index 3efbf4f..8f189b3 100644 --- a/src/main/java/com/att/nsa/dmaapMMAgent/MirrorMakerAgent.java +++ b/src/main/java/com/att/nsa/dmaapMMAgent/MirrorMakerAgent.java @@ -36,6 +36,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Properties; +import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.jasypt.util.text.BasicTextEncryptor; @@ -102,7 +103,7 @@ public class MirrorMakerAgent { try { input.close(); } catch (IOException e) { - logger.error("IOException" + e); + logger.error(" IOException occers " + e); } } } @@ -152,6 +153,7 @@ public class MirrorMakerAgent { } input = new FileInputStream(mmagenthome + "/etc/" + agentName + propName + ".properties"); } catch (IOException ex) { + logger.error(" IOException will be handled " + ex); try { input = new FileInputStream(mmagenthome + "/etc/" + propName + ".properties"); Properties prop = new Properties(); @@ -166,7 +168,7 @@ public class MirrorMakerAgent { prop.store(out, ""); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception at checkPropertiesFile " +e); } } finally { if (input != null) { @@ -380,7 +382,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(); @@ -440,6 +442,8 @@ public class MirrorMakerAgent { try { Thread.sleep(1000); } catch (InterruptedException e) { + logger.log(Level.WARN, "Interrupted!", e); + Thread.currentThread().interrupt(); } } catch (IOException ex) { ex.printStackTrace(); @@ -492,6 +496,7 @@ public class MirrorMakerAgent { out.close(); } catch (IOException e) { e.printStackTrace(); + logger.error("IOException occered " + e); } } }