/** * Set the lock directory. This is package-private and is * only used externally by FSDirectory when creating this * LockFactory via the System property * org.apache.lucene.store.FSDirectoryLockFactoryClass. */ void setLockDir(File lockDir) throws IOException { this.lockDir = lockDir; if (lockDir != null) { // Ensure that lockDir exists and is a directory. if (!lockDir.exists()) { if (!lockDir.mkdirs()) throw new IOException("Cannot create directory: " + lockDir.getAbsolutePath()); } else if (!lockDir.isDirectory()) { throw new IOException("Found regular file where directory expected: " + lockDir.getAbsolutePath()); } acquireTestLock(); } }
/** * Set the lock directory. This is package-private and is * only used externally by FSDirectory when creating this * LockFactory via the System property * org.apache.lucene.store.FSDirectoryLockFactoryClass. */ void setLockDir(File lockDir) throws IOException { this.lockDir = lockDir; if (lockDir != null) { // Ensure that lockDir exists and is a directory. if (!lockDir.exists()) { if (!lockDir.mkdirs()) throw new IOException("Cannot create directory: " + lockDir.getAbsolutePath()); } else if (!lockDir.isDirectory()) { throw new IOException("Found regular file where directory expected: " + lockDir.getAbsolutePath()); } acquireTestLock(); } }