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/07/01 23:39:57 UTC

svn commit: r1498713 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/core/ solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java

Author: markrmiller
Date: Mon Jul  1 21:39:57 2013
New Revision: 1498713

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

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java?rev=1498713&r1=1498712&r2=1498713&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java Mon Jul  1 21:39:57 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();
     }
   }