Buggy code:
static IntsRef toIntsRefUTF32 ( String s , IntsRef ir ) { } 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 ; final boolean doReverseLookup ; public FSTTester ( Random random , Directory dir , int inputMode , List < TestFSTs . FSTTester . InputOutput < T > > pairs , Outputs < T > outputs , boolean doReverseLookup ) { } 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 , boolean allowRandomSuffixSharing ) 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 { } String inputModeToString ( int mode ) { } private void testRandomWords ( int maxNumWords , int numIter ) throws IOException { } static String getRandomString ( ) { } @ Nightly public void testBigSet ( ) throws IOException { } static String inputToString ( int inputMode , IntsRef term ) { } private static String inputToString ( int inputMode , IntsRef term , boolean isValidUnicode ) { } public void testRealTerms ( ) throws Exception { final String defaultFormat = _TestUtil . getPostingsFormat ( "abracadabra" ) ; if ( ( defaultFormat . equals ( "SimpleText" ) ) || ( defaultFormat . equals ( "Memory" ) ) ) { Codec . setDefault ( _TestUtil . alwaysPostingsFormat ( new Lucene40PostingsFormat ( ) ) ) ; } <START_BUG> final LineFileDocs docs = new LineFileDocs ( random ) ; <END_BUG> final int RUN_TIME_MSEC = atLeast ( 500 ) ; final IndexWriterConfig conf = newIndexWriterConfig ( TEST_VERSION_CURRENT , new org . apache . lucene . analysis . MockAnalyzer ( random ) ) . setMaxBufferedDocs ( ( - 1 ) ) . setRAMBufferSizeMB ( 64 ) ; final File tempDir = _TestUtil . getTempDir ( "fstlines" ) ; final MockDirectoryWrapper dir = newFSDirectory ( tempDir ) ; final IndexWriter writer = new IndexWriter ( dir , conf ) ; final long stopTime = ( System . currentTimeMillis ( ) ) + RUN_TIME_MSEC ; Document doc ; int docCount = 0 ; while ( ( ( doc = docs . nextDoc ( ) ) != null ) && ( ( System . currentTimeMillis ( ) ) < stopTime ) ) { writer . addDocument ( doc ) ; docCount ++ ; } IndexReader r = IndexReader . open ( writer , true ) ; writer . close ( ) ; final PositiveIntOutputs outputs = PositiveIntOutputs . getSingleton ( random . nextBoolean ( ) ) ; final boolean doRewrite = random . nextBoolean ( ) ; Builder < Long > builder = new Builder < Long > ( INPUT_TYPE . BYTE1 , 0 , 0 , true , true , Integer . MAX_VALUE , outputs , null , doRewrite ) ; 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 IntsRef scratchIntsRef = new IntsRef ( ) ; final TermsEnum termsEnum = terms . iterator ( null ) ; if ( VERBOSE ) { System . out . println ( ( "TEST:<seq2seq4repair_space>got<seq2seq4repair_space>termsEnum=" + termsEnum ) ) ; } BytesRef term ; int ord = 0 ; while ( ( term = termsEnum . next ( ) ) != null ) { if ( ord == 0 ) { try { termsEnum . ord ( ) ; } catch ( UnsupportedOperationException uoe ) { if ( VERBOSE ) { System . out . println ( "TEST:<seq2seq4repair_space>codec<seq2seq4repair_space>doesn't<seq2seq4repair_space>support<seq2seq4repair_space>ord;<seq2seq4repair_space>FST<seq2seq4repair_space>stores<seq2seq4repair_space>docFreq" ) ; } storeOrd = false ; } } final int output ; if ( storeOrd ) { output = ord ; } else { output = termsEnum . docFreq ( ) ; } builder . add ( Util . toIntsRef ( term , scratchIntsRef ) , ( ( long ) ( output ) ) ) ; ord ++ ; if ( ( ( VERBOSE ) && ( ( ord % 100000 ) == 0 ) ) && ( LuceneTestCase . TEST_NIGHTLY ) ) { System . out . println ( ( ord + "<seq2seq4repair_space>terms..." ) ) ; } } 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 , defaultCodecSupportsDocValues ( ) ) ;