Apache Nutch is an extensible and scalable web crawler
NUTCH-1421 RegexURLNormalizer to only skip rules with invalid patterns
Sebastian Nagel4c4e208c4faf
diff --git a/CHANGES.txt b/CHANGES.txtindex e9650c690..e0a80cc57 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -2,6 +2,8 @@ Nutch Change Log(trunk) Current Development:+* NUTCH-1421 RegexURLNormalizer to only skip rules with invalid patterns (snagel)+* NUTCH-1341 NotModified time set to now but page not modified (markus)* NUTCH-1215 UpdateDB should not require segment as input (markus)diff --git a/src/plugin/urlnormalizer-regex/src/java/org/apache/nutch/net/urlnormalizer/regex/RegexURLNormalizer.java b/src/plugin/urlnormalizer-regex/src/java/org/apache/nutch/net/urlnormalizer/regex/RegexURLNormalizer.javaindex 7a3f62ecc..537132379 100644--- a/src/plugin/urlnormalizer-regex/src/java/org/apache/nutch/net/urlnormalizer/regex/RegexURLNormalizer.java+++ b/src/plugin/urlnormalizer-regex/src/java/org/apache/nutch/net/urlnormalizer/regex/RegexURLNormalizer.java@@ -247,7 +247,14 @@ public class RegexURLNormalizer extends Configured implements URLNormalizer {}if (patternValue != null && subValue != null) {Rule rule = new Rule();- rule.pattern = Pattern.compile(patternValue);+ try {+ rule.pattern = Pattern.compile(patternValue);+ } catch (PatternSyntaxException e) {+ if (LOG.isErrorEnabled()) {+ LOG.error("skipped rule: " + patternValue + " -> " + subValue + " : invalid regular expression pattern: " + e);+ }+ continue;+ }rule.substitution = subValue;rules.add(rule);}