We get hundreds of exceptions daily which are related to searching in
DSpace. The get request is obviously not created by DSpace because when you
do a simple search or advanced search through the interface DSpace does not
create the request in the format seen in the exception message. Therefore I
concluded the request is being created by users or another system that
interfaces with DSpace. Doing some research I discovered that the googlebot
forms the query which creates the exceptions. For the benefit of others who
are getting their inbox flooded with these exception messages here is a work
around. Insert this code into the top of the buildQuery Method in
QueryArgs.java. By applying this code the query will return no results in
the search list rather than throw an exception. This solution may seem to be
extreme however the googlebot is the source of the exceptions and needs to
create a request that conforms to the DSpace specifications rather than
querying with malformed get requests.
public String buildQuery(HttpServletRequest request)
{
// The googlebot creates it's own get request which is not in a
format recognized by dspace
// Generally the get request is formed by dspace through interaction
with the user interfaces such as the Search and Browse Interfaces
// googlebot sample request:
http://eggloop.its.queensu.ca/simple-search?advanced=true&query1=hamster
// The code below will determine if advanced is defined and if so it
must by definition also define "field1"
// if "field1 is not defined it is not considered a valid query and
returns no results
// Ron Stevenhaagen - 27, Feb 2009
if(request.getParameter("advanced") != null &&
request.getParameter("field1") == null)
{
String Dummy = "";
return Dummy;
}
Ron Stevenhaagen
Technical Specialist
Information Technology Services
Queens University
Kingston Ontario
-- URL Was: http://qspace.library.queensu.ca/simple-search?advanced=true
<http://qspace.library.queensu.ca/simple-search?advanced=true&query1=trout>
&query1=trout
-- Method: GET
-- Parameters were:
-- advanced: "true"
-- query1: "trout"
Exception:
java.lang.NullPointerException
at org.dspace.search.QueryArgs.buildQuery(QueryArgs.java:156)
at
org.dspace.app.webui.servlet.SimpleSearchServlet.doDSGet(SimpleSearchServlet
.java:124)
at
org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.java
:151)
at
org.dspace.app.webui.servlet.DSpaceServlet.doGet(DSpaceServlet.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
onnection(Http11BaseProtocol.java:664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
rkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:684)
at java.lang.Thread.run(Thread.java:595)
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech