diff --git a/CHANGES.txt b/CHANGES.txt index 392aee85856..0551d4b2426 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -204,6 +204,9 @@ API Changes remove an old lock. The default implementation is to ask the lockFactory (if non null) to clear the lock. (Mike McCandless) +19. LUCENE-795: Directory.renameFile() has been deprecated as it is + not used anymore inside Lucene. (Daniel Naber) + Bug fixes 1. Fixed the web application demo (built with "ant war-demo") which diff --git a/src/java/org/apache/lucene/store/Directory.java b/src/java/org/apache/lucene/store/Directory.java index 158a7a47706..b7fbe0cd1e8 100644 --- a/src/java/org/apache/lucene/store/Directory.java +++ b/src/java/org/apache/lucene/store/Directory.java @@ -63,8 +63,10 @@ public abstract class Directory { throws IOException; /** Renames an existing file in the directory. - If a file already exists with the new name, then it is replaced. - This replacement should be atomic. */ + * If a file already exists with the new name, then it is replaced. + * This replacement is not guaranteed to be atomic. + * @deprecated + */ public abstract void renameFile(String from, String to) throws IOException; diff --git a/src/java/org/apache/lucene/store/FSDirectory.java b/src/java/org/apache/lucene/store/FSDirectory.java index d93f94a3b2c..37889d61d45 100644 --- a/src/java/org/apache/lucene/store/FSDirectory.java +++ b/src/java/org/apache/lucene/store/FSDirectory.java @@ -351,7 +351,10 @@ public class FSDirectory extends Directory { throw new IOException("Cannot delete " + file); } - /** Renames an existing file in the directory. */ + /** Renames an existing file in the directory. + * Warning: This is not atomic. + * @deprecated + */ public synchronized void renameFile(String from, String to) throws IOException { File old = new File(directory, from); diff --git a/src/java/org/apache/lucene/store/RAMDirectory.java b/src/java/org/apache/lucene/store/RAMDirectory.java index d1640ab4603..8c2e0338478 100644 --- a/src/java/org/apache/lucene/store/RAMDirectory.java +++ b/src/java/org/apache/lucene/store/RAMDirectory.java @@ -21,8 +21,6 @@ import java.io.IOException; import java.io.FileNotFoundException; import java.io.File; import java.io.Serializable; -import java.util.Collection; -import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.Set; @@ -185,8 +183,9 @@ public class RAMDirectory extends Directory implements Serializable { throw new FileNotFoundException(name); } - /** Removes an existing file in the directory. - * @throws IOException if from does not exist + /** Renames an existing file in the directory. + * @throws FileNotFoundException if from does not exist + * @deprecated */ public synchronized final void renameFile(String from, String to) throws IOException { RAMFile fromFile = (RAMFile)fileMap.get(from);