Buggy code:
public class DFAContentModel implements XMLContentModel { private static final int EPSILON = - 2 ; private static final int EOC = - 3 ; private static final boolean DEBUG_VALIDATE_CONTENT = false ; private EquivClassComparator comparator = null ; private QName [ ] fElemMap = null ; private int [ ] fElemMapType = null ; private int fElemMapSize = 0 ; 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 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 int validateContent ( QName [ ] children , int offset , int length ) throws CMException { } private boolean isEqual ( QName name1 , QName name2 ) { } public int validateContentSpecial ( QName [ ] children , int offset , int length ) throws Exception { if ( DFAContentModel . DEBUG_VALIDATE_CONTENT ) System . out . println ( "DFAContentModel#validateContentSpecial" ) ; if ( ( comparator ) == null ) { return validateContent ( children , offset , length ) ; } 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 ; for ( int childIndex = 0 ; childIndex < length ; childIndex ++ ) { final QName curElem = children [ ( offset + childIndex ) ] ; int elemIndex = 0 ; for ( ; elemIndex < ( fElemMapSize ) ; elemIndex ++ ) { int type = fElemMapType [ elemIndex ] ; if ( type == ( XMLContentSpec . CONTENTSPECNODE_LEAF ) ) { if ( comparator . isEquivalentTo ( curElem , fElemMap [ elemIndex ] ) ) break ; } else if ( type == ( XMLContentSpec . CONTENTSPECNODE_ANY ) ) { int uri = fElemMap [ elemIndex ] . uri ; if ( ( uri == ( - 1 ) ) || ( uri == ( curElem . uri ) ) ) { break ; } } else if ( type == ( XMLContentSpec . CONTENTSPECNODE_ANY_LOCAL ) ) { if ( ( curElem . uri ) == ( - 1 ) ) { break ; } } else if ( type == ( XMLContentSpec . CONTENTSPECNODE_ANY_OTHER ) ) { if ( ( fElemMap [ elemIndex ] . uri ) != ( curElem . uri ) ) { break ; } } } if ( elemIndex == ( fElemMapSize ) ) { <START_BUG> if ( ! ( DFAContentModel . DEBUG_VALIDATE_CONTENT ) ) { <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 = fTransTable [ curState ] [ elemIndex ] ; if ( curState == ( - 1 ) ) { if ( DFAContentModel . DEBUG_VALIDATE_CONTENT ) System . out . println ( "!!!<seq2seq4repair_space>not<seq2seq4repair_space>a<seq2seq4repair_space>legal<seq2seq4repair_space>transition" ) ; return childIndex ; } } if ( DFAContentModel . DEBUG_VALIDATE_CONTENT ) System . out . println ( ( ( ( "curState=" + curState ) + ",<seq2seq4repair_space>childCount=" ) + length ) ) ; if ( ! ( fFinalStateFlags [ curState ] ) ) return length ; return - 1 ; } public void setEquivClassComparator ( EquivClassComparator comparator ) { } public int whatCanGoHere ( boolean fullyValid , InsertableElementsInfo info ) throws CMException { } 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 ) {