Thanks Simon

That did the trick

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Simon
Brown
Sent: Tuesday, 6 May 2008 8:28 PM
To: dspace-tech@lists.sourceforge.net
Subject: Re: [Dspace-tech] Internal error caused by search


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/j
avaone
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech

IMPORTANT: This email remains the property of the Australian Defence 
Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 
1914.  If you have received this email in error, you are requested to contact 
the sender and delete the email.



-------------------------------------------------------------------------
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
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to