SOLR-435 -- NullPointerException with no query or empty query

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@741046 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2009-02-05 08:41:14 +00:00
parent 17ccf4ebef
commit 742dccd202
2 changed files with 8 additions and 1 deletions

View File

@ -236,6 +236,8 @@ Bug Fixes
27. SOLR-991: Better error message when parsing solrconfig.xml fails due to malformed XML. Error message notes the name
of the file being parsed. (Michael Henson via shalin)
28. SOLR-435: NullPointerException with no query or empty query (ryan, Lars Kotthoff via shalin)
Other Changes
----------------------

View File

@ -74,7 +74,12 @@ public class QueryComponent extends SearchComponent
defType = defType==null ? OldLuceneQParserPlugin.NAME : defType;
if (rb.getQueryString() == null) {
rb.setQueryString( params.get( CommonParams.Q ) );
rb.setQueryString(params.get(CommonParams.Q));
String queryString = params.get(CommonParams.Q);
if (queryString == null) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Missing or empty required parameter: q");
}
}
try {