LUCENE-1905: fix bug when instantiating SimpleFSLockFacory with a String and add test

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@813154 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2009-09-09 22:50:24 +00:00
parent 11d65e5cb0
commit 5bb97b264e
2 changed files with 6 additions and 2 deletions

View File

@ -77,8 +77,7 @@ public class SimpleFSLockFactory extends FSLockFactory {
* @param lockDirName where lock files should be created. * @param lockDirName where lock files should be created.
*/ */
public SimpleFSLockFactory(String lockDirName) throws IOException { public SimpleFSLockFactory(String lockDirName) throws IOException {
lockDir = new File(lockDirName); setLockDir(new File(lockDirName));
setLockDir(lockDir);
} }
public Lock makeLock(String lockName) { public Lock makeLock(String lockName) {

View File

@ -260,6 +260,11 @@ public class TestLockFactory extends LuceneTestCase {
_TestUtil.rmDir(indexDirName); _TestUtil.rmDir(indexDirName);
} }
public void testSimpleFSLockFactory() throws IOException {
// test string file instantiation
new SimpleFSLockFactory("test");
}
// Verify: setDisableLocks works // Verify: setDisableLocks works
public void testDisableLocks() throws IOException { public void testDisableLocks() throws IOException {
File indexDirName = _TestUtil.getTempDir("index.TestLockFactory4"); File indexDirName = _TestUtil.getTempDir("index.TestLockFactory4");