lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r950210 - in /lucene/java/branches/lucene_2_9: ./ contrib/ contrib/analyzers/ contrib/highlighter/src/test/ contrib/instantiated/src/test/org/apache/lucene/store/instantiated/ src/java/org/apache/lucene/analysis/ src/java/org/apache/lucene/...
Date Tue, 01 Jun 2010 19:07:46 GMT
Author: mikemccand
Date: Tue Jun  1 19:07:45 2010
New Revision: 950210

URL: http://svn.apache.org/viewvc?rev=950210&view=rev
Log:
LUCENE-2421: NativeFSLockFactory does not throw LockReleaseFailedExc if it cannot delete lock
file

Modified:
    lucene/java/branches/lucene_2_9/   (props changed)
    lucene/java/branches/lucene_2_9/CHANGES.txt   (contents, props changed)
    lucene/java/branches/lucene_2_9/build.xml   (props changed)
    lucene/java/branches/lucene_2_9/contrib/   (props changed)
    lucene/java/branches/lucene_2_9/contrib/CHANGES.txt   (props changed)
    lucene/java/branches/lucene_2_9/contrib/analyzers/   (props changed)
    lucene/java/branches/lucene_2_9/contrib/highlighter/src/test/   (props changed)
    lucene/java/branches/lucene_2_9/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/analysis/Tokenizer.java   (props
changed)
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/store/NativeFSLockFactory.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/AttributeSource.java 
 (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestDateTools.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestNumberTools.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/   (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/store/TestLockFactory.java
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/LuceneTestCase.java
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/TestAttributeSource.java
  (props changed)

Propchange: lucene/java/branches/lucene_2_9/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,5 +1,5 @@
 /lucene/dev/branches/branch_3x/lucene:941394,946651,948430
-/lucene/dev/trunk/lucene:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_2_4:748824
 /lucene/java/branches/lucene_3_0:886275,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk:821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Modified: lucene/java/branches/lucene_2_9/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/CHANGES.txt?rev=950210&r1=950209&r2=950210&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/CHANGES.txt (original)
+++ lucene/java/branches/lucene_2_9/CHANGES.txt Tue Jun  1 19:07:45 2010
@@ -5,6 +5,10 @@ $Id$
 
 Changes in runtime behavior
 
+* LUCENE-2421: NativeFSLockFactory does not throw LockReleaseFailedException if 
+  it cannot delete the lock file, since obtaining the lock does not fail if the 
+  file is there. (Shai Erera)
+
 * LUCENE-2060: Changed ConcurrentMergeScheduler's default for
   maxNumThreads from 3 to 1, because in practice we get the most gains
   from running a single merge in the backround.  More than one

Propchange: lucene/java/branches/lucene_2_9/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/CHANGES.txt:941394,946651,948430
-/lucene/dev/trunk/lucene/CHANGES.txt:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/CHANGES.txt:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/CHANGES.txt:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/CHANGES.txt:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/build.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/build.xml:941394,946651,948430
-/lucene/dev/trunk/lucene/build.xml:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/build.xml:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/build.xml:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/build.xml:821888,834035,836155,887670,889431-889432,889579,891205,891209,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/contrib:941394,946651,948430
-/lucene/dev/trunk/lucene/contrib:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/contrib:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/contrib:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/contrib:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/contrib/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt:941394,946651,948430
-/lucene/dev/trunk/lucene/contrib/CHANGES.txt:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/contrib/CHANGES.txt:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/contrib/CHANGES.txt:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/contrib/CHANGES.txt:821888,834035,836155,887670,889431-889432,889579,891205,891209,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/contrib/analyzers/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,3 +1,3 @@
 /lucene/dev/branches/branch_3x/lucene/contrib/analyzers:941394,946651
-/lucene/dev/trunk/lucene/contrib/analyzers:939611
+/lucene/dev/trunk/lucene/contrib/analyzers:939611,940730
 /lucene/java/trunk/contrib/analyzers:834035,836155,887670,889579,891205

Propchange: lucene/java/branches/lucene_2_9/contrib/highlighter/src/test/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/contrib/highlighter/src/test:941394,946651,948430
-/lucene/dev/trunk/lucene/contrib/highlighter/src/test:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/contrib/highlighter/src/test:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/contrib/highlighter/src/test:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/contrib/highlighter/src/test:821888,834035,836155,887670,889431-889432,889579,891205,891209,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,5 +1,5 @@
 /lucene/dev/branches/branch_3x/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:941394,946651,948430
-/lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_2_4/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:748824
 /lucene/java/branches/lucene_2_9/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:817269-818599
 /lucene/java/branches/lucene_2_9_back_compat_tests/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:818601-821336

Propchange: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/analysis/Tokenizer.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/analysis/Tokenizer.java:941394,946651,948430
-/lucene/dev/trunk/lucene/src/java/org/apache/lucene/analysis/Tokenizer.java:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/src/java/org/apache/lucene/analysis/Tokenizer.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/Tokenizer.java:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/src/java/org/apache/lucene/analysis/Tokenizer.java:821888,834035,836155,887670,889579,891205,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:941394,946651,948430
-/lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/store/NativeFSLockFactory.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/store/NativeFSLockFactory.java?rev=950210&r1=950209&r2=950210&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/store/NativeFSLockFactory.java
(original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/store/NativeFSLockFactory.java
Tue Jun  1 19:07:45 2010
@@ -17,6 +17,7 @@ package org.apache.lucene.store;
  * limitations under the License.
  */
 
+import java.lang.management.ManagementFactory;
 import java.nio.channels.FileChannel;
 import java.nio.channels.FileLock;
 import java.io.File;
@@ -78,12 +79,26 @@ public class NativeFSLockFactory extends
                             lockDir.getAbsolutePath());
     }
 
-    String randomLockName = "lucene-" + Long.toString(new Random().nextInt(), Character.MAX_RADIX)
+ "-test.lock";
+    // add the RuntimeMXBean's name to the lock file, to reduce the chance for
+    // name collisions when this code is invoked by multiple JVMs (such as in
+    // our tests). On most systems, the name includes the process Id.
+    // Also, remove any non-alphanumeric characters, so that the lock file will
+    // be created for sure on all systems.
+    String randomLockName = "lucene-"
+        + ManagementFactory.getRuntimeMXBean().getName().replaceAll("[^a..zA..Z0..9]+","")
+ "-"
+        + Long.toString(new Random().nextInt(), Character.MAX_RADIX)
+        + "-test.lock";
     
     Lock l = makeLock(randomLockName);
     try {
       l.obtain();
       l.release();
+      // If the test lock failed to delete after all the attempts, attempt a
+      // delete when the JVM exits.
+      File lockFile = new File(lockDir, randomLockName);
+      if (lockFile.exists()) {
+        lockFile.deleteOnExit();
+      }
     } catch (IOException e) {
       RuntimeException e2 = new RuntimeException("Failed to acquire random test lock; please
verify filesystem for lock directory '" + lockDir + "' supports locking");
       e2.initCause(e);
@@ -294,8 +309,10 @@ class NativeFSLock extends Lock {
           }
         }
       }
-      if (!path.delete())
-        throw new LockReleaseFailedException("failed to delete " + path);
+      // LUCENE-2421: we don't care anymore if the file cannot be deleted
+      // because it's held up by another process (e.g. AntiVirus). NativeFSLock
+      // does not depend on the existence/absence of the lock file
+      path.delete();
     } else {
       // if we don't hold the lock, and somebody still called release(), for
       // example as a result of calling IndexWriter.unlock(), we should attempt

Propchange: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/AttributeSource.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,5 +1,5 @@
 /lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/util/AttributeSource.java:946651
-/lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/AttributeSource.java:929738,932398,935522,946599,949976,949997
+/lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/AttributeSource.java:929738,932398,935522,940730,946599,949976,949997
 /lucene/java/branches/lucene_2_4/src/java/org/apache/lucene/util/AttributeSource.java:748824
 /lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/util/AttributeSource.java:886275,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/src/java/org/apache/lucene/util/AttributeSource.java:821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,886257,887347,887532,887670,889579,891189,891205,891363,894348,897672,908975,910034,910078,912407,919060

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,5 +1,5 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:946651
-/lucene/dev/trunk/lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:929738,932398,935522,946599,949976,949997
+/lucene/dev/trunk/lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:929738,932398,935522,940730,946599,949976,949997
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:748824
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:886275,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:818920,821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,887347,887532,887670,889579,891189,891205,891363,897672,908975,910034,910078,912407,919060

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:941394,946651,948430
-/lucene/dev/trunk/lucene/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestDateTools.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/document/TestDateTools.java:941394,946651,948430
-/lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestDateTools.java:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestDateTools.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/document/TestDateTools.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/src/test/org/apache/lucene/document/TestDateTools.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestNumberTools.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/document/TestNumberTools.java:941394,946651,948430
-/lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestNumberTools.java:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestNumberTools.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/document/TestNumberTools.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/src/test/org/apache/lucene/document/TestNumberTools.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,2 +1,3 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index:941394,946651
+/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index:940730
 /lucene/java/trunk/src/test/org/apache/lucene/index:834035,836155,887670,889579,891205

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:941394,946651,948430
-/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Modified: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/store/TestLockFactory.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/store/TestLockFactory.java?rev=950210&r1=950209&r2=950210&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/store/TestLockFactory.java
(original)
+++ lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/store/TestLockFactory.java
Tue Jun  1 19:07:45 2010
@@ -395,6 +395,22 @@ public class TestLockFactory extends Luc
       assertFalse(l2.isLocked());
     }
 
