Return-Path: Delivered-To: apmail-lucene-java-commits-archive@www.apache.org Received: (qmail 7151 invoked from network); 4 May 2009 10:16:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 May 2009 10:16:46 -0000 Received: (qmail 21405 invoked by uid 500); 4 May 2009 10:16:45 -0000 Delivered-To: apmail-lucene-java-commits-archive@lucene.apache.org Received: (qmail 21320 invoked by uid 500); 4 May 2009 10:16:45 -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 21311 invoked by uid 99); 4 May 2009 10:16:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 May 2009 10:16:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 May 2009 10:16:43 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5C887238896D; Mon, 4 May 2009 10:16:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r771260 - in /lucene/java/trunk/src: java/org/apache/lucene/store/FileSwitchDirectory.java test/org/apache/lucene/store/TestFileSwitchDirectory.java Date: Mon, 04 May 2009 10:16:22 -0000 To: java-commits@lucene.apache.org From: mikemccand@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090504101622.5C887238896D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mikemccand Date: Mon May 4 10:16:21 2009 New Revision: 771260 URL: http://svn.apache.org/viewvc?rev=771260&view=rev Log: add getters to FSD; change listAll to directly create String[] Modified: lucene/java/trunk/src/java/org/apache/lucene/store/FileSwitchDirectory.java lucene/java/trunk/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java Modified: lucene/java/trunk/src/java/org/apache/lucene/store/FileSwitchDirectory.java URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/store/FileSwitchDirectory.java?rev=771260&r1=771259&r2=771260&view=diff ============================================================================== --- lucene/java/trunk/src/java/org/apache/lucene/store/FileSwitchDirectory.java (original) +++ lucene/java/trunk/src/java/org/apache/lucene/store/FileSwitchDirectory.java Mon May 4 10:16:21 2009 @@ -44,6 +44,14 @@ this.lockFactory = primaryDir.getLockFactory(); } + public Directory getPrimaryDir() { + return primaryDir; + } + + public Directory getSecondaryDir() { + return secondaryDir; + } + public void close() throws IOException { if (doClose) { try { @@ -56,16 +64,12 @@ } public String[] listAll() throws IOException { - List list = new ArrayList(); - String[] ramFiles = secondaryDir.listAll(); - for (int x = 0; x < ramFiles.length; x++) { - list.add(ramFiles[x]); - } - String[] fsFiles = primaryDir.listAll(); - for (int x = 0; x < fsFiles.length; x++) { - list.add(fsFiles[x]); - } - return (String[]) list.toArray(new String[0]); + String[] primaryFiles = primaryDir.listAll(); + String[] secondaryFiles = secondaryDir.listAll(); + String[] files = new String[primaryFiles.length + secondaryFiles.length]; + System.arraycopy(primaryFiles, 0, files, 0, primaryFiles.length); + System.arraycopy(secondaryFiles, 0, files, primaryFiles.length, secondaryFiles.length); + return files; } public String[] list() throws IOException { Modified: lucene/java/trunk/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java?rev=771260&r1=771259&r2=771260&view=diff ============================================================================== --- lucene/java/trunk/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java (original) +++ lucene/java/trunk/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java Mon May 4 10:16:21 2009 @@ -64,8 +64,11 @@ } reader.close(); writer.close(); - - primaryDir.close(); - secondaryDir.close(); + + files = fsd.listAll(); + for(int i=0;i