Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-554 - Generator throws IOException on invalid urls.

Andrzej Bialecki917b6ec0048e
diff --git a/CHANGES.txt b/CHANGES.txt
index 38a53537e..91f12355d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -133,6 +133,9 @@ Unreleased changes (1.0-dev)
45. NUTCH-546 - file URL are filtered out by the crawler. (dogacan)
+46. NUTCH-554 - Generator throws IOException on invalid urls.
+ (Brian Whitman via ab)
+
Release 0.9 - 2007-04-02
1. Changed log4j confiquration to log to stdout on commandline
diff --git a/src/java/org/apache/nutch/crawl/Generator.java b/src/java/org/apache/nutch/crawl/Generator.java
index ee9a9b8f9..1a100b3dd 100644
--- a/src/java/org/apache/nutch/crawl/Generator.java
+++ b/src/java/org/apache/nutch/crawl/Generator.java
@@ -184,7 +184,13 @@ public class Generator extends ToolBase {
Text url = entry.url;
if (maxPerHost > 0) { // are we counting hosts?
- URL u = new URL(url.toString());
+ URL u = null;
+ try {
+ u = new URL(url.toString());
+ } catch (MalformedURLException e) {
+ LOG.info("Bad protocol in url: " + url.toString());
+ continue;
+ }
String host = u.getHost();
if (host == null) {
// unknown host, skip