mirror of https://github.com/apache/lucene.git
reader should be closed after use
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@791246 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b0873e4476
commit
9789089343
|
@ -65,27 +65,32 @@ public class FileBasedQueryMaker extends AbstractQueryMaker implements QueryMake
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (reader != null) {
|
if (reader != null) {
|
||||||
BufferedReader buffered = new BufferedReader(reader);
|
try {
|
||||||
String line = null;
|
BufferedReader buffered = new BufferedReader(reader);
|
||||||
int lineNum = 0;
|
String line = null;
|
||||||
while ((line = buffered.readLine()) != null)
|
int lineNum = 0;
|
||||||
{
|
while ((line = buffered.readLine()) != null)
|
||||||
line = line.trim();
|
|
||||||
if (!line.equals("") && !line.startsWith("#"))
|
|
||||||
{
|
{
|
||||||
Query query = null;
|
line = line.trim();
|
||||||
try {
|
if (!line.equals("") && !line.startsWith("#"))
|
||||||
query = qp.parse(line);
|
{
|
||||||
} catch (ParseException e) {
|
Query query = null;
|
||||||
System.err.println("Exception: " + e.getMessage() + " occurred while parsing line: " + lineNum + " Text: " + line);
|
try {
|
||||||
|
query = qp.parse(line);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
System.err.println("Exception: " + e.getMessage() + " occurred while parsing line: " + lineNum + " Text: " + line);
|
||||||
|
}
|
||||||
|
qq.add(query);
|
||||||
}
|
}
|
||||||
qq.add(query);
|
lineNum++;
|
||||||
}
|
}
|
||||||
lineNum++;
|
} finally {
|
||||||
|
reader.close();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.err.println("No Reader available for: " + fileName);
|
System.err.println("No Reader available for: " + fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Query [] result = (Query[]) qq.toArray(new Query[qq.size()]) ;
|
Query [] result = (Query[]) qq.toArray(new Query[qq.size()]) ;
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue