Buggy code:
class TermInfosTest { public static void main ( String [ ] args ) { } public static void test ( ) throws Exception { File file = new File ( "words.txt" ) ; System . out . println ( ( ( "<seq2seq4repair_space>reading<seq2seq4repair_space>word<seq2seq4repair_space>file<seq2seq4repair_space>containing<seq2seq4repair_space>" + ( file . length ( ) ) ) + "<seq2seq4repair_space>bytes" ) ) ; Date start = new Date ( ) ; Vector keys = new Vector ( ) ; FileInputStream ws = new FileInputStream ( file ) ; BufferedReader wr = new BufferedReader ( new InputStreamReader ( ws ) ) ; for ( String key = wr . readLine ( ) ; key != null ; key = wr . readLine ( ) ) keys . addElement ( new Term ( "word" , key ) ) ; wr . close ( ) ; Date end = new Date ( ) ; System . out . print ( ( ( end . getTime ( ) ) - ( start . getTime ( ) ) ) ) ; System . out . println ( ( ( "<seq2seq4repair_space>milliseconds<seq2seq4repair_space>to<seq2seq4repair_space>read<seq2seq4repair_space>" + ( keys . size ( ) ) ) + "<seq2seq4repair_space>words" ) ) ; start = new Date ( ) ; Random gen = new Random ( 1251971 ) ; long fp = ( ( gen . nextInt ( ) ) & 15 ) + 1 ; long pp = ( ( gen . nextInt ( ) ) & 15 ) + 1 ; int [ ] docFreqs = new int [ keys . size ( ) ] ; long [ ] freqPointers = new long [ keys . size ( ) ] ; long [ ] proxPointers = new long [ keys . size ( ) ] ; for ( int i = 0 ; i < ( keys . size ( ) ) ; i ++ ) { docFreqs [ i ] = ( ( gen . nextInt ( ) ) & 15 ) + 1 ; freqPointers [ i ] = fp ; proxPointers [ i ] = pp ; fp += ( ( gen . nextInt ( ) ) & 15 ) + 1 ; pp += ( ( gen . nextInt ( ) ) & 15 ) + 1 ; } end = new Date ( ) ; System . out . print ( ( ( end . getTime ( ) ) - ( start . getTime ( ) ) ) ) ; System . out . println ( "<seq2seq4repair_space>milliseconds<seq2seq4repair_space>to<seq2seq4repair_space>generate<seq2seq4repair_space>values" ) ; start = new Date ( ) ; <START_BUG> Directory store = new FSDirectory ( "test.store" , true ) ; <END_BUG> FieldInfos fis = new FieldInfos ( ) ; TermInfosWriter writer = new TermInfosWriter ( store , "words" , fis ) ; fis . add ( "word" , false ) ; for ( int i = 0 ; i < ( keys . size ( ) ) ; i ++ ) writer . add ( ( ( Term ) ( keys . elementAt ( i ) ) ) , new TermInfo ( docFreqs [ i ] , freqPointers [ i ] , proxPointers [ i ] ) ) ; writer . close ( ) ; end = new Date ( ) ; System . out . print ( ( ( end . getTime ( ) ) - ( start . getTime ( ) ) ) ) ; System . out . println ( "<seq2seq4repair_space>milliseconds<seq2seq4repair_space>to<seq2seq4repair_space>write<seq2seq4repair_space>table" ) ; System . out . println ( ( ( "<seq2seq4repair_space>table<seq2seq4repair_space>occupies<seq2seq4repair_space>" + ( store . fileLength ( "words.tis" ) ) ) + "<seq2seq4repair_space>bytes" ) ) ; start = new Date ( ) ; TermInfosReader reader = new TermInfosReader ( store , "words" , fis ) ; end = new Date ( ) ; System . out . print ( ( ( end . getTime ( ) ) - ( start . getTime ( ) ) ) ) ; System . out . println ( "<seq2seq4repair_space>milliseconds<seq2seq4repair_space>to<seq2seq4repair_space>open<seq2seq4repair_space>table" ) ; start = new Date ( ) ; SegmentTermEnum = ( ( SegmentTermEnum ) ( reader . terms ( ) ) ) ; int i = 0 ; } }

Fix:
Directory store = FSDirectory . getDirectory ( "test.store" , true ) ;