mirror of https://github.com/apache/lucene.git
SOLR-4916: Fix test to close properly
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1497468 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
181296ff41
commit
4567a2f6cc
|
@ -115,6 +115,7 @@ public class BlockDirectoryTest extends LuceneTestCase {
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
directory.close();
|
||||||
FileUtils.deleteDirectory(file);
|
FileUtils.deleteDirectory(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,15 +129,20 @@ public class BlockDirectoryTest extends LuceneTestCase {
|
||||||
assertEquals(fsLength, hdfsLength);
|
assertEquals(fsLength, hdfsLength);
|
||||||
testEof(name, fsDir, fsLength);
|
testEof(name, fsDir, fsLength);
|
||||||
testEof(name, directory, hdfsLength);
|
testEof(name, directory, hdfsLength);
|
||||||
|
fsDir.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testEof(String name, Directory directory, long length) throws IOException {
|
private void testEof(String name, Directory directory, long length) throws IOException {
|
||||||
IndexInput input = directory.openInput(name, new IOContext());
|
IndexInput input = directory.openInput(name, new IOContext());
|
||||||
input.seek(length);
|
|
||||||
try {
|
try {
|
||||||
input.readByte();
|
input.seek(length);
|
||||||
fail("should throw eof");
|
try {
|
||||||
} catch (IOException e) {
|
input.readByte();
|
||||||
|
fail("should throw eof");
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
input.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue