lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r593819 - /lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java
Date Sat, 10 Nov 2007 22:33:13 GMT
Author: mikemccand
Date: Sat Nov 10 14:33:10 2007
New Revision: 593819

URL: http://svn.apache.org/viewvc?rev=593819&view=rev
Log:
LUCENE-1020: close each SegmentReader after we've finished testing that segment

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java?rev=593819&r1=593818&r2=593819&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java Sat Nov 10 14:33:10
2007
@@ -141,6 +141,8 @@
       System.out.println("  " + (1+i) + " of " + numSegments + ": name=" + info.name + "
docCount=" + info.docCount);
       int toLoseDocCount = info.docCount;
 
+      SegmentReader reader = null;
+
       try {
         System.out.println("    compound=" + info.getUseCompoundFile());
         System.out.println("    numFiles=" + info.files().size());
@@ -157,7 +159,7 @@
         else
           System.out.println("    has deletions [delFileName=" + delFileName + "]");
         System.out.print("    test: open reader.........");
-        SegmentReader reader = SegmentReader.get(info);
+        reader = SegmentReader.get(info);
         final int numDocs = reader.numDocs();
         toLoseDocCount = numDocs;
         if (reader.hasDeletions())
@@ -258,6 +260,9 @@
         numBadSegments++;
         changed = true;
         continue;
+      } finally {
+        if (reader != null)
+          reader.close();
       }
 
       // Keeper



Mime
View raw message