lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r642339 - /lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java
Date Fri, 28 Mar 2008 19:11:02 GMT
Author: mikemccand
Date: Fri Mar 28 12:10:58 2008
New Revision: 642339

URL: http://svn.apache.org/viewvc?rev=642339&view=rev
Log:
LUCENE-1251: be sure to close the descriptor even if super.close() hits an exception, in FSIndexOutput.close

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java?rev=642339&r1=642338&r2=642339&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java Fri Mar 28 12:10:58
2008
@@ -634,9 +634,21 @@
     public void close() throws IOException {
       // only close the file if it has not been closed yet
       if (isOpen) {
-        super.close();
-        file.close();
-        isOpen = false;
+        boolean success = false;
+        try {
+          super.close();
+          success = true;
+        } finally {
+          isOpen = false;
+          if (!success) {
+            try {
+              file.close();
+            } catch (Throwable t) {
+              // Suppress so we don't mask original exception
+            }
+          } else
+            file.close();
+        }
       }
     }
   



Mime
View raw message