Fix Either log or rethrow this exception issue
Fix Use a logger to log this exception issue
Issue-ID: DMAAP-894
Change-Id: I373a73b789d8b197e475e4fb6990c1b2af3870dc
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
try {
agent.checkAgentProcess();
} catch (Exception e) {
try {
agent.checkAgentProcess();
} catch (Exception e) {
+ logger.error("exception occured in checkAgentProcess ", e);
}
agent.readAgentTopic();
} else {
}
agent.readAgentTopic();
} else {
input = new FileInputStream(mmagenthome + "/etc/mmagent.config");
logger.info("mmagenthome is set :" + mmagenthome + " loading properties at /etc/mmagent.config");
} catch (IOException ex) {
input = new FileInputStream(mmagenthome + "/etc/mmagent.config");
logger.info("mmagenthome is set :" + mmagenthome + " loading properties at /etc/mmagent.config");
} catch (IOException ex) {
- logger.error(mmagenthome + "/etc/mmagent.config not found.");
+ logger.error(mmagenthome + "/etc/mmagent.config not found.", ex);
return false;
} finally {
if (input != null) {
return false;
} finally {
if (input != null) {
input = new FileInputStream(kafkahome + "/bin/kafka-run-class.sh");
logger.info("kafkahome is set :" + kafkahome);
} catch (IOException ex) {
input = new FileInputStream(kafkahome + "/bin/kafka-run-class.sh");
logger.info("kafkahome is set :" + kafkahome);
} catch (IOException ex) {
- logger.error(kafkahome + "/bin/kafka-run-class.sh not found. Make sure kafka home is set correctly");
+ logger.error(kafkahome + "/bin/kafka-run-class.sh not found. Make sure kafka home is set correctly", ex);
return false;
} finally {
if (input != null) {
return false;
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
try {
input.close();
} catch (IOException e) {
+ logger.error("exception occured in checkPropertiesFile ", e);
}
} catch (Exception e) {
}
} catch (Exception e) {
+ logger.error("exception occured in readAgentTopic ", e);
out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
mirrorMakerProperties.store(out, "");
} catch (IOException ex) {
out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
mirrorMakerProperties.store(out, "");
} catch (IOException ex) {
+ logger.error("exception occured in createMirrorMaker ", ex);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
+ logger.error("exception occured in createMirrorMaker ", e);
} catch (InterruptedException e) {
}
} catch (IOException ex) {
} catch (InterruptedException e) {
}
} catch (IOException ex) {
+ logger.error("exception occured in updateMirrorMaker ", ex);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
+ logger.error("exception occured in updateMirrorMaker ", e);
} catch (InterruptedException e) {
}
} catch (IOException ex) {
} catch (InterruptedException e) {
}
} catch (IOException ex) {
+ logger.error("exception occured in updateWhiteList ", ex);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
+ logger.error("exception occured in updateWhiteList ", e);
File file = new File(path);
file.delete();
} catch (Exception ex) {
File file = new File(path);
file.delete();
} catch (Exception ex) {
+ logger.error("exception occured in deleteMirrorMaker ", ex);
}
try {
String path = mmagenthome + "/etc/" + newMirrorMaker.name + "producer" + ".properties";
File file = new File(path);
file.delete();
} catch (Exception ex) {
}
try {
String path = mmagenthome + "/etc/" + newMirrorMaker.name + "producer" + ".properties";
File file = new File(path);
file.delete();
} catch (Exception ex) {
+ logger.error("exception occured in deleteMirrorMaker ", ex);
}
Gson g = new Gson();
mirrorMakerProperties.setProperty("mirrormakers", g.toJson(this.mirrorMakers));
}
Gson g = new Gson();
mirrorMakerProperties.setProperty("mirrormakers", g.toJson(this.mirrorMakers));
mirrorMakerProperties.store(out, "");
MirrorMakerProcessHandler.stopMirrorMaker(newMirrorMaker.name);
} catch (IOException ex) {
mirrorMakerProperties.store(out, "");
MirrorMakerProcessHandler.stopMirrorMaker(newMirrorMaker.name);
} catch (IOException ex) {
+ logger.error("exception occured in deleteMirrorMaker ", ex);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
+ logger.error("exception occured in deleteMirrorMaker ", e);
if (mirrorMakerProperties.getProperty("mirrormakers") == null) {
this.mirrorMakers = new ListMirrorMaker();
ArrayList<MirrorMaker> list = this.mirrorMakers.getListMirrorMaker();
if (mirrorMakerProperties.getProperty("mirrormakers") == null) {
this.mirrorMakers = new ListMirrorMaker();
ArrayList<MirrorMaker> list = this.mirrorMakers.getListMirrorMaker();
- list = new ArrayList<MirrorMaker>();
+ list = new ArrayList<>();
this.mirrorMakers.setListMirrorMaker(list);
} else {
this.mirrorMakers = g.fromJson(mirrorMakerProperties.getProperty("mirrormakers"),
this.mirrorMakers.setListMirrorMaker(list);
} else {
this.mirrorMakers = g.fromJson(mirrorMakerProperties.getProperty("mirrormakers"),
textEncryptor.setPassword(secret);
this.password = textEncryptor.decrypt(mirrorMakerProperties.getProperty("password"));
} catch (Exception ex) {
textEncryptor.setPassword(secret);
this.password = textEncryptor.decrypt(mirrorMakerProperties.getProperty("password"));
} catch (Exception ex) {
- // ex.printStackTrace();
+ logger.error("exception occured in loadProperties ", ex);
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
- // e.printStackTrace();
+ logger.error("exception occured in loadProperties ", e);
logger.info("Mirror Maker " + agentname + " Stopped");
} catch (Exception e) {
logger.info("Mirror Maker " + agentname + " Stopped");
} catch (Exception e) {
+ logger.error("exception occured in stopMirrorMaker ", e);
// System.out.println(line);
}
} catch (Exception anExc) {
// System.out.println(line);
}
} catch (Exception anExc) {
- anExc.printStackTrace();
+ logger.error("exception occured in startMirrorMaker ", anExc);
// System.out.println(line);
}
} catch (Exception anExc) {
// System.out.println(line);
}
} catch (Exception anExc) {
- anExc.printStackTrace();
+ logger.error("exception occured in startMirrorMaker ", anExc);
logger.info("Mirror Maker " + agentName + " Started" + " WhiteListing:" + whitelist);
} catch (Exception e) {
logger.info("Mirror Maker " + agentName + " Started" + " WhiteListing:" + whitelist);
} catch (Exception e) {
+ logger.error("exception occured in startMirrorMaker ", e);