Return-Path: Delivered-To: apmail-lucene-java-commits-archive@www.apache.org Received: (qmail 14440 invoked from network); 9 Jun 2005 18:59:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Jun 2005 18:59:24 -0000 Received: (qmail 2421 invoked by uid 500); 9 Jun 2005 18:59:23 -0000 Delivered-To: apmail-lucene-java-commits-archive@lucene.apache.org Received: (qmail 2409 invoked by uid 500); 9 Jun 2005 18:59:23 -0000 Mailing-List: contact java-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-commits@lucene.apache.org Received: (qmail 2391 invoked by uid 99); 9 Jun 2005 18:59:23 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 09 Jun 2005 11:59:22 -0700 Received: (qmail 14405 invoked by uid 65534); 9 Jun 2005 18:59:11 -0000 Message-ID: <20050609185911.14404.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r189793 - /lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java Date: Thu, 09 Jun 2005 18:59:11 -0000 To: java-commits@lucene.apache.org From: bmesser@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: bmesser Date: Thu Jun 9 11:59:10 2005 New Revision: 189793 URL: http://svn.apache.org/viewcvs?rev=3D189793&view=3Drev Log: use new filename filter in org.apache.lucene.index.IndexFileNameFilter Modified: lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java Modified: lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.ja= va URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lu= cene/store/FSDirectory.java?rev=3D189793&r1=3D189792&r2=3D189793&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java (or= iginal) +++ lucene/java/trunk/src/java/org/apache/lucene/store/FSDirectory.java Thu= Jun 9 11:59:10 2005 @@ -16,17 +16,16 @@ * limitations under the License. */ =20 -import java.io.FilenameFilter; -import java.io.IOException; import java.io.File; -import java.io.RandomAccessFile; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.util.Hashtable; +import java.io.IOException; +import java.io.RandomAccessFile; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; +import java.util.Hashtable; =20 -import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.IndexFileNameFilter; import org.apache.lucene.util.Constants; =20 /** @@ -38,28 +37,7 @@ * @author Doug Cutting */ public class FSDirectory extends Directory { - - /** - * Filter that only accepts filenames created by Lucene. - */ - private class LuceneFileFilter implements FilenameFilter { - - /* (non-Javadoc) - * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String) - */ - public boolean accept(File dir, String name) { - for (int i =3D 0; i < IndexReader.FILENAME_EXTENSIONS.length; i++) { - if (name.endsWith("."+IndexReader.FILENAME_EXTENSIONS[i])) - return true; - } - if (name.equals(Constants.INDEX_DELETABLE_FILENAME)) return true; - else if (name.equals(Constants.INDEX_SEGMENTS_FILENAME)) return true; - else if (name.matches(".+\\.f\\d+")) return true; - return false; - } - - } - + =20 /** This cache of directories ensures that there is a unique Directory * instance per path, so that synchronization on the Directory can be us= ed to * synchronize access between readers and writers. @@ -184,7 +162,7 @@ if (!directory.isDirectory()) throw new IOException(directory + " not a directory"); =20 - String[] files =3D directory.list(new LuceneFileFilter()); = // clear old files + String[] files =3D directory.list(new IndexFileNameFilter()); = // clear old files for (int i =3D 0; i < files.length; i++) { File file =3D new File(directory, files[i]); if (!file.delete())