Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-891 Subcollection plugin won't require blacklist any more (markus)

Markus Jelsma9b10e6818055
diff --git a/CHANGES.txt b/CHANGES.txt
index e8002fd69..3b21632a9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,8 @@ Nutch Change Log
Release 1.3 - Current Development
+* NUTCH-891 Subcollection plugin won't require blacklist any more (markus)
+
* NUTCH-972 CrawlDbMerger doesn't break on non-existent input (Gabriele Kahlout via jnioche)
* NUTCH-967 Upgrade to Tika 0.9 (jnioche)
diff --git a/src/plugin/subcollection/src/java/org/apache/nutch/collection/Subcollection.java b/src/plugin/subcollection/src/java/org/apache/nutch/collection/Subcollection.java
index d12e18172..f3ebd4136 100644
--- a/src/plugin/subcollection/src/java/org/apache/nutch/collection/Subcollection.java
+++ b/src/plugin/subcollection/src/java/org/apache/nutch/collection/Subcollection.java
@@ -25,6 +25,7 @@ import org.apache.hadoop.conf.Configured;
import org.apache.nutch.net.URLFilter;
import org.apache.xerces.util.DOMUtil;
import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
/**
* SubCollection represents a subset of index, you can define url patterns that
@@ -170,11 +171,15 @@ public class Subcollection extends Configured implements URLFilter{
collection.getElementsByTagName(TAG_NAME).item(0)).trim();
this.wlString = DOMUtil.getChildText(
collection.getElementsByTagName(TAG_WHITELIST).item(0)).trim();
- this.blString = DOMUtil.getChildText(
- collection.getElementsByTagName(TAG_BLACKLIST).item(0)).trim();
parseList(this.whiteList, wlString);
- parseList(this.blackList, blString);
+
+ // Check if there's a blacklist we need to parse
+ NodeList nodeList = collection.getElementsByTagName(TAG_BLACKLIST);
+ if (nodeList.getLength() > 0) {
+ this.blString = DOMUtil.getChildText(nodeList.item(0)).trim();
+ parseList(this.blackList, blString);
+ }
}
/**