Buggy code:
public abstract class Container extends Component { private static final Map markupCache = new HashMap ( ) ; private static final int MINIMAP_MAX_ENTRIES = 8 ; private static final boolean optimizeChildMapsForSpace = false ; private static final Log log = LogFactory . getLog ( Container . class ) ; private Map childForName ; private transient MarkupStream markupStream ; public Container ( final String name ) { } public Container ( String name , IModel model ) { } public Container ( String name , IModel model , String expression ) { } public Container ( String name , Serializable object ) { } public Container ( String name , Serializable object , String expression ) { } private void optimize ( ) { } public Container add ( final Component child ) { } public final Component get ( final String path ) { } public final int size ( ) { } public String toString ( ) { } protected final MarkupStream findMarkupStream ( ) { } protected final MarkupStream getMarkupStream ( ) { } protected String getMarkupType ( ) { } protected void handleBody ( final RequestCycle cycle , final MarkupStream markupStream , final ComponentTag openTag ) { } protected void handleRender ( final RequestCycle cycle ) { } protected final Iterator iterator ( ) { } public void removeAll ( ) { } protected final void renderAssociatedMarkup ( final RequestCycle cycle , final String openTagName , final String exceptionMessage ) { } protected final void renderBody ( final RequestCycle cycle , final MarkupStream markupStream , final ComponentTag openTag ) { } protected final void setMarkupStream ( final MarkupStream markupStream ) { } public final Object visitChildren ( final Class c , final IVisitor visitor ) { } public final Object visitChildren ( final IVisitor visitor ) { } final MarkupStream getAssociatedMarkupStream ( ) { } final void renderAll ( final RequestCycle cycle , final MarkupStream markupStream ) { } private Markup loadMarkupAndWatchForChanges ( final String key , final Resource markupResource ) { } private Markup loadMarkup ( final ApplicationSettings settings , final String key , final Resource markupResource ) throws IOException , ParseException , ResourceNotFoundException { } private void renderNext ( final RequestCycle cycle , final MarkupStream markupStream ) { final MarkupElement element = markupStream . get ( ) ; <START_BUG> if ( element instanceof ComponentTag ) { <END_BUG> final ComponentTag tag = ( ( ComponentTag ) ( element ) ) ; final String componentName = tag . getComponentName ( ) ; Component component = get ( componentName ) ; if ( ( component == null ) && ( tag . isAutomaticLink ( ) ) ) { component = tag . createAutomaticLink ( getPage ( ) , markupStream ) ; add ( component ) ; if ( Container . log . isDebugEnabled ( ) ) { Container . log . debug ( ( "Added<seq2seq4repair_space>autolink<seq2seq4repair_space>" + component ) ) ; } } if ( component != null ) { if ( Container . log . isDebugEnabled ( ) ) { Container . log . debug ( ( "Begin<seq2seq4repair_space>render<seq2seq4repair_space>of<seq2seq4repair_space>sub-component<seq2seq4repair_space>" + component ) ) ; } component . render ( cycle ) ; if ( Container . log . isDebugEnabled ( ) ) { Container . log . debug ( ( "End<seq2seq4repair_space>render<seq2seq4repair_space>of<seq2seq4repair_space>sub-component<seq2seq4repair_space>" + component ) ) ; } } else { if ( componentName . equals ( "[body]" ) ) { if ( ! ( markupStream . atOpenCloseTag ( ) ) ) { markupStream . throwMarkupException ( "A<seq2seq4repair_space>[body]<seq2seq4repair_space>tag<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>an<seq2seq4repair_space>openclose<seq2seq4repair_space>tag." ) ; } renderTag ( cycle , tag ) ; markupStream . next ( ) ; Border border = ( ( Border ) ( ( ( this ) instanceof Border ) ? this : findParent ( Border . class ) ) ) ; if ( ( border . getMarkupStream ( ) ) == null ) { Container borderParent = border . getParent ( ) ; border = ( ( Border ) ( ( borderParent instanceof Border ) ? borderParent : borderParent . findParent ( Border . class ) ) ) ; } final MarkupStream borderMarkup = border . findMarkupStream ( ) ; border . setMarkupStream ( null ) ; border . renderBody ( cycle , border . findMarkupStream ( ) , border . getOpenTag ( ) ) ; border . setMarkupStream ( borderMarkup ) ; } else { markupStream . throwMarkupException ( ( ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>component<seq2seq4repair_space>named<seq2seq4repair_space>'" + componentName ) + "'<seq2seq4repair_space>in<seq2seq4repair_space>" ) + ( this ) ) ) ; } } } else { Container . log . debug ( "Rendering<seq2seq4repair_space>raw<seq2seq4repair_space>markup" ) ; cycle . getResponse ( ) . write ( element . toString ( ) ) ; markupStream . next ( ) ; } } public Container replace ( final Component child ) { } }

Fix:
if ( ( element instanceof ComponentTag ) && ( ! ( markupStream . atCloseTag ( ) ) ) ) {