Hi Folks,

  I updated to the latest SVN revision (385691) today, and I am now seeing a
Null Pointer exception in the AnalyzerFactory.java class. It seems that in
some cases, the method:

  private Extension getExtension(String lang) {     Extension extension =
(Extension) this.conf.getObject(lang);    if (extension == null) {
extension = findExtension(lang);      if (extension != null) {
this.conf.setObject(lang, extension);      }    }    return extension;  }


Has a null "lang" parameter passed to it, which causes a NullPointer
exception at line: 81 in
src/java/org/apache/nutch/analyzer/AnalyzerFactory.java

I found that if I checked for null in the lang variable, and returned null
if lang == null, that my crawl finished. Here is a small patch that will fix
the crawl:

Index: 
/Users/mattmann/src/nutch/src/java/org/apache/nutch/analysis/AnalyzerFactory
.java ===================================================================
--- 
/Users/mattmann/src/nutch/src/java/org/apache/nutch/analysis/AnalyzerFactory
.java    (revision 385691) +++
/Users/mattmann/src/nutch/src/java/org/apache/nutch/analysis/AnalyzerFactory
.java    (working copy) @@ -78,14 +78,19 @@    private Extension
getExtension(String lang) { -    Extension extension = (Extension)
this.conf.getObject(lang); -    if (extension == null) { -      extension =
findExtension(lang); -      if (extension != null) { -
this.conf.setObject(lang, extension); -      } -    } -    return extension;
+    if(lang == null){ +        return null; +    } +    else{ +
Extension extension = (Extension) this.conf.getObject(lang); +        if
(extension == null) { +          extension = findExtension(lang); +
if (extension != null) { +            this.conf.setObject(lang, extension);
+          } +        } +        return extension;        +    }   }
private Extension findExtension(String lang) {


NOTE: not sure if returning null is the right thing to do here, but hey, at
least it made my crawl finish! :-)

Cheers,
  Chris



______________________________________________
Chris A. Mattmann
[EMAIL PROTECTED]
Staff Member
Modeling and Data Management Systems Section (387)
Data Management Systems and Technologies Group

_________________________________________________
Jet Propulsion Laboratory            Pasadena, CA
Office: 171-266B                        Mailstop:  171-246

_______________________________________________________

Disclaimer:  The opinions presented within are my own and do not reflect
those of either NASA, JPL, or the California Institute of Technology.

Reply via email to