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 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 { 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 ; 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 ( isEqual ( fElemMap [ elemIndex ] , curElem ) ) 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 ) ) { <START_BUG> if ( ( fElemMap [ elemIndex ] . uri ) == ( - 1 ) ) { <END_BUG> break ; } } else if ( type == ( XMLContentSpec . CONTENTSPECNODE_ANY_OTHER ) ) { if ( ( fElemMap [ elemIndex ] . uri ) != ( curElem . uri ) ) { break ; } } } if ( elemIndex == ( fElemMapSize ) ) { if ( DFAContentModel . DEBUG_VALIDATE_CONTENT ) { 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 ] ) ) ) ; } } 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 ; } private boolean isEqual ( QName name1 , QName name2 ) { } 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 ( ( curElem . uri ) == ( - 1 ) ) {