[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lucene-dev
Subject:    [patch] src/jsp/results.jsp Null pointer when no title
From:       "Hayes, Mark" <Mhayes () verisign ! com>
Date:       2002-02-25 1:00:16
[Download RAW message or body]

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>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic