FileBasedQueryMaker could add a null Query if the query failed to parse

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1000030 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shai Erera 2010-09-22 15:14:20 +00:00
parent 9cc4437578
commit 56ff0c11c2
1 changed files with 3 additions and 7 deletions

View File

@ -73,18 +73,14 @@ public class FileBasedQueryMaker extends AbstractQueryMaker implements QueryMake
BufferedReader buffered = new BufferedReader(reader);
String line = null;
int lineNum = 0;
while ((line = buffered.readLine()) != null)
{
while ((line = buffered.readLine()) != null) {
line = line.trim();
if (!line.equals("") && !line.startsWith("#"))
{
Query query = null;
if (line.length() != 0 && !line.startsWith("#")) {
try {
query = qp.parse(line);
qq.add(qp.parse(line));
} catch (ParseException e) {
System.err.println("Exception: " + e.getMessage() + " occurred while parsing line: " + lineNum + " Text: " + line);
}
qq.add(query);
}
lineNum++;
}