lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject svn commit: r426774 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/store/FSDirectory.java
Date Sat, 29 Jul 2006 09:54:48 GMT
Author: dnaber
Date: Sat Jul 29 02:54:48 2006
New Revision: 426774

URL: http://svn.apache.org/viewvc?rev=426774&view=rev
Log:
fix LUCENE-638: ignore files unrelated to Lucene in FSDirectory.list(); also make rename more
robust by using try/finally

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=426774&r1=426773&r2=426774&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Sat Jul 29 02:54:48 2006
@@ -7,7 +7,7 @@
 New features
 
  1. LUCENE-503: New ThaiAnalyzer and ThaiWordFilter in contrib/analyzers
-    (Samphan Raruenrom va Chris Hostetter)
+    (Samphan Raruenrom via Chris Hostetter)
 
  2. LUCENE-545: New FieldSelector API and associated changes to IndexReader and implementations.
     New Fieldable interface for use with the lazy field loading mechanism.
@@ -42,6 +42,11 @@
     ie: IndexReader).
     (Michael McCandless via Chris Hostetter)
 
+ 7. LUCENE-638: FSDirectory.list() now only returns the directory's 
+    Lucene-related files. Thanks to this change one can now construct
+    a RAMDirectory from a file system directory that contains files
+    not related to Lucene.
+    (Simon Willnauer via Daniel Naber)
  
 Bug fixes
 
@@ -87,7 +92,7 @@
      indexes.  This will improve the performance of many types of queries
      against a non-optimized index. (Andrew Hudson via Yonik Seeley)
 
-  2. LUCENE-623: RAMDirectory.close now nulls out it's reference to all
+  2. LUCENE-623: RAMDirectory.close now nulls out its reference to all
      internal "files", allowing them to be GCed even if references to the
      RAMDirectory itself still exist. (Nadav Har'El via Chris Hostetter)
 
@@ -384,7 +389,7 @@
     must match in a BooleanQuery.  See BooleanQuery.setMinimumNumberShouldMatch().
     (Paul Elschot, Chris Hostetter via Yonik Seeley, LUCENE-395)
 
-27. Added DisjunctionMaxQuery which provides the maximum score across it's clauses.
+27. Added DisjunctionMaxQuery which provides the maximum score across its clauses.
     It's very useful for searching across multiple fields.
     (Chuck Williams via Yonik Seeley, LUCENE-323)
 
@@ -766,7 +771,7 @@
 
  8. Added new method Query.getSimilarity(Searcher), and changed
     scorers to use it.  This permits one to subclass a Query class so
-    that it can specify it's own Similarity implementation, perhaps
+    that it can specify its own Similarity implementation, perhaps
     one that delegates through that of the Searcher.  (Julien Nioche
     via Cutting)
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java?rev=426774&r1=426773&r2=426774&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java Sat Jul 29 02:54:48
2006
@@ -211,9 +211,9 @@
     }
   }
 
-  /** Returns an array of strings, one for each file in the directory. */
+  /** Returns an array of strings, one for each Lucene index file in the directory. */
   public String[] list() {
-    return directory.list();
+    return directory.list(new IndexFileNameFilter());
   }
 
   /** Returns true iff a file with the given name exists. */
@@ -296,18 +296,21 @@
         throw newExc;
       }
       finally {
-        if (in != null) {
-          try {
-            in.close();
-          } catch (IOException e) {
-            throw new RuntimeException("Cannot close input stream: " + e.toString(), e);
+        try {
+          if (in != null) {
+            try {
+              in.close();
+            } catch (IOException e) {
+              throw new RuntimeException("Cannot close input stream: " + e.toString(), e);
+            }
           }
-        }
-        if (out != null) {
-          try {
-            out.close();
-          } catch (IOException e) {
-            throw new RuntimeException("Cannot close output stream: " + e.toString(), e);
+        } finally {
+          if (out != null) {
+            try {
+              out.close();
+            } catch (IOException e) {
+              throw new RuntimeException("Cannot close output stream: " + e.toString(), e);
+            }
           }
         }
       }



Mime
View raw message