Skip to content

Apache Lucene open-source search software

LUCENE-1877: make FSLockFactory.setLockDir() final to prevent users from doing bad things. This method was package private before, so no bw-problem, but as it is protected now (because an user's customized FSLockFactory must be able to call it from ctor), it must be final (contract: all methods called from ctors should be private or final).

Uwe Schindlerc6cb9a300e0c
diff --git a/src/java/org/apache/lucene/store/FSLockFactory.java b/src/java/org/apache/lucene/store/FSLockFactory.java
index 6d47582f334..bd705892adf 100644
--- a/src/java/org/apache/lucene/store/FSLockFactory.java
+++ b/src/java/org/apache/lucene/store/FSLockFactory.java
@@ -37,7 +37,7 @@ public abstract class FSLockFactory extends LockFactory {
* Subclasses can also use this method to set the directory
* in the constructor.
*/
- protected void setLockDir(File lockDir) {
+ protected final void setLockDir(File lockDir) {
if (this.lockDir != null)
throw new IllegalStateException("You can set the lock directory for this factory only once.");
this.lockDir = lockDir;