Buggy code:
continue ; } if ( ( wtag . isOpen ( ) ) && ( wtag . isMajorWicketComponentTag ( ) ) ) { wicketHeadProcessed = true ; copyWicketHead ( markup , extendIndex ) ; } } } if ( wicketHeadProcessed == false ) { if ( ( tag . isOpen ( ) ) && ( TagUtils . isHeadTag ( tag ) ) ) { foundHeadTag = true ; } if ( ( ( tag . isClose ( ) ) && ( TagUtils . isHeadTag ( tag ) ) ) || ( ( tag . isOpen ( ) ) && ( TagUtils . isBodyTag ( tag ) ) ) ) { wicketHeadProcessed = true ; copyWicketHead ( markup , extendIndex ) ; } } addMarkupElement ( element ) ; } if ( baseIndex == ( baseMarkup . size ( ) ) ) { throw new org . apache . wicket . WicketRuntimeException ( ( "Expected<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space><wicket:child//><seq2seq4repair_space>in<seq2seq4repair_space>base<seq2seq4repair_space>markup:<seq2seq4repair_space>" + ( baseMarkup . toString ( ) ) ) ) ; } for ( ; extendIndex < ( markup . size ( ) ) ; extendIndex ++ ) { MarkupElement element = markup . get ( extendIndex ) ; addMarkupElement ( element ) ; if ( element instanceof WicketTag ) { WicketTag wtag = ( ( WicketTag ) ( element ) ) ; if ( ( wtag . isExtendTag ( ) ) && ( wtag . isClose ( ) ) ) { break ; } } } if ( extendIndex == ( markup . size ( ) ) ) { throw new org . apache . wicket . WicketRuntimeException ( ( "Missing<seq2seq4repair_space>close<seq2seq4repair_space>tag<seq2seq4repair_space><//wicket:extend><seq2seq4repair_space>in<seq2seq4repair_space>derived<seq2seq4repair_space>markup:<seq2seq4repair_space>" + ( markup . toString ( ) ) ) ) ; } if ( ( ( ComponentTag ) ( baseMarkup . get ( baseIndex ) ) ) . isOpen ( ) ) { for ( baseIndex ++ ; baseIndex < ( baseMarkup . size ( ) ) ; baseIndex ++ ) { MarkupElement element = baseMarkup . get ( baseIndex ) ; if ( element instanceof WicketTag ) { WicketTag tag = ( ( WicketTag ) ( element ) ) ; if ( ( tag . isChildTag ( ) ) && ( tag . isClose ( ) ) ) { tag . setMarkupClass ( baseMarkup . getMarkupResourceStream ( ) . getMarkupClass ( ) ) ; addMarkupElement ( tag ) ; break ; } else { throw new org . apache . wicket . WicketRuntimeException ( ( "Wicket<seq2seq4repair_space>tags<seq2seq4repair_space>like<seq2seq4repair_space><wicket:xxx><seq2seq4repair_space>are<seq2seq4repair_space>not<seq2seq4repair_space>allowed<seq2seq4repair_space>in<seq2seq4repair_space>between<seq2seq4repair_space><wicket:child><seq2seq4repair_space>and<seq2seq4repair_space><//wicket:child><seq2seq4repair_space>tags:<seq2seq4repair_space>" + ( markup . toString ( ) ) ) ) ; } } else if ( element instanceof ComponentTag ) { throw new org . apache . wicket . WicketRuntimeException ( ( "Wicket<seq2seq4repair_space>tags<seq2seq4repair_space>identified<seq2seq4repair_space>by<seq2seq4repair_space>wicket:id<seq2seq4repair_space>are<seq2seq4repair_space>not<seq2seq4repair_space>allowed<seq2seq4repair_space>in<seq2seq4repair_space>between<seq2seq4repair_space><wicket:child><seq2seq4repair_space>and<seq2seq4repair_space><//wicket:child><seq2seq4repair_space>tags:<seq2seq4repair_space>" + ( markup . toString ( ) ) ) ) ; } } if ( baseIndex == ( baseMarkup . size ( ) ) ) { throw new org . apache . wicket . WicketRuntimeException ( ( "Expected<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space><//wicket:child><seq2seq4repair_space>in<seq2seq4repair_space>base<seq2seq4repair_space>markup:<seq2seq4repair_space>" + ( baseMarkup . toString ( ) ) ) ) ; } } else { WicketTag childCloseTag = ( ( WicketTag ) ( childTag . mutable ( ) ) ) ; childCloseTag . getXmlTag ( ) . setType ( CLOSE ) ; childCloseTag . setMarkupClass ( baseMarkup . getMarkupResourceStream ( ) . getMarkupClass ( ) ) ; addMarkupElement ( childCloseTag ) ; } for ( baseIndex ++ ; baseIndex < ( baseMarkup . size ( ) ) ; baseIndex ++ ) { MarkupElement element = baseMarkup . get ( baseIndex ) ; addMarkupElement ( element ) ; if ( ( element instanceof ComponentTag ) && ( ( baseMarkup . getMarkupResourceStream ( ) . getResource ( ) ) != null ) ) { ComponentTag tag = ( ( ComponentTag ) ( element ) ) ; tag . setMarkupClass ( baseMarkup . getMarkupResourceStream ( ) . getMarkupClass ( ) ) ; } } if ( Page . class . isAssignableFrom ( markup . getMarkupResourceStream ( ) . getMarkupClass ( ) ) ) { int hasOpenWicketHead = - 1 ; int hasCloseWicketHead = - 1 ; int hasHead = - 1 ; for ( int i = 0 ; i < ( size ( ) ) ; i ++ ) { MarkupElement element = get ( i ) ; if ( ( ( hasOpenWicketHead == ( - 1 ) ) && ( element instanceof WicketTag ) ) && ( ( ( WicketTag ) ( element ) ) . isHeadTag ( ) ) ) { hasOpenWicketHead = i ; } else if ( ( ( element instanceof WicketTag ) && ( ( ( WicketTag ) ( element ) ) . isHeadTag ( ) ) ) && ( ( ( WicketTag ) ( element ) ) . isClose ( ) ) ) { hasCloseWicketHead = i ; } else <START_BUG> if ( ( ( hasHead == ( - 1 ) ) && ( element instanceof ComponentTag ) ) && ( TagUtils . isHeadTag ( ( ( ComponentTag ) ( element ) ) ) ) ) { <END_BUG> hasHead = i ; } else if ( ( hasHead != ( - 1 ) ) && ( hasOpenWicketHead != ( - 1 ) ) ) { break ; } } if ( ( hasOpenWicketHead != ( - 1 ) ) && ( hasHead == ( - 1 ) ) ) { final XmlTag headOpenTag = new XmlTag ( ) ; headOpenTag . setName ( "head" ) ; headOpenTag . setType ( OPEN ) ; final ComponentTag openTag = new ComponentTag ( headOpenTag ) ; openTag . setId ( HEADER_ID ) ; openTag . setAutoComponentTag ( true ) ; final XmlTag headCloseTag = new XmlTag ( ) ; headCloseTag . setName ( headOpenTag . getName ( ) ) ; headCloseTag . setType ( CLOSE ) ; final ComponentTag closeTag = new ComponentTag ( headCloseTag ) ; closeTag . setOpenTag ( openTag ) ; closeTag . setId ( HEADER_ID ) ; addMarkupElement ( hasOpenWicketHead , openTag ) ; addMarkupElement ( ( hasCloseWicketHead + 2 ) , closeTag ) ; } } } private void copyWicketHead ( final IMarkupFragment markup , int extendIndex ) { } }

Fix:
if ( ( ( hasHead == ( - 1 ) ) && ( element instanceof ComponentTag ) ) && ( TagUtils . isHeadTag ( element ) ) ) {