diff --git a/engine/src/main/java/org/archive/crawler/restlet/models/CrawlJobModel.java b/engine/src/main/java/org/archive/crawler/restlet/models/CrawlJobModel.java index 851b1f36..a91cb786 100644 --- a/engine/src/main/java/org/archive/crawler/restlet/models/CrawlJobModel.java +++ b/engine/src/main/java/org/archive/crawler/restlet/models/CrawlJobModel.java @@ -126,8 +126,10 @@ public class CrawlJobModel extends HashMap implements Serializab } } this.put("checkpointFiles",checkpointFiles); - this.put("alertLogFilePath",crawlJob.getCrawlController().getLoggerModule().getAlertsLogPath().getFile().getAbsolutePath()); - this.put("crawlLogFilePath",crawlJob.getCrawlController().getLoggerModule().getCrawlLogPath().getFile().getAbsolutePath()); + if (crawlJob.hasApplicationContext()) + this.put("alertLogFilePath",crawlJob.getCrawlController().getLoggerModule().getAlertsLogPath().getFile().getAbsolutePath()); + if(crawlJob.isRunning() || (crawlJob.hasApplicationContext() && !crawlJob.isLaunchable())) + this.put("crawlLogFilePath",crawlJob.getCrawlController().getLoggerModule().getCrawlLogPath().getFile().getAbsolutePath()); this.put("reports", generateReports()); } public String formatBytes(Long bytes){ @@ -178,13 +180,15 @@ public class CrawlJobModel extends HashMap implements Serializab } public List> generateReports(){ List> reports = new ArrayList>(); - for (Report report : crawlJob.getCrawlController().getStatisticsTracker().getReports()) { - if (report.getShouldReportDuringCrawl()) { - Map reportMap = new HashMap(); - String className = report.getClass().getSimpleName(); - reportMap.put("className", className); - reportMap.put("shortName",className.substring(0,className.length() - "Report".length())); - reports.add(reportMap); + if(crawlJob.hasApplicationContext()){ + for (Report report : crawlJob.getCrawlController().getStatisticsTracker().getReports()) { + if (report.getShouldReportDuringCrawl()) { + Map reportMap = new HashMap(); + String className = report.getClass().getSimpleName(); + reportMap.put("className", className); + reportMap.put("shortName",className.substring(0,className.length() - "Report".length())); + reports.add(reportMap); + } } } return reports;