Apache Solr open-source search software
LUCENE-1451: deprecate methods that use FSDirectory.getDirectory under-the-hood
Michael McCandless42693ff05670
diff --git a/src/java/org/apache/lucene/index/IndexReader.java b/src/java/org/apache/lucene/index/IndexReader.javaindex aff36304e37..dc305cabed5 100644--- a/src/java/org/apache/lucene/index/IndexReader.java+++ b/src/java/org/apache/lucene/index/IndexReader.java@@ -204,7 +204,7 @@ public abstract class IndexReader implements Cloneable {* path.* @throws CorruptIndexException if the index is corrupt* @throws IOException if there is a low-level IO error- * @deprecated Use {@link #open(String, boolean)} instead+ * @deprecated Use {@link #open(Directory, boolean)} instead* @param path the path to the index directory */public static IndexReader open(String path) throws CorruptIndexException, IOException {return open(FSDirectory.getDirectory(path), true, null, null, false);@@ -219,7 +219,8 @@ public abstract class IndexReader implements Cloneable {* @throws IOException if there is a low-level IO error* @param path the path to the index directory* @param readOnly true if this should be a readOnly- * reader */+ * reader+ * @deprecated Use {@link #open(Directory, boolean)} instead*/public static IndexReader open(String path, boolean readOnly) throws CorruptIndexException, IOException {return open(FSDirectory.getDirectory(path), true, null, null, readOnly);}@@ -229,7 +230,7 @@ public abstract class IndexReader implements Cloneable {* @param path the path to the index directory* @throws CorruptIndexException if the index is corrupt* @throws IOException if there is a low-level IO error- * @deprecated Use {@link #open(File, boolean)} instead+ * @deprecated Use {@link #open(Directory, boolean)} instead*/public static IndexReader open(File path) throws CorruptIndexException, IOException {return open(FSDirectory.getDirectory(path), true, null, null, false);@@ -244,7 +245,9 @@ public abstract class IndexReader implements Cloneable {* @throws IOException if there is a low-level IO error* @param path the path to the index directory* @param readOnly true if this should be a readOnly- * reader */+ * reader+ * @deprecated Use {@link #open(Directory, boolean)}+ * instead */public static IndexReader open(File path, boolean readOnly) throws CorruptIndexException, IOException {return open(FSDirectory.getDirectory(path), true, null, null, readOnly);}@@ -555,6 +558,7 @@ public abstract class IndexReader implements Cloneable {* @return version number.* @throws CorruptIndexException if the index is corrupt* @throws IOException if there is a low-level IO error+ * @deprecated Use {@link #getCurrentVersion(Directory)} instead*/public static long getCurrentVersion(File directory) throws CorruptIndexException, IOException {Directory dir = FSDirectory.getDirectory(directory);@@ -1167,7 +1171,7 @@ public abstract class IndexReader implements Cloneable {* currently locked.* @param directory the directory to check for a lock* @throws IOException if there is a low-level IO error- * @deprecated Please use {@link IndexWriter#isLocked(String)} instead+ * @deprecated Please use {@link IndexWriter#isLocked(Directory)} instead*/public static boolean isLocked(String directory) throws IOException {Directory dir = FSDirectory.getDirectory(directory);diff --git a/src/java/org/apache/lucene/index/IndexWriter.java b/src/java/org/apache/lucene/index/IndexWriter.javaindex cb4b10e540a..26515e0da97 100644--- a/src/java/org/apache/lucene/index/IndexWriter.java+++ b/src/java/org/apache/lucene/index/IndexWriter.java@@ -837,6 +837,8 @@ public class IndexWriter {* if it does not exist and <code>create</code> is* <code>false</code> or if there is any other low-level* IO error+ * @deprecated Use {@link #IndexWriter(Directory, Analyzer,+ * boolean, MaxFieldLength)}*/public IndexWriter(String path, Analyzer a, boolean create, MaxFieldLength mfl)throws CorruptIndexException, LockObtainFailedException, IOException {@@ -864,7 +866,7 @@ public class IndexWriter {* IO error* @deprecated This constructor will be removed in the 3.0 release.* Use {@link- * #IndexWriter(String,Analyzer,boolean,MaxFieldLength)}+ * #IndexWriter(Directory,Analyzer,boolean,MaxFieldLength)}* instead, and call {@link #commit()} when needed.*/public IndexWriter(String path, Analyzer a, boolean create)@@ -897,6 +899,8 @@ public class IndexWriter {* if it does not exist and <code>create</code> is* <code>false</code> or if there is any other low-level* IO error+ * @deprecated Use {@link #IndexWriter(Directory,+ * Analyzer, boolean, MaxFieldLength)}*/public IndexWriter(File path, Analyzer a, boolean create, MaxFieldLength mfl)throws CorruptIndexException, LockObtainFailedException, IOException {@@ -924,7 +928,7 @@ public class IndexWriter {* IO error* @deprecated This constructor will be removed in the 3.0 release.* Use {@link- * #IndexWriter(File,Analyzer,boolean,MaxFieldLength)}+ * #IndexWriter(Directory,Analyzer,boolean,MaxFieldLength)}* instead, and call {@link #commit()} when needed.*/public IndexWriter(File path, Analyzer a, boolean create)@@ -1012,6 +1016,7 @@ public class IndexWriter {* @throws IOException if the directory cannot be* read/written to or if there is any other low-level* IO error+ * @deprecated Use {@link #IndexWriter(Directory, Analyzer, MaxFieldLength)}*/public IndexWriter(String path, Analyzer a, MaxFieldLength mfl)throws CorruptIndexException, LockObtainFailedException, IOException {@@ -1035,7 +1040,7 @@ public class IndexWriter {* IO error* @deprecated This constructor will be removed in the 3.0* release, and call {@link #commit()} when needed.- * Use {@link #IndexWriter(String,Analyzer,MaxFieldLength)} instead.+ * Use {@link #IndexWriter(Directory,Analyzer,MaxFieldLength)} instead.*/public IndexWriter(String path, Analyzer a)throws CorruptIndexException, LockObtainFailedException, IOException {@@ -1063,6 +1068,8 @@ public class IndexWriter {* @throws IOException if the directory cannot be* read/written to or if there is any other low-level* IO error+ * @deprecated Use {@link #IndexWriter(Directory,+ * Analyzer, MaxFieldLength)}*/public IndexWriter(File path, Analyzer a, MaxFieldLength mfl)throws CorruptIndexException, LockObtainFailedException, IOException {@@ -1085,7 +1092,7 @@ public class IndexWriter {* read/written to or if there is any other low-level* IO error* @deprecated This constructor will be removed in the 3.0 release.- * Use {@link #IndexWriter(File,Analyzer,MaxFieldLength)}+ * Use {@link #IndexWriter(Directory,Analyzer,MaxFieldLength)}* instead, and call {@link #commit()} when needed.*/public IndexWriter(File path, Analyzer a)@@ -5367,6 +5374,7 @@ public class IndexWriter {* currently locked.* @param directory the directory to check for a lock* @throws IOException if there is a low-level IO error+ * @deprecated Use {@link #isLocked(Directory)}*/public static boolean isLocked(String directory) throws IOException {Directory dir = FSDirectory.getDirectory(directory);diff --git a/src/java/org/apache/lucene/store/RAMDirectory.java b/src/java/org/apache/lucene/store/RAMDirectory.javaindex 25b3c5920dc..287bf1b0f01 100644--- a/src/java/org/apache/lucene/store/RAMDirectory.java+++ b/src/java/org/apache/lucene/store/RAMDirectory.java@@ -79,6 +79,7 @@ public class RAMDirectory extends Directory implements Serializable {* @param dir a <code>File</code> specifying the index directory** @see #RAMDirectory(Directory)+ * @deprecated Use {@link #RAMDirectory(Directory)} instead*/public RAMDirectory(File dir) throws IOException {this(FSDirectory.getDirectory(dir), true);@@ -90,6 +91,7 @@ public class RAMDirectory extends Directory implements Serializable {* @param dir a <code>String</code> specifying the full index directory path** @see #RAMDirectory(Directory)+ * @deprecated Use {@link #RAMDirectory(Directory)} instead*/public RAMDirectory(String dir) throws IOException {this(FSDirectory.getDirectory(dir), true);