Buggy code:
public class TestFSTs extends LuceneTestCase { private MockDirectoryWrapper dir ; public void setUp ( ) throws IOException { } public void tearDown ( ) throws IOException { } private static BytesRef toBytesRef ( IntsRef ir ) { } private static IntsRef toIntsRef ( String s , int inputMode ) { } private static IntsRef toIntsRef ( String s , int inputMode , IntsRef ir ) { } private static IntsRef toIntsRefUTF32 ( String s , IntsRef ir ) { } private static IntsRef toIntsRef ( BytesRef br , IntsRef ir ) { } public void testBasicFSA ( ) throws IOException { } private static String simpleRandomString ( Random r ) { } private void doTest ( int inputMode , IntsRef [ ] terms ) throws IOException { } private static class FSTTester < T > { final Random random ; final List < TestFSTs . FSTTester . InputOutput < T > > pairs ; final int inputMode ; final Outputs < T > outputs ; final Directory dir ; public FSTTester ( Random random , Directory dir , int inputMode , List < TestFSTs . FSTTester . InputOutput < T > > pairs , Outputs < T > outputs ) { } private static class InputOutput < T > implements Comparable < TestFSTs . FSTTester . InputOutput < T > > { public final IntsRef input ; public final T output ; public InputOutput ( IntsRef input , T output ) { } public int compareTo ( TestFSTs . FSTTester . InputOutput < T > other ) { } } public void doTest ( ) throws IOException { } private T run ( FST < T > fst , IntsRef term , int [ ] prefixLength ) throws IOException { } private T randomAcceptedWord ( FST < T > fst , IntsRef in ) throws IOException { } FST < T > doTest ( int prune1 , int prune2 ) throws IOException { } private void verifyUnPruned ( int inputMode , FST < T > fst ) throws IOException { } private static class CountMinOutput < T > { int count ; T output ; T finalOutput ; boolean isLeaf = true ; boolean isFinal ; } private void verifyPruned ( int inputMode , FST < T > fst , int prune1 , int prune2 ) throws IOException { } } public void testRandomWords ( ) throws IOException { } private String inputModeToString ( int mode ) { } private void testRandomWords ( int maxNumWords , int numIter ) throws IOException { } static String getRandomString ( ) { } @ Nightly public void testBigSet ( ) throws IOException { } private static String inputToString ( int inputMode , IntsRef term ) { } public void testRealTerms ( ) throws Exception { if ( CodecProvider . getDefault ( ) . getDefaultFieldCodec ( ) . equals ( "SimpleText" ) ) { CodecProvider . getDefault ( ) . setDefaultFieldCodec ( "Standard" ) ; } <START_BUG> final LineFileDocs docs = new LineFileDocs ( false ) ; <END_BUG> final int RUN_TIME_SEC = ( LuceneTestCase . TEST_NIGHTLY ) ? 100 : 1 ; final IndexWriterConfig conf = newIndexWriterConfig ( TEST_VERSION_CURRENT , new MockAnalyzer ( ) ) . setMaxBufferedDocs ( ( - 1 ) ) . setRAMBufferSizeMB ( 64 ) ; final File tempDir = _TestUtil . getTempDir ( "fstlines" ) ; final MockDirectoryWrapper dir = new MockDirectoryWrapper ( random , FSDirectory . open ( tempDir ) ) ; final IndexWriter writer = new IndexWriter ( dir , conf ) ; writer . setInfoStream ( ( VERBOSE ? System . out : null ) ) ; final long stopTime = ( System . currentTimeMillis ( ) ) + ( RUN_TIME_SEC * 1000 ) ; Document doc ; int docCount = 0 ; while ( ( ( doc = docs . nextDoc ( ) ) != null ) && ( ( System . currentTimeMillis ( ) ) < stopTime ) ) { writer . addDocument ( doc ) ; docCount ++ ; } IndexReader r = IndexReader . open ( writer ) ; writer . close ( ) ; final PositiveIntOutputs outputs = PositiveIntOutputs . getSingleton ( random . nextBoolean ( ) ) ; Builder < Long > builder = new Builder < Long > ( INPUT_TYPE . BYTE1 , 0 , 0 , true , outputs ) ; boolean storeOrd = random . nextBoolean ( ) ; if ( VERBOSE ) { if ( storeOrd ) { System . out . println ( "FST<seq2seq4repair_space>stores<seq2seq4repair_space>ord" ) ; } else { System . out . println ( "FST<seq2seq4repair_space>stores<seq2seq4repair_space>docFreq" ) ; } } Terms terms = MultiFields . getTerms ( r , "body" ) ; if ( terms != null ) { final TermsEnum termsEnum = terms . iterator ( ) ; BytesRef term ; int ord = 0 ; while ( ( term = termsEnum . next ( ) ) != null ) { if ( ord == 0 ) { try { termsEnum . ord ( ) ; } catch ( UnsupportedOperationException uoe ) { storeOrd = false ; } } final int output ; if ( storeOrd ) { output = ord ; } else { output = termsEnum . docFreq ( ) ; } builder . add ( term , outputs . get ( output ) ) ; ord ++ ; if ( ( ( ord % 100000 ) == 0 ) && ( LuceneTestCase . TEST_NIGHTLY ) ) { System . out . println ( ( ord + "<seq2seq4repair_space>terms..." ) ) ; } } final FST < Long > fst = builder . finish ( ) ; if ( VERBOSE ) { System . out . println ( ( ( ( ( ( ( ( ( ( ( ( "FST:<seq2seq4repair_space>" + docCount ) + "<seq2seq4repair_space>docs;<seq2seq4repair_space>" ) + ord ) + "<seq2seq4repair_space>terms;<seq2seq4repair_space>" ) + ( fst . getNodeCount ( ) ) ) + "<seq2seq4repair_space>nodes;<seq2seq4repair_space>" ) + ( fst . getArcCount ( ) ) ) + "<seq2seq4repair_space>arcs;"

Fix:
final LineFileDocs docs = new LineFileDocs ( random ) ;