Buggy code:
private void init ( XMLEntityHandler entityHandler , XMLErrorReporter errorReporter , boolean sendCharDataAsCharArray , int lineNumber , int columnNumber , int stringHandle , StringPool stringPool , boolean addEnclosingSpaces ) { } public int addString ( int offset , int length ) { } public int addSymbol ( int offset , int length ) { } public void append ( XMLEntityHandler . CharBuffer charBuffer , int offset , int length ) { } private int loadNextChar ( ) { } public EntityReader changeReaders ( ) throws Exception { } public boolean lookingAtChar ( char chr , boolean skipPastChar ) throws Exception { } public boolean lookingAtValidChar ( boolean skipPastChar ) throws Exception { } public boolean lookingAtSpace ( boolean skipPastChar ) throws Exception { } public void skipToChar ( char chr ) throws Exception { } public void skipPastSpaces ( ) throws Exception { } public void skipPastName ( char fastcheck ) throws Exception { } public void skipPastNmtoken ( char fastcheck ) throws Exception { } public boolean skippedString ( char [ ] s ) throws Exception { } public int scanInvalidChar ( ) throws Exception { } public int scanCharRef ( boolean hex ) throws Exception { } public int scanStringLiteral ( ) throws Exception { } public int scanAttValue ( char qchar , boolean asSymbol ) throws Exception { } public static final byte [ ] fgAsciiEntityValueChar = new byte [ ] { 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 0 , 0 , 4 , 4 , 0 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 0 , 0 , 1 , 0 , 0 , 3 , 2 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ; public int scanEntityValue ( int qchar , boolean createString ) throws Exception { } public boolean scanExpectedName ( char fastcheck , StringPool . CharArrayRange expectedName ) throws Exception { } public void scanQName ( char fastcheck , QName qname ) throws Exception { int ch = fMostRecentChar ; if ( ch == ( - 1 ) ) { changeReaders ( ) . scanQName ( fastcheck , qname ) ; return ; } if ( ! ( fCalledCharPropInit ) ) { XMLCharacterProperties . initCharFlags ( ) ; fCalledCharPropInit = true ; } int nameOffset = fCurrentOffset ; if ( ( ( XMLCharacterProperties . fgCharFlags [ ch ] ) & ( XMLCharacterProperties . E_InitialNameCharFlag ) ) == 0 ) { qname . clear ( ) ; return ; } while ( true ) { ch = loadNextChar ( ) ; if ( fastcheck == ch ) break ; if ( ch == ( - 1 ) ) break ; if ( ( ( XMLCharacterProperties . fgCharFlags [ ch ] ) & ( XMLCharacterProperties . E_NameCharFlag ) ) == 0 ) break ; } qname . clear ( ) ; qname . rawname = fStringPool . addSymbol ( fData . substring ( nameOffset , fCurrentOffset ) ) ; int index = fData . indexOf ( ':' , nameOffset ) ; if ( index != ( - 1 ) ) { qname . prefix = fStringPool . addSymbol ( fData . substring ( nameOffset , index ) ) ; int indexOfSpaceChar = fData . indexOf ( '<seq2seq4repair_space>' , ( index + 1 ) ) ; String localPart ; if ( indexOfSpaceChar != ( - 1 ) ) { localPart = fData . substring ( ( index + 1 ) , indexOfSpaceChar ) ; qname . localpart = fStringPool . addSymbol ( localPart ) ; } else { int lenfData = fData . length ( ) ; <START_BUG> localPart = fData . substring ( ( index + 1 ) , fData . length ) ; <END_BUG> qname . localpart = fStringPool . addSymbol ( localPart ) ; } qname . localpart = fStringPool . addSymbol ( localPart ) ; } else { qname . localpart = qname . rawname ; } } public int scanName ( char fastcheck ) throws Exception { } private int recognizeMarkup ( int ch ) throws Exception { } private int recognizeReference ( int ch ) throws Exception { } public int scanContent ( QName element ) throws Exception { } private void callCharDataHandler ( int offset , int endOffset , boolean isWhitespace ) throws Exception { } private static final char [ ] cdata_string = new char [ ] { 'C' , 'D' , 'A' , 'T' , 'A' , '[' } ; private StringPool fStringPool = null ; private String fData = null ; private int fEndOffset ; private boolean hadTrailingSpace = false ; private boolean oweTrailingSpace = false ; private int fMostRecentChar ; private StringReader fNextFreeReader = null ; private static StringReader fgFreeReaders = null ; private boolean fCalledCharPropInit = false ; }

Fix:
localPart = fData . substring ( ( index + 1 ) , lenfData ) ;