Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-712 ParseOutputFormat should catch java.net.MalformedURLException coming from normalizers.

Andrzej Bialecki832bf8117119
diff --git a/CHANGES.txt b/CHANGES.txt
index 7ec8365bc..e771c280e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,9 @@ Nutch Change Log
Unreleased Changes
+* NUTCH-712 ParseOutputFormat should catch java.net.MalformedURLException
+ coming from normalizers (Julien Nioche via ab)
+
* NUTCH-741 Job file includes multiple copies of nutch config files
(Kirby Bohling via ab)
diff --git a/src/java/org/apache/nutch/parse/ParseOutputFormat.java b/src/java/org/apache/nutch/parse/ParseOutputFormat.java
index 7dd042246..44cbe45e4 100644
--- a/src/java/org/apache/nutch/parse/ParseOutputFormat.java
+++ b/src/java/org/apache/nutch/parse/ParseOutputFormat.java
@@ -140,9 +140,13 @@ public class ParseOutputFormat implements OutputFormat<Text, Parse> {
pstatus.getMinorCode() == ParseStatus.SUCCESS_REDIRECT) {
String newUrl = pstatus.getMessage();
int refreshTime = Integer.valueOf(pstatus.getArgs()[1]);
- newUrl = normalizers.normalize(newUrl,
- URLNormalizers.SCOPE_FETCHER);
- newUrl = filters.filter(newUrl);
+ try {
+ newUrl = normalizers.normalize(newUrl,
+ URLNormalizers.SCOPE_FETCHER);
+ } catch (MalformedURLException mfue) {
+ newUrl = null;
+ }
+ if (newUrl != null) newUrl = filters.filter(newUrl);
String url = key.toString();
if (newUrl != null && !newUrl.equals(url)) {
String reprUrl =