throw new JSCommandErrorException(objError.getText());
}
List<HistoryEntry> objHistoryEntries = objAnswer.getHistory().getHistoryEntry();
if(objHistoryEntries.size() == 0) {
logger.error(String.format("no history entry found for %1$s", strJobName));
throw new JobSchedulerException(String.format("no history entry found for %1$s", strJobName));
}
else {
HistoryEntry objHistoryEntry = objHistoryEntries.get(0);
String strErrorText = objHistoryEntry.getErrorText();
String strEndTime = objHistoryEntry.getEndTime();
Date objDateEndTime = SOSDate.getDate(strEndTime, SOSDate.dateTimeFormat);
boolean flgRunSuccessful = isEmpty(strErrorText);
boolean flgRunTooLate = objDateEndTime.before(objDateStartTime);
if(flgRunTooLate || !flgRunSuccessful ) {
logger.info(String.format("last run of %1$s on %2$s", strJobName, strEndTime));
if(!flgRunSuccessful) {
logger.info(String.format("with error: %1$s", strErrorText));
logger.error(String.format("%1$s %n%2$s", strMessage, strErrorText));
throw new JobSchedulerException(String.format("%1$s %n%2$s", strMessage, strErrorText));
}
else {
logger.error(String.format("%1$s", strMessage));
throw new JobSchedulerException(String.format("%1$s", strMessage));
}
}
else {
logger.info(String.format("last successfully run of %1$s on %2$s", strJobName, strEndTime));
}
}
}
else {
throw new JobSchedulerException("Job Scheduler isn't responding");
}
}
catch (Exception e) {
// e.printStackTrace(System.err);
logger.error(String.format(Messages.getMsg("JSJ-I-107"), conMethodName), e);