+    
+    // Verify: NativeFSLockFactory works correctly if the lock file exists
+    public void testNativeFSLockFactoryLockExists() throws IOException {
+      
+      File lockFile = new File(TEMP_DIR, "test.lock");
+      lockFile.createNewFile();
+      
+      Lock l = new NativeFSLockFactory(TEMP_DIR).makeLock("test.lock");
+      assertTrue("failed to obtain lock", l.obtain());
+      l.release();
+      assertFalse("failed to release lock", l.isLocked());
+      if (lockFile.exists()) {
+        lockFile.delete();
+      }
+    }
+
     public void testNativeFSLockReleaseByOtherLock() throws IOException {
 
       NativeFSLockFactory f = new NativeFSLockFactory(System.getProperty("tempDir"));
@@ -408,8 +424,8 @@ public class TestLockFactory extends Luc
         assertTrue(l2.isLocked());
         l2.release();
         fail("should not have reached here. LockReleaseFailedException should have been thrown");
-      } catch (IOException e) {
-        assertTrue("Unexpected exception", e instanceof LockReleaseFailedException);
+      } catch (LockReleaseFailedException e) {
+        // expected
       } finally {
         l.release();
       }

Modified: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/LuceneTestCase.java?rev=950210&r1=950209&r2=950210&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/LuceneTestCase.java Tue
Jun  1 19:07:45 2010
@@ -18,6 +18,7 @@ package org.apache.lucene.util;
  */
 
 import java.io.PrintStream;
+import java.io.File;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.Random;
@@ -50,6 +51,14 @@ import org.apache.lucene.util.FieldCache
  */
 public abstract class LuceneTestCase extends TestCase {
 
+  public static final File TEMP_DIR;
+  static {
+    String s = System.getProperty("tempDir", System.getProperty("java.io.tmpdir"));
+    if (s == null)
+      throw new RuntimeException("To run tests, you need to define system property 'tempDir'
or 'java.io.tmpdir'.");
+    TEMP_DIR = new File(s);
+  }
+
   private boolean savedAPISetting = false;
 
   public LuceneTestCase() {

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/TestAttributeSource.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 19:07:45 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java:941394,946651,948430
-/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java:929738,932398,935522,938989,939611,939649,946599,948082,948429,949976,949997
+/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/util/TestAttributeSource.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
 /lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060



Mime
View raw message