You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2011/05/02 09:29:34 UTC
svn commit: r1098505 - in /lucene/dev/branches/branch_3x: ./ lucene/
lucene/backwards/
lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java solr/
Author: simonw
Date: Mon May 2 07:29:33 2011
New Revision: 1098505
URL: http://svn.apache.org/viewvc?rev=1098505&view=rev
Log:
LUCENE-3057: LuceneTestCase#newFSDirectoryImpl misses to set LockFactory if ctor call throws exception
Modified:
lucene/dev/branches/branch_3x/ (props changed)
lucene/dev/branches/branch_3x/lucene/ (props changed)
lucene/dev/branches/branch_3x/lucene/backwards/ (props changed)
lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
lucene/dev/branches/branch_3x/solr/ (props changed)
Modified: lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java?rev=1098505&r1=1098504&r2=1098505&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java Mon May 2 07:29:33 2011
@@ -903,18 +903,19 @@ public abstract class LuceneTestCase ext
private static Directory newFSDirectoryImpl(
Class<? extends FSDirectory> clazz, File file, LockFactory lockFactory)
throws IOException {
+ FSDirectory d = null;
try {
// Assuming every FSDirectory has a ctor(File), but not all may take a
// LockFactory too, so setting it afterwards.
Constructor<? extends FSDirectory> ctor = clazz.getConstructor(File.class);
- FSDirectory d = ctor.newInstance(file);
- if (lockFactory != null) {
- d.setLockFactory(lockFactory);
- }
- return d;
+ d = ctor.newInstance(file);
} catch (Exception e) {
- return FSDirectory.open(file);
+ d = FSDirectory.open(file);
+ }
+ if (lockFactory != null) {
+ d.setLockFactory(lockFactory);
}
+ return d;
}
static Directory newDirectoryImpl(Random random, String clazzName) {