From: <bi...@us...> - 2009-02-28 01:23:12
|
Revision: 2685 http://archive-access.svn.sourceforge.net/archive-access/?rev=2685&view=rev Author: binzino Date: 2009-02-28 01:23:10 +0000 (Sat, 28 Feb 2009) Log Message: ----------- Improvied error handling with better diagnostic messages to help catch common deployment mistakes. Modified Paths: -------------- trunk/archive-access/projects/nutchwax/archive/src/nutch/src/java/org/apache/nutch/searcher/FetchedSegments.java Modified: trunk/archive-access/projects/nutchwax/archive/src/nutch/src/java/org/apache/nutch/searcher/FetchedSegments.java =================================================================== --- trunk/archive-access/projects/nutchwax/archive/src/nutch/src/java/org/apache/nutch/searcher/FetchedSegments.java 2009-02-28 01:18:32 UTC (rev 2684) +++ trunk/archive-access/projects/nutchwax/archive/src/nutch/src/java/org/apache/nutch/searcher/FetchedSegments.java 2009-02-28 01:23:10 UTC (rev 2685) @@ -262,10 +262,26 @@ if (this.summarizer == null) { return new Summary(); } + String text = ""; Segment segment = getSegment(details); - ParseText parseText = segment.getParseText(getUrl(details)); - String text = (parseText != null) ? parseText.getText() : ""; - + + if ( segment != null ) + { + try + { + ParseText parseText = segment.getParseText(getUrl(details)); + text = (parseText != null) ? parseText.getText() : ""; + } + catch ( Exception e ) + { + LOG.error( "segment = " + segment.segmentDir, e ); + } + } + else + { + LOG.warn( "No segment for: " + details ); + } + return this.summarizer.getSummary(text, query); } @@ -330,12 +346,19 @@ String segmentName = details.getValue("segment"); Map perCollectionSegments = (Map) this.segments.get( collectionId ); + + if ( perCollectionSegments == null ) + { + LOG.warn( "Cannot find per-collection segments for: " + collectionId ); + + return null; + } Segment segment = (Segment) perCollectionSegments.get( segmentName ); if ( segment == null ) { - LOG.warn( "Didn't find segment: collection=" + collectionId + " segment=" + segmentName ); + LOG.warn( "Cannot find segment: collection=" + collectionId + " segment=" + segmentName ); } return segment; @@ -350,7 +373,7 @@ if ( segment == null ) { - LOG.warn( "Didn't find segment: " + segmentName ); + LOG.warn( "Cannot find segment: " + segmentName ); } return segment; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |