Buggy code:
public class SimpleFSDirectory extends FSDirectory { public SimpleFSDirectory ( File path , LockFactory lockFactory ) throws IOException { } public SimpleFSDirectory ( File path ) throws IOException { } @ Override public IndexInput openInput ( String name , int bufferSize ) throws IOException { } protected static class SimpleFSIndexInput extends BufferedIndexInput { protected static class Descriptor extends RandomAccessFile { protected volatile boolean isOpen ; long position ; final long length ; public Descriptor ( File file , String mode ) throws IOException { } @ Override public void close ( ) throws IOException { } } protected final SimpleFSDirectory . SimpleFSIndexInput . Descriptor file ; boolean isClone ; protected final int chunkSize ; public SimpleFSIndexInput ( File path , int bufferSize , int chunkSize ) throws IOException { } @ Override protected void readInternal ( byte [ ] b , int offset , int len ) throws IOException { synchronized ( file ) { long position = getFilePointer ( ) ; if ( position != ( file . position ) ) { file . seek ( position ) ; file . position = position ; } int total = 0 ; try { do { final int readLength ; if ( ( total + ( chunkSize ) ) > len ) { readLength = len - total ; } else { readLength = chunkSize ; } final int i = file . read ( b , ( offset + total ) , readLength ) ; if ( i == ( - 1 ) ) { throw new IOException ( "read<seq2seq4repair_space>past<seq2seq4repair_space>EOF" ) ; } file . position += i ; total += i ; } while ( total < len ) ; } catch ( OutOfMemoryError e ) { <START_BUG> final OutOfMemoryError outOfMemoryError = new OutOfMemoryError ( ( ( ( "OutOfMemoryError<seq2seq4repair_space>likely<seq2seq4repair_space>caused<seq2seq4repair_space>by<seq2seq4repair_space>the<seq2seq4repair_space>Sun<seq2seq4repair_space>VM<seq2seq4repair_space>Bug<seq2seq4repair_space>described<seq2seq4repair_space>in<seq2seq4repair_space>" + ( "https:////issues.apache.org//jira//browse//LUCENE-1566;<seq2seq4repair_space>try<seq2seq4repair_space>calling<seq2seq4repair_space>FSDirectory.setReadChunkSize<seq2seq4repair_space>" + "with<seq2seq4repair_space>a<seq2seq4repair_space>value<seq2seq4repair_space>smaller<seq2seq4repair_space>than<seq2seq4repair_space>the<seq2seq4repair_space>current<seq2seq4repair_space>chunks<seq2seq4repair_space>size<seq2seq4repair_space>(" ) ) + ( chunkSize ) ) + ")" ) ) ; <END_BUG> outOfMemoryError . initCause ( e ) ; throw outOfMemoryError ; } } } @ Override public void close ( ) throws IOException { } @ Override protected void seekInternal ( long position ) { } @ Override public long length ( ) { } @ Override public Object clone ( ) { } boolean isFDValid ( ) throws IOException { } @ Override public void copyBytes ( IndexOutput out , long numBytes ) throws IOException { } } }

Fix:
final OutOfMemoryError outOfMemoryError = new OutOfMemoryError ( ( ( ( "OutOfMemoryError<seq2seq4repair_space>likely<seq2seq4repair_space>caused<seq2seq4repair_space>by<seq2seq4repair_space>the<seq2seq4repair_space>Sun<seq2seq4repair_space>VM<seq2seq4repair_space>Bug<seq2seq4repair_space>described<seq2seq4repair_space>in<seq2seq4repair_space>" + ( "https:////issues.apache.org//jira//browse//LUCENE-1566;<seq2seq4repair_space>try<seq2seq4repair_space>calling<seq2seq4repair_space>FSDirectory.setReadChunkSize<seq2seq4repair_space>" + "with<seq2seq4repair_space>a<seq2seq4repair_space>value<seq2seq4repair_space>smaller<seq2seq4repair_space>than<seq2seq4repair_space>the<seq2seq4repair_space>current<seq2seq4repair_space>chunk<seq2seq4repair_space>size<seq2seq4repair_space>(" ) ) + ( chunkSize ) ) + ")" ) ) ;