From f7712cc0bf6460250ff605aaa8c9936fb930eb1e Mon Sep 17 00:00:00 2001 From: gojomo Date: Fri, 29 Apr 2011 22:21:54 +0000 Subject: [PATCH] Clarification to help [HER-1885] source-report.txt empty * SourceTagsReport informative note if there's none of the info needed for this report --- .../archive/crawler/reporting/SourceTagsReport.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/engine/src/main/java/org/archive/crawler/reporting/SourceTagsReport.java b/engine/src/main/java/org/archive/crawler/reporting/SourceTagsReport.java index 4678215e..840b2c6d 100644 --- a/engine/src/main/java/org/archive/crawler/reporting/SourceTagsReport.java +++ b/engine/src/main/java/org/archive/crawler/reporting/SourceTagsReport.java @@ -20,6 +20,7 @@ package org.archive.crawler.reporting; import java.io.PrintWriter; import java.util.Map; +import java.util.Set; import java.util.concurrent.atomic.AtomicLong; import org.archive.bdb.DisposableStoredSortedMap; @@ -34,9 +35,16 @@ public class SourceTagsReport extends Report { @Override public void write(PrintWriter writer) { + Set sourceTags = stats.sourceHostDistribution.keySet(); + + if(sourceTags.isEmpty()) { + writer.println("No source tag information. (Is 'sourceTagSeeds' enabled?)"); + return; + } + writer.print("[source] [host] [#urls]\n"); // for each source - for (String sourceKey : stats.sourceHostDistribution.keySet()) { + for (String sourceKey : sourceTags) { Map hostCounts = (Map)stats.sourceHostDistribution.get(sourceKey); // sort hosts by #urls