[jira] [Created] (SOLR-4600) 400 Bad Request status should be returned if a query parameter has the wrong datatype

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (SOLR-4600) 400 Bad Request status should be returned if a query parameter has the wrong datatype

JIRA jira@apache.org
Jack Krupansky created SOLR-4600:
------------------------------------

             Summary: 400 Bad Request status should be returned if a query parameter has the wrong datatype
                 Key: SOLR-4600
                 URL: https://issues.apache.org/jira/browse/SOLR-4600
             Project: Solr
          Issue Type: Bug
            Reporter: Jack Krupansky


Solr returns a 500 Server Error for the following query even though the error is really a user error - wrong datatype for the &rows parameter:

{code}
curl "http://localhost:8983/solr/select/?q=*:*&rows=all" -v
{code}

The &rows parameter of course expects an integer.

Somebody should probably trap the raw number format exception and turn it into a 400 Bad Request SolrException.

The actual response:

{code}
Jack Krupansky@JackKrupansky ~ $ curl "http://localhost:8983/solr/select/?q=*:*&rows=all" -v
* About to connect() to localhost port 8983 (#0)
*   Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 8983 (#0)
> GET /solr/select/?q=*:*&rows=all HTTP/1.1
> User-Agent: curl/7.27.0
> Host: localhost:8983
> Accept: */*
>
* additional stuff not fine /usr/src/ports/curl/curl-7.27.0-1/src/curl-7.27.0/lib/transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 500 Server Error
< Cache-Control: no-cache, no-store
< Pragma: no-cache
< Expires: Sat, 01 Jan 2000 01:00:00 GMT
< Last-Modified: Sun, 17 Mar 2013 21:23:39 GMT
< ETag: "13d7a3c83fb"
< Content-Type: application/xml; charset=UTF-8
< Transfer-Encoding: chunked
<
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">500</int><int name="QTime">1</int><lst name="params"><str name="q">*:*</str><str name="rows">all</str></lst></lst><lst name="error"><str name="msg">For input string: "all"</str><str name="trace">java.lang.NumberFormatException: For input string: "all"
        at java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.lang.Integer.parseInt(Unknown Source)
        at java.lang.Integer.parseInt(Unknown Source)
        at org.apache.solr.search.QParser.getSort(QParser.java:277)
        at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:123)
        at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:187)
        at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:1797)
        at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:637)
        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:343)
        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:141)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
        at org.eclipse.jetty.server.Server.handle(Server.java:365)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
        at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
        at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
        at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
        at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
        at java.lang.Thread.run(Unknown Source)
</str><int name="code">500</int></lst>
</response>
* Connection #0 to host localhost left intact
* Closing connection #0
{code}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]