lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hayes, Mark" <Mha...@verisign.com>
Subject [patch] src/jsp/results.jsp Null pointer when no title
Date Mon, 25 Feb 2002 01:00:16 GMT
Here's a tiny fix for luceneweb.  When searching on documents with no title
field a null pointer occurs.  Unfortunately Tomcat (4.0.2) doesn't report
these exceptions as JSP page errors, so they are a little hard to find.

/mark

--- results.jsp	Thu Feb 14 12:53:40 2002
+++ results.jsp.new	Sun Feb 24 16:49:00 2002
@@ -113,7 +113,7 @@
                         Document doc = hits.doc(i);                  //get
the next document 
                         String doctitle = doc.get("title");          //get
its title
                         String url = doc.get("url");                 //get
its url field
-                        if (doctitle.equals(""))                     //use
the url if it has no title
+                        if (doctitle == null || doctitle.equals("")) //use
the url if it has no title
                                 doctitle = url;
                                                                      //then
output!
 %>

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message