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) {
|
||||
BufferedReader buffered = new BufferedReader(reader);
|
||||
String line = null;
|
||||
int lineNum = 0;
|
||||
while ((line = buffered.readLine()) != null)
|
||||
{
|
||||
line = line.trim();
|
||||
if (!line.equals("") && !line.startsWith("#"))
|
||||
try {
|
||||
BufferedReader buffered = new BufferedReader(reader);
|
||||
String line = null;
|
||||
int lineNum = 0;
|
||||
while ((line = buffered.readLine()) != null)
|
||||
{
|
||||
Query query = null;
|
||||
try {
|
||||
query = qp.parse(line);
|
||||
} catch (ParseException e) {
|
||||
System.err.println("Exception: " + e.getMessage() + " occurred while parsing line: " + lineNum + " Text: " + line);
|
||||
line = line.trim();
|
||||
if (!line.equals("") && !line.startsWith("#"))
|
||||
{
|
||||
Query query = null;
|
||||
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 {
|
||||
System.err.println("No Reader available for: " + fileName);
|
||||
}
|
||||
|
||||
}
|
||||
Query [] result = (Query[]) qq.toArray(new Query[qq.size()]) ;
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue