Index: lucene/core/src/java/org/apache/lucene/store/FSDirectory.java =================================================================== --- lucene/core/src/java/org/apache/lucene/store/FSDirectory.java (revision 1564224) +++ lucene/core/src/java/org/apache/lucene/store/FSDirectory.java (working copy) @@ -337,7 +337,7 @@ /** For debug output. */ @Override public String toString() { - return this.getClass().getName() + "@" + directory + " lockFactory=" + getLockFactory(); + return this.getClass().getSimpleName() + "@" + directory + " lockFactory=" + getLockFactory(); } /** Index: lucene/core/src/java/org/apache/lucene/store/FSLockFactory.java =================================================================== --- lucene/core/src/java/org/apache/lucene/store/FSLockFactory.java (revision 1564224) +++ lucene/core/src/java/org/apache/lucene/store/FSLockFactory.java (working copy) @@ -50,4 +50,9 @@ return lockDir; } + @Override + public String toString() { + return this.getClass().getSimpleName() + "@" + lockDir; + } + } Index: lucene/core/src/java/org/apache/lucene/store/FilterDirectory.java =================================================================== --- lucene/core/src/java/org/apache/lucene/store/FilterDirectory.java (revision 1564224) +++ lucene/core/src/java/org/apache/lucene/store/FilterDirectory.java (working copy) @@ -101,6 +101,11 @@ } @Override + public String getLockID() { + return in.getLockID(); + } + + @Override public LockFactory getLockFactory() { return in.getLockFactory(); } Index: lucene/core/src/test/org/apache/lucene/index/TestCrashCausesCorruptIndex.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestCrashCausesCorruptIndex.java (revision 1564224) +++ lucene/core/src/test/org/apache/lucene/index/TestCrashCausesCorruptIndex.java (working copy) @@ -19,7 +19,6 @@ import java.io.File; import java.io.IOException; -import java.util.Collection; import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; @@ -27,11 +26,10 @@ import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.TopDocs; -import org.apache.lucene.store.BaseDirectory; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; +import org.apache.lucene.store.FilterDirectory; import org.apache.lucene.store.IOContext; -import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util._TestUtil; @@ -147,13 +145,12 @@ * This test class provides direct access to "simulating" a crash right after * realDirectory.createOutput(..) has been called on a certain specified name. */ - private static class CrashAfterCreateOutput extends BaseDirectory { + private static class CrashAfterCreateOutput extends FilterDirectory { - private Directory realDirectory; private String crashAfterCreateOutput; public CrashAfterCreateOutput(Directory realDirectory) throws IOException { - this.realDirectory = realDirectory; + super(realDirectory); setLockFactory(realDirectory.getLockFactory()); } @@ -160,15 +157,10 @@ public void setCrashAfterCreateOutput(String name) { this.crashAfterCreateOutput = name; } - + @Override - public void close() throws IOException { - realDirectory.close(); - } - - @Override public IndexOutput createOutput(String name, IOContext cxt) throws IOException { - IndexOutput indexOutput = realDirectory.createOutput(name, cxt); + IndexOutput indexOutput = in.createOutput(name, cxt); if (null != crashAfterCreateOutput && name.equals(crashAfterCreateOutput)) { // CRASH! indexOutput.close(); @@ -181,34 +173,6 @@ return indexOutput; } - @Override - public void deleteFile(String name) throws IOException { - realDirectory.deleteFile(name); - } - - @Override - public boolean fileExists(String name) throws IOException { - return realDirectory.fileExists(name); - } - - @Override - public long fileLength(String name) throws IOException { - return realDirectory.fileLength(name); - } - - @Override - public String[] listAll() throws IOException { - return realDirectory.listAll(); - } - - @Override - public IndexInput openInput(String name, IOContext cxt) throws IOException { - return realDirectory.openInput(name, cxt); - } - - @Override - public void sync(Collection names) throws IOException { - realDirectory.sync(names); - } } + } Index: lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java =================================================================== --- lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java (revision 0) +++ lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java (working copy) @@ -0,0 +1,41 @@ +package org.apache.lucene.store; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.lang.reflect.Method; +import java.util.HashSet; +import java.util.Set; + +import org.apache.lucene.util.LuceneTestCase; +import org.junit.Test; + +public class TestFilterDirectory extends LuceneTestCase { + + @Test + public void testOverrides() throws Exception { + Set allowed = new HashSet(); + allowed.add("copy"); + allowed.add("createSlicer"); + for (Method m : FilterDirectory.class.getMethods()) { + if (m.getDeclaringClass() == Directory.class) { + assertTrue("method " + m.getName() + " not overridden!", allowed.contains(m.getName())); + } + } + } + +} Property changes on: lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property