You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by mi...@apache.org on 2008/11/29 13:08:43 UTC
svn commit: r721668 -
/lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/store/TestLockFactory.java
Author: mikemccand
Date: Sat Nov 29 04:08:43 2008
New Revision: 721668
URL: http://svn.apache.org/viewvc?rev=721668&view=rev
Log:
LUCENE-1464: fix bug in TestLockFactory to not hit NPE trying to remove a dir that doesn't exist
Modified:
lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/store/TestLockFactory.java
Modified: lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/store/TestLockFactory.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/store/TestLockFactory.java?rev=721668&r1=721667&r2=721668&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/store/TestLockFactory.java (original)
+++ lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/store/TestLockFactory.java Sat Nov 29 04:08:43 2008
@@ -300,8 +300,8 @@
// Different lock factory instance should hit IOException:
try {
- FSDirectory fs2 = FSDirectory.getDirectory(indexDirName, new SingleInstanceLockFactory());
- fail("Should have hit an IOException because LockFactory instances differ");
+ FSDirectory.getDirectory(indexDirName, new SingleInstanceLockFactory());
+ fail("Should have hit an IOException because LockFactory instances differ");
} catch (IOException e) {
}
@@ -371,8 +371,6 @@
NativeFSLockFactory f = new NativeFSLockFactory(System.getProperty("tempDir"));
- NativeFSLockFactory f2 = new NativeFSLockFactory(System.getProperty("tempDir"));
-
f.setLockPrefix("test");
Lock l = f.makeLock("commit");
Lock l2 = f.makeLock("commit");
@@ -485,7 +483,6 @@
}
public void run() {
IndexSearcher searcher = null;
- WhitespaceAnalyzer analyzer = new WhitespaceAnalyzer();
Query query = new TermQuery(new Term("content", "aaa"));
for(int i=0;i<this.numIteration;i++) {
try{
@@ -566,10 +563,12 @@
private void rmDir(String dirName) {
File dir = new java.io.File(dirName);
String[] files = dir.list(); // clear old files
- for (int i = 0; i < files.length; i++) {
+ if (files != null) {
+ for (int i = 0; i < files.length; i++) {
File file = new File(dir, files[i]);
file.delete();
+ }
+ dir.delete();
}
- dir.delete();
}
}