Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-575 - NPE in OpenSearchServlet when summary is null. This is present in any searches using NutchBean and hence fetchesSegments getSummary. I am committing this basic batch as this is preventing people from searching with the current trunk. I will track down this problem further and apply a more complete patch as time permits.

Dennis Kubes7f29db1d07b4
diff --git a/src/java/org/apache/nutch/searcher/FetchedSegments.java b/src/java/org/apache/nutch/searcher/FetchedSegments.java
index 638e7206b..16f1db0a1 100644
--- a/src/java/org/apache/nutch/searcher/FetchedSegments.java
+++ b/src/java/org/apache/nutch/searcher/FetchedSegments.java
@@ -154,9 +154,13 @@ public class FetchedSegments implements HitSummarizer, HitContent {
public Summary getSummary(HitDetails details, Query query)
throws IOException {
-
+
if (this.summarizer == null) { return new Summary(); }
- String text = getSegment(details).getParseText(getUrl(details)).getText();
+
+ Segment segment = getSegment(details);
+ ParseText parseText = segment.getParseText(getUrl(details));
+ String text = (parseText != null) ? parseText.getText() : "";
+
return this.summarizer.getSummary(text, query);
}