SOLR-450 -- Validate start param to be non-negative and show friendly error message

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@733458 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2009-01-11 11:54:41 +00:00
parent 5be6d5bdd1
commit ea3fc08edb
1 changed files with 4 additions and 0 deletions

View File

@ -120,6 +120,10 @@ public class QueryComponent extends SearchComponent
SolrIndexSearcher searcher = req.getSearcher(); SolrIndexSearcher searcher = req.getSearcher();
SolrParams params = req.getParams(); SolrParams params = req.getParams();
if (rb.getQueryCommand().getOffset() < 0) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "'start' parameter cannot be negative");
}
// -1 as flag if not set. // -1 as flag if not set.
long timeAllowed = (long)params.getInt( CommonParams.TIME_ALLOWED, -1 ); long timeAllowed = (long)params.getInt( CommonParams.TIME_ALLOWED, -1 );