tests: fix resource leak

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1022788 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2010-10-15 00:40:56 +00:00
parent 25e2a6be37
commit 90d0cfa613
1 changed files with 10 additions and 7 deletions

View File

@ -355,13 +355,16 @@ public class ExtractingRequestHandlerTest extends SolrTestCaseJ4 {
SolrQueryResponse loadLocal(String filename, String... args) throws Exception {
LocalSolrQueryRequest req = (LocalSolrQueryRequest) req(args);
// TODO: stop using locally defined streams once stream.file and
// stream.body work everywhere
List<ContentStream> cs = new ArrayList<ContentStream>();
cs.add(new ContentStreamBase.FileStream(new File(filename)));
req.setContentStreams(cs);
return h.queryAndResponse("/update/extract", req);
try {
// TODO: stop using locally defined streams once stream.file and
// stream.body work everywhere
List<ContentStream> cs = new ArrayList<ContentStream>();
cs.add(new ContentStreamBase.FileStream(new File(filename)));
req.setContentStreams(cs);
return h.queryAndResponse("/update/extract", req);
} finally {
req.close();
}
}