You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2013/06/27 19:26:33 UTC

svn commit: r1497468 - /lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java

Author: markrmiller
Date: Thu Jun 27 17:26:33 2013
New Revision: 1497468

URL: http://svn.apache.org/r1497468
Log:
SOLR-4916: Fix test to close properly

Modified:
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java?rev=1497468&r1=1497467&r2=1497468&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java Thu Jun 27 17:26:33 2013
@@ -115,6 +115,7 @@ public class BlockDirectoryTest extends 
   @After
   public void tearDown() throws Exception {
     super.tearDown();
+    directory.close();
     FileUtils.deleteDirectory(file);
   }
 
@@ -128,15 +129,20 @@ public class BlockDirectoryTest extends 
     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();
     }
   }