Author: pkosiorowski
Date: Fri Sep 23 09:14:23 2005
New Revision: 291157

URL: http://svn.apache.org/viewcvs?rev=291157&view=rev
Log:
NUTCH-89 parse-rss null pointer exception. Sumbitted by Michael Nebel.

Modified:
    
lucene/nutch/branches/Release-0.7/src/plugin/parse-rss/src/java/org/apache/nutch/parse/rss/RSSParser.java

Modified: 
lucene/nutch/branches/Release-0.7/src/plugin/parse-rss/src/java/org/apache/nutch/parse/rss/RSSParser.java
URL: 
http://svn.apache.org/viewcvs/lucene/nutch/branches/Release-0.7/src/plugin/parse-rss/src/java/org/apache/nutch/parse/rss/RSSParser.java?rev=291157&r1=291156&r2=291157&view=diff
==============================================================================
--- 
lucene/nutch/branches/Release-0.7/src/plugin/parse-rss/src/java/org/apache/nutch/parse/rss/RSSParser.java
 (original)
+++ 
lucene/nutch/branches/Release-0.7/src/plugin/parse-rss/src/java/org/apache/nutch/parse/rss/RSSParser.java
 Fri Sep 23 09:14:23 2005
@@ -157,11 +157,13 @@
                 if (r.getLink() != null) {
                     try {
                         // get the outlink
-                        theOutlinks.add(new Outlink(r.getLink(), r
-                                .getDescription()));
+                       if (r.getDescription()!= null ) {
+                           theOutlinks.add(new Outlink(r.getLink(), 
r.getDescription()));
+                       } else {
+                           theOutlinks.add(new Outlink(r.getLink(), ""));
+                       }
                     } catch (MalformedURLException e) {
-                        LOG
-                                .info("nutch:parse-rss:RSSParser Exception: 
MalformedURL: "
+                        LOG.info("nutch:parse-rss:RSSParser Exception: 
MalformedURL: "
                                         + r.getLink()
                                         + ": Attempting to continue processing 
outlinks");
                         e.printStackTrace();
@@ -185,12 +187,13 @@
 
                     if (whichLink != null) {
                         try {
-                            theOutlinks.add(new Outlink(whichLink, theRSSItem
-                                    .getDescription()));
-
+                           if (theRSSItem.getDescription()!=null) {
+                               theOutlinks.add(new Outlink(whichLink, 
theRSSItem.getDescription()));
+                           } else {
+                               theOutlinks.add(new Outlink(whichLink, ""));
+                           }
                         } catch (MalformedURLException e) {
-                            LOG
-                                    .info("nutch:parse-rss:RSSParser 
Exception: MalformedURL: "
+                            LOG.info("nutch:parse-rss:RSSParser Exception: 
MalformedURL: "
                                             + whichLink
                                             + ": Attempting to continue 
processing outlinks");
                             e.printStackTrace();
@@ -206,23 +209,18 @@
             LOG.fine("nutch:parse-rss:getParse:contentTitle=" + contentTitle);
 
         } else {
-            LOG
-                    .fine("nutch:parse-rss:Error:getParse: No RSS Channels 
recorded!");
+            LOG.fine("nutch:parse-rss:Error:getParse: No RSS Channels 
recorded!");
         }
 
         // format the outlinks
+        Outlink[] outlinks = (Outlink[]) theOutlinks.toArray(new 
Outlink[theOutlinks.size()]);
 
-        Outlink[] outlinks = (Outlink[]) theOutlinks
-                .toArray(new Outlink[theOutlinks.size()]);
-
-        LOG.fine("nutch:parse-rss:getParse:found " + outlinks.length
-                + " outlinks");
+        LOG.fine("nutch:parse-rss:getParse:found " + outlinks.length + " 
outlinks");
         // LOG.info("Outlinks: "+outlinks);
 
         ParseData parseData = new ParseData(ParseStatus.STATUS_SUCCESS,
                 contentTitle.toString(), outlinks, content.getMetadata());
         return new ParseImpl(indexText.toString(), parseData);
-
     }
 
 }


Reply via email to