From 4567a2f6cc1bb98aa02a3d60140f915b01c6bc5b Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Thu, 27 Jun 2013 17:26:33 +0000 Subject: [PATCH] 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 --- .../solr/store/blockcache/BlockDirectoryTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java b/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java index b829dcf549f..5d0445c7d6b 100644 --- a/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java +++ b/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java @@ -115,6 +115,7 @@ public class BlockDirectoryTest extends LuceneTestCase { @After public void tearDown() throws Exception { super.tearDown(); + directory.close(); FileUtils.deleteDirectory(file); } @@ -128,15 +129,20 @@ public class BlockDirectoryTest extends LuceneTestCase { assertEquals(fsLength, hdfsLength); testEof(name, fsDir, fsLength); testEof(name, directory, hdfsLength); + fsDir.close(); } private void testEof(String name, Directory directory, long length) throws IOException { IndexInput input = directory.openInput(name, new IOContext()); - input.seek(length); try { - input.readByte(); - fail("should throw eof"); - } catch (IOException e) { + input.seek(length); + try { + input.readByte(); + fail("should throw eof"); + } catch (IOException e) { + } + } finally { + input.close(); } }