Index: lucene/src/test/org/apache/lucene/index/TestIndexWriter.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexWriter.java (revision 995237) +++ lucene/src/test/org/apache/lucene/index/TestIndexWriter.java (working copy) @@ -5134,8 +5134,7 @@ } public void testRandomStoredFields() throws IOException { - File index = _TestUtil.getTempDir("lucenerandfields"); - Directory dir = FSDirectory.open(index); + Directory dir = newDirectory(random); Random rand = random; RandomIndexWriter w = new RandomIndexWriter(rand, dir, newIndexWriterConfig(rand, TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(_TestUtil.nextInt(rand, 5, 20))); //w.w.setInfoStream(System.out); @@ -5221,7 +5220,6 @@ } w.close(); dir.close(); - _TestUtil.rmDir(index); } private static class FailTwiceDuringMerge extends MockDirectoryWrapper.Failure { Index: lucene/src/java/org/apache/lucene/store/FSDirectory.java =================================================================== --- lucene/src/java/org/apache/lucene/store/FSDirectory.java (revision 995237) +++ lucene/src/java/org/apache/lucene/store/FSDirectory.java (working copy) @@ -468,46 +468,6 @@ public void flushBuffer(byte[] b, int offset, int size) throws IOException { file.write(b, offset, size); } - - @Override - public void copyBytes(DataInput input, long numBytes) throws IOException { - // Optimized copy only if the number of bytes to copy is larger than the - // buffer size, and the given IndexInput supports FileChannel copying. - // NOTE: the below check relies on NIOIndexInput extending Simple. If that - // changes in the future, we should change the check as well. - if (numBytes <= BUFFER_SIZE || !(input instanceof SimpleFSIndexInput)) { - super.copyBytes(input, numBytes); - return; - } - - SimpleFSIndexInput fsInput = (SimpleFSIndexInput) input; - - // flush any bytes in the input's buffer. - numBytes -= fsInput.flushBuffer(this, numBytes); - - // flush any bytes in the buffer - flush(); - - // do the optimized copy - FileChannel in = fsInput.file.getChannel(); - - // Necessary because BufferedIndexInput does lazy seeking: - in.position(fsInput.getFilePointer()); - - FileChannel out = file.getChannel(); - long pos = out.position(); - long writeTo = numBytes + pos; - while (pos < writeTo) { - pos += out.transferFrom(in, pos, Math.min(CHANNEL_CHUNK_SIZE, writeTo - pos)); - } - // transferFrom does not change the position of the channel. Need to change it manually - out.position(pos); - - // corrects the position in super (BufferedIndexOutput), so that calls - // to getFilePointer will return the correct pointer. - // Perhaps a specific method is better? - super.seek(out.position()); - } @Override public void close() throws IOException {