lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gsing...@apache.org
Subject svn commit: r612869 - in /lucene/java/branches/lucene_2_3: contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java src/java/org/apache/lucene/store/SimpleFSLockFactory.java src/test/org/apache/lucene/store/TestLockFactory.java
Date Thu, 17 Jan 2008 17:01:02 GMT
Author: gsingers
Date: Thu Jan 17 09:01:01 2008
New Revision: 612869

URL: http://svn.apache.org/viewvc?rev=612869&view=rev
Log:
LUCENE-1050 and LUCENE-1138 fixes for lock problem

Modified:
    lucene/java/branches/lucene_2_3/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java
    lucene/java/branches/lucene_2_3/src/java/org/apache/lucene/store/SimpleFSLockFactory.java
    lucene/java/branches/lucene_2_3/src/test/org/apache/lucene/store/TestLockFactory.java

Modified: lucene/java/branches/lucene_2_3/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_3/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java?rev=612869&r1=612868&r2=612869&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_3/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java
(original)
+++ lucene/java/branches/lucene_2_3/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java
Thu Jan 17 09:01:01 2008
@@ -284,7 +284,9 @@
    * @throws IOException
    */
   public void clearIndex() throws IOException {
-    IndexReader.unlock(spellIndex);
+      if (IndexReader.isLocked(spellIndex)){
+	IndexReader.unlock(spellIndex);
+      }
     IndexWriter writer = new IndexWriter(spellIndex, null, true);
     writer.close();
   }

Modified: lucene/java/branches/lucene_2_3/src/java/org/apache/lucene/store/SimpleFSLockFactory.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_3/src/java/org/apache/lucene/store/SimpleFSLockFactory.java?rev=612869&r1=612868&r2=612869&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_3/src/java/org/apache/lucene/store/SimpleFSLockFactory.java
(original)
+++ lucene/java/branches/lucene_2_3/src/java/org/apache/lucene/store/SimpleFSLockFactory.java
Thu Jan 17 09:01:01 2008
@@ -145,7 +145,7 @@
   }
 
   public void release() throws LockReleaseFailedException {
-    if (!lockFile.delete())
+    if (lockFile.exists() && !lockFile.delete())
       throw new LockReleaseFailedException("failed to delete " + lockFile);
   }
 

Modified: lucene/java/branches/lucene_2_3/src/test/org/apache/lucene/store/TestLockFactory.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_3/src/test/org/apache/lucene/store/TestLockFactory.java?rev=612869&r1=612868&r2=612869&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_3/src/test/org/apache/lucene/store/TestLockFactory.java
(original)
+++ lucene/java/branches/lucene_2_3/src/test/org/apache/lucene/store/TestLockFactory.java
Thu Jan 17 09:01:01 2008
@@ -190,9 +190,9 @@
         if (writer2 != null) {
           try {
             writer2.close();
-            fail("writer2.close() should have hit LockReleaseFailedException");
-          } catch (LockReleaseFailedException e) {
             // expected
+          } catch (LockReleaseFailedException e) {
+            fail("writer2.close() should not have hit LockReleaseFailedException");
           }
         }
 



Mime
View raw message