You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/01/20 16:14:15 UTC

svn commit: r1233945 - /lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/codecs/lucene40/Lucene40LiveDocsFormat.java

Author: rmuir
Date: Fri Jan 20 15:14:14 2012
New Revision: 1233945

URL: http://svn.apache.org/viewvc?rev=1233945&view=rev
Log:
LUCENE-3661: clean this up to use IOUtils method

Modified:
    lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/codecs/lucene40/Lucene40LiveDocsFormat.java

Modified: lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/codecs/lucene40/Lucene40LiveDocsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/codecs/lucene40/Lucene40LiveDocsFormat.java?rev=1233945&r1=1233944&r2=1233945&view=diff
==============================================================================
--- lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/codecs/lucene40/Lucene40LiveDocsFormat.java (original)
+++ lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/codecs/lucene40/Lucene40LiveDocsFormat.java Fri Jan 20 15:14:14 2012
@@ -9,6 +9,7 @@ import org.apache.lucene.index.SegmentIn
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.MutableBits;
 
 public class Lucene40LiveDocsFormat extends LiveDocsFormat {
@@ -34,19 +35,14 @@ public class Lucene40LiveDocsFormat exte
     // nocommit: this api is ugly...
     String filename = IndexFileNames.fileNameFromGeneration(info.name, DELETES_EXTENSION, info.getDelGen());
     
-    // nocommit: is it somehow cleaner to still have IW do this try/finally/delete stuff and add abort() instead?
+    // nocommit: test if we really need this
     boolean success = false;
     try {
       ((BitVector)bits).write(dir, filename, context);
       success = true;
     } finally {
       if (!success) {
-        try {
-          dir.deleteFile(filename);
-        } catch (Throwable t) {
-          // suppress this so we keep throwing the
-          // original exception
-        }
+        IOUtils.deleteFilesIgnoringExceptions(dir, filename);
       }
     }
   }