Buggy code:
public final void modelChanging ( ) { } public final Page newPage ( final Class c ) { } public final Page newPage ( final Class c , final PageParameters parameters ) { } public final void redirectToInterceptPage ( final Page page ) { } public final void remove ( ) { } public Component remove ( final IBehavior behavior ) { } public final void render ( ) { } public final void render ( final MarkupStream markupStream ) { } public final void renderComponent ( ) { } public final void renderComponent ( final MarkupStream markupStream ) { } public final void rendered ( ) { } public void renderHead ( final HtmlHeaderContainer container ) { } public void replaceWith ( Component replacement ) { } public final boolean sameInnermostModel ( final Component component ) { } public final boolean sameInnermostModel ( final IModel model ) { } public final Component setComponentBorder ( final IComponentBorder border ) { } public final Component setEnabled ( final boolean enabled ) { } public final Component setEscapeModelStrings ( final boolean escapeMarkup ) { } public final void setMetaData ( final MetaDataKey key , final Serializable object ) { } public Component setModel ( final IModel model ) { } public final Component setModelObject ( final Object object ) { } public final Component setOutputMarkupId ( final boolean output ) { } public final Component setOutputMarkupPlaceholderTag ( final boolean outputTag ) { } public final void setRedirect ( final boolean redirect ) { } public final Component setRenderBodyOnly ( final boolean renderTag ) { } public final void setResponsePage ( final Class cls ) { } public final void setResponsePage ( final Class cls , PageParameters parameters ) { } public final void setResponsePage ( final Page page ) { } public Component setVersioned ( boolean versioned ) { } public final Component setVisible ( final boolean visible ) { } public String toString ( ) { } public String toString ( final boolean detailed ) { } public final CharSequence urlFor ( final Class pageClass , final PageParameters parameters ) { } public final CharSequence urlFor ( final IBehavior behaviour , final RequestListenerInterface listener ) { } public final CharSequence urlFor ( final IPageMap pageMap , final Class pageClass , final PageParameters parameters ) { } public final CharSequence urlFor ( final IRequestTarget requestTarget ) { } public final CharSequence urlFor ( final RequestListenerInterface listener ) { } public final CharSequence urlFor ( final ResourceReference resourceReference ) { } public final Object visitParents ( final Class c , final Component . IVisitor visitor ) { } public final void warn ( final String message ) { } private void notifyBehaviorsComponentBeforeRender ( ) { } private void notifyBehaviorsComponentRendered ( ) { } protected final void addStateChange ( final Change change ) { } protected final void checkComponentTag ( final ComponentTag tag , final String name ) { } protected final void checkComponentTagAttribute ( final ComponentTag tag , final String key , final String value ) { } protected void checkHierarchyChange ( final Component component ) { } protected void detachModel ( ) { } protected final String exceptionMessage ( final String message ) { } protected MarkupStream findMarkupStream ( ) { } protected final Page findPage ( ) { } protected List getBehaviors ( Class type ) { } protected final boolean getFlag ( final int flag ) { } protected final boolean getFlag ( final short flag ) { } protected final IModel getInnermostModel ( final IModel model ) { } protected IModelComparator getModelComparator ( ) { } protected boolean getStatelessHint ( ) { } protected IModel initModel ( ) { } protected final void internalOnAttach ( ) { } protected final void internalOnDetach ( ) { } protected void internalOnModelChanged ( ) { } protected final boolean isAttached ( ) { } protected boolean isBehaviorAccepted ( final IBehavior behavior ) { } protected final boolean isIgnoreAttributeModifier ( ) { } protected final boolean isRenderAllowed ( ) { } protected void onAfterRender ( ) { } protected void onAttach ( ) { } protected void onBeforeRender ( ) { } protected final void onBeginRequest ( ) { } protected void onComponentTag ( final ComponentTag tag ) { <START_BUG> if ( getFlag ( Component . FLAG_OUTPUT_MARKUP_ID ) ) { <END_BUG> tag . put ( Component . MARKUP_ID_ATTR_NAME , getMarkupId ( ) ) ; } } protected void onComponentTagBody ( final MarkupStream markupStream , final ComponentTag openTag ) { } protected void onDetach ( ) { } protected final void onEndRequest ( ) { } protected void onModelChanged ( ) { } protected void onModelChanging ( ) { } protected abstract void onRender ( final MarkupStream markupStream ) { } protected final void renderComponentTag ( ComponentTag tag ) { } protected final void replaceComponentTagBody ( final MarkupStream markupStream , final ComponentTag tag , final CharSequence body ) { } protected final void setAuto ( final boolean auto ) { } protected final void setFlag ( final int flag , final boolean set ) { } protected final void setFlag ( final short flag , final boolean set ) { } protected final Component setIgnoreAttributeModifier ( final boolean ignore ) { } protected void setMarkupStream ( final MarkupStream markupStream ) { } protected final IModel wrap ( final IModel model ) { } void detachChildren ( ) { } Component get ( final String path ) { } final boolean hasMarkupIdMetaData ( ) { } void internalAttach2 ( ) { } final boolean isAuto ( ) { } void onAfterRenderChildren ( ) { } void onBeforeRenderChildren ( ) { } final void renderClosingComponentTag ( final MarkupStream markupStream , final ComponentTag openTag , final boolean renderTagOnly ) { } final void setId ( final String id ) { } final void setMarkupIdMetaData ( String markupId ) { } final void setParent ( final MarkupContainer parent ) { } final void setRenderAllowed ( boolean renderAllowed ) { } }

Fix:
if ( ( getFlag ( Component . FLAG_OUTPUT_MARKUP_ID ) ) && ( ! ( tag . getAttributes ( ) . containsKey ( Component . MARKUP_ID_ATTR_NAME ) ) ) ) {