On 6 May 2008, at 01:47, Brett, Hamish wrote:
> Hi
>
> We are receiving a large volume of internal errors that seem to be
> related to the advanced search with a null field. Any assistance is
> appreciated. I have tried reindexing it.
There's a bug in the QueryArgs class whereby if the search parameters
contain fewer "query" parameters than "field" parameters, trim() is
called on a null String object, causing the error you're getting.
At line 155 in org.dspace.search.QueryArgs.java, replace these lines:
String tmp_query = request.getParameter("query"+i).trim();
String tmp_field = request.getParameter("field"+i).trim();
if (tmp_query != null && !tmp_query.equals(""))
{
query.add(tmp_query);
if (tmp_field == null)
field.add("ANY");
else
field.add(tmp_field);
with these lines:
String tmp_query = request.getParameter("query"+i);
String tmp_field = request.getParameter("field"+i);
if (tmp_query != null && !tmp_query.trim().equals(""))
{
query.add(tmp_query.trim());
if (tmp_field == null)
field.add("ANY");
else
field.add(tmp_field.trim());
Might also need to compare tmp_field to an empty string to catch that
possibility but this change ought to get rid of the NPE.
--
Simon Brown <[EMAIL PROTECTED]> - Cambridge University Computing Service
+44 1223 3 34714 - New Museums Site, Pembroke Street, Cambridge CB2 3QH
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech