Index: lucene/core/src/java/org/apache/lucene/store/FSLockFactory.java =================================================================== --- lucene/core/src/java/org/apache/lucene/store/FSLockFactory.java (revision 1563833) +++ 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().getName() + "@" + lockDir; + } + } Index: lucene/core/src/java/org/apache/lucene/store/FilterDirectory.java =================================================================== --- lucene/core/src/java/org/apache/lucene/store/FilterDirectory.java (revision 1563833) +++ 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 1563833) +++ 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); - } } + }