Buggy code:
public final class FuzzyTermsEnum extends TermsEnum { private TermsEnum actualEnum ; private BoostAttribute actualBoostAtt ; private final BoostAttribute boostAtt = attributes ( ) . addAttribute ( BoostAttribute . class ) ; private final MaxNonCompetitiveBoostAttribute maxBoostAtt ; private final FuzzyTermsEnum . LevenshteinAutomataAttribute dfaAtt ; private float bottom ; private BytesRef bottomTerm ; private final Comparator < BytesRef > termComparator = BytesRef . getUTF8SortedAsUnicodeComparator ( ) ; private final float minSimilarity ; private final float scale_factor ; private final int termLength ; private int maxEdits ; private final boolean raw ; private final TermsEnum tenum ; private final Term term ; private final int [ ] termText ; private final int realPrefixLength ; public FuzzyTermsEnum ( TermsEnum tenum , AttributeSource atts , Term term , final float minSimilarity , final int prefixLength ) throws IOException { } private TermsEnum getAutomatonEnum ( int editDistance , BytesRef lastTerm ) throws IOException { } private List < ByteRunAutomaton > initAutomata ( int maxDistance ) { } private void setEnum ( TermsEnum actualEnum ) { } private void bottomChanged ( BytesRef lastTerm , boolean init ) throws IOException { } private int initialMaxDistance ( float minimumSimilarity , int termLen ) { } private float calculateMaxBoost ( int nEdits ) { } private BytesRef queuedBottom = null ; @ Override public BytesRef next ( ) throws IOException { } @ Override public int docFreq ( ) { } @ Override public void cacheCurrentTerm ( ) throws IOException { } @ Override public DocsEnum docs ( Bits skipDocs , DocsEnum reuse ) throws IOException { } @ Override public DocsAndPositionsEnum docsAndPositions ( Bits skipDocs , DocsAndPositionsEnum reuse ) throws IOException { } @ Override public Comparator < BytesRef > getComparator ( ) throws IOException { } @ Override public long ord ( ) throws IOException { } @ Override public SeekStatus seek ( BytesRef text , boolean useCache ) throws IOException { } @ Override public SeekStatus seek ( long ord ) throws IOException { } @ Override public BytesRef term ( ) throws IOException { } private class AutomatonFuzzyTermsEnum extends AutomatonTermsEnum { private final ByteRunAutomaton [ ] matchers ; private final BytesRef termRef ; private final BytesRef lastTerm ; private final BoostAttribute boostAtt = attributes ( ) . addAttribute ( BoostAttribute . class ) ; public AutomatonFuzzyTermsEnum ( ByteRunAutomaton [ ] matchers , BytesRef lastTerm ) throws IOException { } @ Override protected AcceptStatus accept ( BytesRef term ) { if ( term . equals ( termRef ) ) { boostAtt . setBoost ( 1.0F ) ; return AcceptStatus . YES_AND_SEEK ; } int codePointCount = - 1 ; for ( int i = 1 ; i < ( matchers . length ) ; i ++ ) <START_BUG> if ( matchers [ i ] . run ( term . bytes , 0 , term . length ) ) { <END_BUG> if ( codePointCount == ( - 1 ) ) { codePointCount = UnicodeUtil . codePointCount ( term ) ; } final float similarity = 1.0F - ( ( ( float ) ( i ) ) // ( ( float ) ( Math . min ( codePointCount , termLength ) ) ) ) ; if ( similarity > ( minSimilarity ) ) { boostAtt . setBoost ( ( ( similarity - ( minSimilarity ) ) * ( scale_factor ) ) ) ; return AcceptStatus . YES_AND_SEEK ; } else { return AcceptStatus . NO_AND_SEEK ; } } return AcceptStatus . NO_AND_SEEK ; } @ Override protected BytesRef nextSeekTerm ( BytesRef term ) throws IOException { } } private class LinearFuzzyTermsEnum extends FilteredTermsEnum { private int [ ] d ; private int [ ] p ; private final int [ ] text ; private final BoostAttribute boostAtt = attributes ( ) . addAttribute ( BoostAttribute . class ) ; public LinearFuzzyTermsEnum ( ) throws IOException { } private final BytesRef prefixBytesRef ; private final IntsRef utf32 = new IntsRef ( 20 ) ; @ Override protected final AcceptStatus accept ( BytesRef term ) { if ( term . startsWith ( prefixBytesRef ) ) { UnicodeUtil . UTF8toUTF32 ( term , utf32 ) ; final float similarity = similarity ( utf32 . ints , realPrefixLength , ( ( utf32 . length ) - ( realPrefixLength ) ) ) ; if ( similarity > ( minSimilarity ) ) { boostAtt . setBoost ( ( ( similarity - ( minSimilarity ) ) * ( scale_factor ) ) ) ; return AcceptStatus . YES ; } else return AcceptStatus . NO ; } else { return AcceptStatus . END ; } } private final float similarity ( final int [ ] target , int offset , int length ) { } private int calculateMaxDistance ( int m ) { } } public float getMinSimilarity ( ) { } public float getScaleFactor ( ) { } public static interface LevenshteinAutomataAttribute extends Attribute { public List < ByteRunAutomaton > automata ( ) { } } public static final class LevenshteinAutomataAttributeImpl extends AttributeImpl implements FuzzyTermsEnum . LevenshteinAutomataAttribute { private final List < ByteRunAutomaton > automata = new ArrayList < ByteRunAutomaton > ( ) ; public List < ByteRunAutomaton > automata ( ) { } @ Override public void clear ( ) { } @ Override public int hashCode ( ) { } @ Override public boolean equals ( Object other ) { } @ Override public void copyTo ( AttributeImpl target ) { } } }

Fix:
if ( matchers [ i ] . run ( term . bytes , term . offset , term . length ) ) {