Skip to content

Commit

Permalink
Don't fail on invalid seed URLs, just warn the error (closes #97)
Browse files Browse the repository at this point in the history
  • Loading branch information
aecio committed Jun 17, 2017
1 parent e4513a8 commit a526285
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,17 @@ public Frontier getFrontier() {
public void addSeeds(String[] seeds) {
if (seeds != null && seeds.length > 0) {
int count = 0;
int errors = 0;
logger.info("Adding {} seed URL(s)...", seeds.length);
for (String seed : seeds) {

URL seedUrl;
try {
seedUrl = new URL(seed);
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Invalid seed URL provided: " + seed, e);
logger.warn("Invalid seed URL provided: " + seed);
errors++;
continue;
}
LinkRelevance link = new LinkRelevance(seedUrl, LinkRelevance.DEFAULT_RELEVANCE);
try {
Expand All @@ -205,6 +208,9 @@ public void addSeeds(String[] seeds) {
}
}
logger.info("Number of seeds added: " + count);
if (errors > 0) {
logger.info("Number of invalid seeds: " + errors);
}
}
}

Expand Down

0 comments on commit a526285

Please sign in to comment.