Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-730 NPE in LinkRank if no nodes with which to create the WebGraph.

Andrzej Bialeckid15119baaf04
diff --git a/CHANGES.txt b/CHANGES.txt
index 41ed51ecb..d1aa22792 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -12,6 +12,9 @@ Unreleased Changes
* NUTCH-707 - Generation of multiple segments in multiple runs returns only 1 segment
(Michael Chen, ab)
+* NUTCH-730 - NPE in LinkRank if no nodes with which to create the WebGraph
+ (Dennis Kubes via ab)
+
Release 1.0 - 2009-03-23
1. NUTCH-474 - Fetcher2 crawlDelay and blocking fix (Dogacan Guney via ab)
diff --git a/src/java/org/apache/nutch/scoring/webgraph/LinkRank.java b/src/java/org/apache/nutch/scoring/webgraph/LinkRank.java
index 11e666438..44f5594cc 100644
--- a/src/java/org/apache/nutch/scoring/webgraph/LinkRank.java
+++ b/src/java/org/apache/nutch/scoring/webgraph/LinkRank.java
@@ -122,7 +122,13 @@ public class LinkRank
BufferedReader buffer = new BufferedReader(new InputStreamReader(readLinks));
String numLinksLine = buffer.readLine();
readLinks.close();
-
+
+ // check if there are links to process, if none, webgraph might be empty
+ if (numLinksLine == null || numLinksLine.length() == 0) {
+ fs.delete(numLinksPath, true);
+ throw new IOException("No links to process, is the webgraph empty?");
+ }
+
// delete temp file and convert and return the number of links as an int
LOG.info("Deleting numlinks temp file");
fs.delete(numLinksPath, true);