Author: ab
Date: Tue Jan  3 00:35:04 2006
New Revision: 365576

URL: http://svn.apache.org/viewcvs?rev=365576&view=rev
Log:
Fixed an NPE, in case of a fetch error we don't have a score value
from Fetcher.

Modified:
    lucene/nutch/trunk/src/java/org/apache/nutch/parse/ParseOutputFormat.java

Modified: 
lucene/nutch/trunk/src/java/org/apache/nutch/parse/ParseOutputFormat.java
URL: 
http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/parse/ParseOutputFormat.java?rev=365576&r1=365575&r2=365576&view=diff
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/parse/ParseOutputFormat.java 
(original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/parse/ParseOutputFormat.java 
Tue Jan  3 00:35:04 2006
@@ -37,7 +37,8 @@
                                       String name) throws IOException {
 
     final float interval = job.getFloat("db.default.fetch.interval", 30f);
-
+    final float extscore = job.getFloat("db.score.link.external", 1.0f);
+    
     File text =
       new File(new File(job.getOutputDir(), ParseText.DIR_NAME), name);
     File data =
@@ -81,8 +82,10 @@
           Outlink[] links = parse.getData().getOutlinks();
 
           // compute OPIC score contribution
-          float score =
-            Float.parseFloat(parse.getData().get(Fetcher.SCORE_KEY));
+          String scoreString = parse.getData().get(Fetcher.SCORE_KEY);
+          float score = extscore;
+          // this may happen if there was a fetch error.
+         if (scoreString != null) score = Float.parseFloat(scoreString);
           score /= links.length;
                           
           for (int i = 0; i < links.length; i++) {




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Nutch-cvs mailing list
Nutch-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nutch-cvs

Reply via email to