Buggy code:
private static final int EOC = - 3 ; private static final boolean DEBUG_VALIDATE_CONTENT = false ; private SubstitutionGroupComparator comparator = null ; private QName [ ] fElemMap = null ; private int [ ] fElemMapType = null ; private int fElemMapSize = 0 ; private boolean fDTD ; private int fEOCIndex = 0 ; private int fEOCPos = 0 ; private int fEpsilonIndex = 0 ; private boolean [ ] fFinalStateFlags = null ; private CMStateSet [ ] fFollowList = null ; private CMNode fHeadNode = null ; private int fLeafCount = 0 ; private CMLeaf [ ] fLeafList = null ; private int [ ] fLeafListType = null ; private ContentLeafNameTypeVector fLeafNameTypeVector = null ; private int [ ] [ ] fTransTable = null ; private int fTransTableSize = 0 ; private boolean fEmptyContentIsValid = false ; private QName fQName = new QName ( ) ; public DFAContentModel ( CMNode syntaxTree , int leafCount ) throws CMException { } public DFAContentModel ( CMNode syntaxTree , int leafCount , boolean dtd ) throws CMException { } private static long time = 0 ; public int validateContent ( QName [ ] children , int offset , int length ) throws CMException { if ( DFAContentModel . DEBUG_VALIDATE_CONTENT ) System . out . println ( "DFAContentModel#validateContent" ) ; if ( length == 0 ) { if ( DFAContentModel . DEBUG_VALIDATE_CONTENT ) { System . out . println ( "!!!<seq2seq4repair_space>no<seq2seq4repair_space>children" ) ; System . out . println ( ( "elemMap=" + ( fElemMap ) ) ) ; for ( int i = 0 ; i < ( fElemMap . length ) ; i ++ ) { int uriIndex = fElemMap [ i ] . uri ; int localpartIndex = fElemMap [ i ] . localpart ; } System . out . println ( ( "EOCIndex=" + ( fEOCIndex ) ) ) ; } return fEmptyContentIsValid ? - 1 : 0 ; } int curState = 0 ; int nextState = 0 ; for ( int childIndex = 0 ; childIndex < length ; childIndex ++ ) { final QName curElem = children [ ( offset + childIndex ) ] ; int elemIndex = 0 ; for ( ; elemIndex < ( fElemMapSize ) ; elemIndex ++ ) { if ( fDTD ) { if ( ( fElemMap [ elemIndex ] . rawname ) == ( curElem . rawname ) ) { nextState = fTransTable [ curState ] [ elemIndex ] ; if ( nextState != ( - 1 ) ) break ; } } else { int type = ( fElemMapType [ elemIndex ] ) & 15 ; if ( type == ( XMLContentSpec . CONTENTSPECNODE_LEAF ) ) { if ( ( ( fElemMap [ elemIndex ] . uri ) == ( curElem . uri ) ) && ( ( fElemMap [ elemIndex ] . localpart ) == ( curElem . localpart ) ) ) { nextState = fTransTable [ curState ] [ elemIndex ] ; if ( nextState != ( - 1 ) ) break ; } } else if ( type == ( XMLContentSpec . CONTENTSPECNODE_ANY ) ) { int uri = fElemMap [ elemIndex ] . uri ; if ( ( uri == ( - 1 ) ) || ( uri == ( curElem . uri ) ) ) { nextState = fTransTable [ curState ] [ elemIndex ] ; if ( nextState != ( - 1 ) ) break ; } } else if ( type == ( XMLContentSpec . CONTENTSPECNODE_ANY_LOCAL ) ) { if ( ( curElem . uri ) == ( - 1 ) ) { nextState = fTransTable [ curState ] [ elemIndex ] ; if ( nextState != ( - 1 ) ) break ; } } else if ( type == ( XMLContentSpec . CONTENTSPECNODE_ANY_OTHER ) ) { if ( ( fElemMap [ elemIndex ] . uri ) != ( curElem . uri ) ) { nextState = fTransTable [ curState ] [ elemIndex ] ; if ( nextState != ( - 1 ) ) break ; } } } } if ( nextState == ( - 1 ) ) { if ( DFAContentModel . DEBUG_VALIDATE_CONTENT ) System . out . println ( "!!!<seq2seq4repair_space>not<seq2seq4repair_space>a<seq2seq4repair_space>legal<seq2seq4repair_space>transition" ) ; return childIndex ; } if ( elemIndex == ( fElemMapSize ) ) { <START_BUG> if ( true ) { <END_BUG> System . out . println ( "!!!<seq2seq4repair_space>didn't<seq2seq4repair_space>find<seq2seq4repair_space>it" ) ; System . out . println ( ( "curElem<seq2seq4repair_space>:<seq2seq4repair_space>" + curElem ) ) ; for ( int i = 0 ; i < ( fElemMapSize ) ; i ++ ) { System . out . println ( ( ( ( "fElemMap[" + i ) + "]<seq2seq4repair_space>=<seq2seq4repair_space>" ) + ( fElemMap [ i ] ) ) ) ; System . out . println ( ( ( ( "fElemMapType[" + i ) + "]<seq2seq4repair_space>=<seq2seq4repair_space>" ) + ( fElemMapType [ i ] ) ) ) ; } } return childIndex ; } curState = nextState ; nextState = 0 ; } if ( DFAContentModel . DEBUG_VALIDATE_CONTENT ) System . out . println ( ( ( ( "curState=" + curState ) + ",<seq2seq4repair_space>childCount=" ) + length ) ) ; if ( ! ( fFinalStateFlags [ curState ] ) ) return length ; return - 1 ; } private boolean isEqual ( QName name1 , QName name2 ) { } public int validateContentSpecial ( QName [ ] children , int offset , int length ) throws Exception { } public void setSubstitutionGroupComparator ( SubstitutionGroupComparator comparator ) { } public int whatCanGoHere ( boolean fullyValid , InsertableElementsInfo info ) throws CMException { } public ContentLeafNameTypeVector getContentLeafNameTypeVector ( ) { } private void buildDFA ( CMNode syntaxTree ) throws CMException { } private void calcFollowList ( CMNode nodeCur ) throws CMException { } private void dumpTree ( CMNode nodeCur , int level ) throws CMException { } private int [ ] makeDefStateList ( ) { } private int postTreeBuildInit ( CMNode nodeCur , int curIndex ) throws CMException { } }

Fix:
if ( DFAContentModel . DEBUG_VALIDATE_CONTENT ) {