Buggy code:
public final void info ( final String message ) { } @ Deprecated public final void internalAttach ( ) { } @ Deprecated public final void internalDetach ( ) { } public final boolean isActionAuthorized ( Action action ) { } @ Deprecated public final boolean isAncestorOf ( final Component component ) { } public final boolean isEnableAllowed ( ) { } public boolean isEnabled ( ) { } public final boolean isRenderAllowed ( ) { } public final boolean isStateless ( ) { } public boolean isVersioned ( ) { } public boolean isVisible ( ) { } public final boolean isVisibleInHierarchy ( ) { } public final void markRendering ( boolean setRenderingFlag ) { } public final void modelChanged ( ) { } public final void modelChanging ( ) { } public final < C extends Page > Page newPage ( final Class < C > c ) { } public final < C extends Page > Page newPage ( final Class < C > c , final PageParameters parameters ) { } public final void prepareForRender ( boolean setRenderingFlag ) { } public final void prepareForRender ( ) { } public final void redirectToInterceptPage ( final Page page ) { } public final void remove ( ) { } public Component remove ( final IBehavior behavior ) { } private boolean removeBehavior ( 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 ) { } final void setMarkupIdImpl ( Object markupId ) { } public void setMarkupId ( String markupId ) { } public final < M > void setMetaData ( final MetaDataKey < M > key , final M object ) { } public Component setDefaultModel ( final IModel < ? > model ) { } IModel < ? > getModelImpl ( ) { } void setModelImpl ( IModel < ? > model ) { } @ SuppressWarnings ( "unchecked" ) public final Component setDefaultModelObject ( 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 < C extends Page > void setResponsePage ( final Class < C > cls ) { } public final < C extends Page > void setResponsePage ( final Class < C > cls , PageParameters parameters ) { } public final void setResponsePage ( final Page page ) { } public Component setVersioned ( boolean versioned ) { } public final Component setVisible ( final boolean visible ) { } @ Override public String toString ( ) { } public String toString ( final boolean detailed ) { } public final < C extends Page > CharSequence urlFor ( final Class < C > pageClass , final PageParameters parameters ) { } public final CharSequence urlFor ( final IBehavior behaviour , final RequestListenerInterface listener ) { } public final < C extends Page > CharSequence urlFor ( final IPageMap pageMap , final Class < C > 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 < C extends Component > Object visitParents ( final Class < C > c , final Component . IVisitor < Component > visitor ) { <START_BUG> Component current = this ; <END_BUG> while ( current != null ) { if ( c . isInstance ( current ) ) { final Object object = visitor . component ( current ) ; if ( object != ( Component . IVisitor . CONTINUE_TRAVERSAL ) ) { return object ; } } current = current . getParent ( ) ; } return null ; } 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 < IBehavior > getBehaviors ( Class < ? extends IBehavior > 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 ( ) { } @ SuppressWarnings ( "unchecked" ) protected IModel < ? > initModel ( ) { } protected final void internalOnAttach ( ) { } protected final void internalOnDetach ( ) { } protected void internalOnModelChanged ( ) { } protected final void markAttached ( boolean attached ) { }

Fix:
Component current = getParent ( ) ;