Buggy code:
long termval = parser . parseLong ( term . text ( ) ) ; if ( retArray == null ) retArray = new long [ reader . maxDoc ( ) ] ; termDocs . seek ( termEnum ) ; while ( termDocs . next ( ) ) { retArray [ termDocs . doc ( ) ] = termval ; } } while ( termEnum . next ( ) ) ; } catch ( FieldCacheImpl . StopFillCacheException stop ) { } finally { termDocs . close ( ) ; termEnum . close ( ) ; } if ( retArray == null ) retArray = new long [ reader . maxDoc ( ) ] ; return retArray ; } } public double [ ] getDoubles ( IndexReader reader , String field ) throws IOException { } public double [ ] getDoubles ( IndexReader reader , String field , FieldCache . DoubleParser parser ) throws IOException { } static final class DoubleCache extends FieldCacheImpl . Cache { DoubleCache ( FieldCache wrapper ) { } @ Override protected Object createValue ( IndexReader reader , FieldCacheImpl . Entry entryKey ) throws IOException { FieldCacheImpl . Entry entry = entryKey ; String field = entry . field ; FieldCache . DoubleParser parser = ( ( FieldCache . DoubleParser ) ( entry . custom ) ) ; if ( parser == null ) { try { return wrapper . getDoubles ( reader , field , DEFAULT_DOUBLE_PARSER ) ; } catch ( NumberFormatException ne ) { return wrapper . getDoubles ( reader , field , NUMERIC_UTILS_DOUBLE_PARSER ) ; } } double [ ] retArray = null ; TermDocs termDocs = reader . termDocs ( ) ; TermEnum termEnum = reader . terms ( new Term ( field ) ) ; try { do { Term term = termEnum . term ( ) ; if ( ( term == null ) || ( ( term . field ( ) ) != field ) ) break ; double termval = parser . parseDouble ( term . text ( ) ) ; if ( retArray == null ) retArray = new double [ reader . maxDoc ( ) ] ; termDocs . seek ( termEnum ) ; while ( termDocs . next ( ) ) { retArray [ termDocs . doc ( ) ] = termval ; } } while ( termEnum . next ( ) ) ; } catch ( FieldCacheImpl . StopFillCacheException stop ) { } finally { termDocs . close ( ) ; termEnum . close ( ) ; } if ( retArray == null ) retArray = new double [ reader . maxDoc ( ) ] ; return retArray ; } } public String [ ] getStrings ( IndexReader reader , String field ) throws IOException { } static final class StringCache extends FieldCacheImpl . Cache { StringCache ( FieldCache wrapper ) { } @ Override protected Object createValue ( IndexReader reader , FieldCacheImpl . Entry entryKey ) throws IOException { String field = StringHelper . intern ( entryKey . field ) ; final String [ ] retArray = new String [ reader . maxDoc ( ) ] ; TermDocs termDocs = reader . termDocs ( ) ; TermEnum termEnum = reader . terms ( new Term ( field ) ) ; try { do { Term term = termEnum . term ( ) ; if ( ( term == null ) || ( ( term . field ( ) ) != field ) ) break ; String termval = term . text ( ) ; termDocs . seek ( termEnum ) ; while ( termDocs . next ( ) ) { retArray [ termDocs . doc ( ) ] = termval ; } } while ( termEnum . next ( ) ) ; } finally { termDocs . close ( ) ; termEnum . close ( ) ; } return retArray ; } } public StringIndex getStringIndex ( IndexReader reader , String field ) throws IOException { } static final class StringIndexCache extends FieldCacheImpl . Cache { StringIndexCache ( FieldCache wrapper ) { } @ Override protected Object createValue ( IndexReader reader , FieldCacheImpl . Entry entryKey ) throws IOException { String field = StringHelper . intern ( entryKey . field ) ; final int [ ] retArray = new int [ reader . maxDoc ( ) ] ; String [ ] mterms = new String [ ( reader . maxDoc ( ) ) + 1 ] ; TermDocs termDocs = reader . termDocs ( ) ; TermEnum termEnum = reader . terms ( new Term ( field ) ) ; int t = 0 ; mterms [ ( t ++ ) ] = null ; try { do { Term term = termEnum . term ( ) ; <START_BUG> if ( ( term == null ) || ( ( term . field ( ) ) != field ) ) <END_BUG> break ; mterms [ t ] = term . text ( ) ; termDocs . seek ( termEnum ) ; while ( termDocs . next ( ) ) { retArray [ termDocs . doc ( ) ] = t ; } t ++ ; } while ( termEnum . next ( ) ) ; } finally { termDocs . close ( ) ; termEnum . close ( ) ; } if ( t == 0 ) { mterms = new String [ 1 ] ; } else if ( t < ( mterms . length ) ) { String [ ] terms = new String [ t ] ; System . arraycopy ( mterms , 0 , terms , 0 , t ) ; mterms = terms ; } StringIndex value = new StringIndex ( retArray , mterms ) ; return value ; } } private volatile PrintStream infoStream ; public void setInfoStream ( PrintStream stream ) { } public PrintStream getInfoStream ( ) { } }

Fix:
if ( ( ( term == null ) || ( ( term . field ( ) ) != field ) ) || ( t >= ( mterms . length ) ) )