Mailing List Archive

[patch] src/jsp/results.jsp Null pointer when no title
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>
Re: [patch] src/jsp/results.jsp Null pointer when no title [ In reply to ]
I haven't tested this, but even if it's not necessary it won't break
anything, so I'll apply this.

Thanks,
Otis

--- "Hayes, Mark" <Mhayes@verisign.com> wrote:
> 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>
>


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://http://taxes.yahoo.com/

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