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 Jelsmafb065090fdbb
diff --git a/CHANGES.txt b/CHANGES.txt
index f61b33e41..c069bd857 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,8 @@ Nutch Change Log
Release 2.0 - Current Development
+* NUTCH-891 Subcollection plugin won't require blacklist any more (markus)
+
* NUTCH-967 Upgrade to Tika 0.9 (jnioche)
* NUTCH-955 Ivy configuration improvements. Upgrade to Xerces 2.9.1 and Restlet 2.0.5 (alexis via ab)
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);
+ }
}
/**