Buggy code:
public abstract class Page < T > extends MarkupContainer < T > implements IRedirectListener , IPageMapEntry { private static final long serialVersionUID = 1L ; public static final int LATEST_VERSION = - 1 ; private static final int FLAG_IS_RENDERING = FLAG_RESERVED2 ; private static final int FLAG_NEW_VERSION = FLAG_RESERVED3 ; private static final int FLAG_TRACK_CHANGES = FLAG_RESERVED4 ; private static final int FLAG_STATELESS_HINT = FLAG_RESERVED5 ; private static final Log log = LogFactory . getLog ( Page . class ) ; private short autoIndex ; private FeedbackMessages feedbackMessages ; private short numericId ; private transient PageMap pageMap ; private String pageMapName ; private transient Set < Component > renderedComponents ; private transient Boolean stateless = null ; private IPageVersionManager < T > versionManager ; protected Page ( ) { } protected Page ( final IModel < T > model ) { } protected Page ( final PageMap pageMap ) { } protected Page ( final PageMap pageMap , final IModel < T > model ) { } public void afterCallComponent ( final Component component , final RequestListenerInterface listener ) { } public void beforeCallComponent ( final Component component , final RequestListenerInterface listener ) { } final < V > void componentAdded ( final Component < V > component ) { } final < V > void componentModelChanging ( final Component < V > component ) { } final < V > void componentRemoved ( final Component < V > component ) { } final void componentRendered ( final Component component ) { } final void componentStateChanging ( final Component component , Change change ) { } protected void configureResponse ( ) { } @ Override public void detachModels ( ) { } public final void dirty ( ) { } public final void endComponentRender ( Component component ) { } private final void endVersion ( ) { } public final void expireOldestVersion ( ) { } public final short getAutoIndex ( ) { } public final int getCurrentVersionNumber ( ) { } public final FeedbackMessages getFeedbackMessages ( ) { } @ Override public final String getId ( ) { } public int getNumericId ( ) { } public final Class < ? extends Page > getPageClass ( ) { } public final PageMap getPageMap ( ) { } public IPageMapEntry getPageMapEntry ( ) { } @ Override public final long getSizeInBytes ( ) { } @ Override public final boolean getStatelessHint ( ) { } public Page getVersion ( final int versionNumber ) { } public final int getVersions ( ) { } public final String hierarchyAsString ( ) { } private void checkHierarchyChange ( Component component ) { } private final void checkRendering ( final MarkupContainer < ? > renderedContainer ) { } private final void init ( ) { } private final void init ( final PageMap pageMap ) { } @ Override public void internalDetach ( ) { } @ Override protected final void internalOnDetach ( ) { } @ Override protected final void internalOnModelChanged ( ) { } public boolean isBookmarkable ( ) { } public boolean isErrorPage ( ) { } void setPageStateless ( Boolean stateless ) { } public final boolean isPageStateless ( ) { } private final boolean mayTrackChangesFor ( final Component component , MarkupContainer parent ) { } protected final void moveToPageMap ( PageMap map ) { } protected IPageVersionManager < T > newVersionManager ( ) { } public final void onRedirect ( ) { } @ Override protected void onRender ( final MarkupStream markupStream ) { <START_BUG> final MarkupStream associatedMarkupStream = new MarkupStream ( Page . getAssociatedMarkup ( true ) ) ; <END_BUG> setMarkupStream ( associatedMarkupStream ) ; configureResponse ( ) ; Page . setFlag ( Page . FLAG_IS_RENDERING , true ) ; try { renderAll ( associatedMarkupStream ) ; } finally { Page . setFlag ( Page . FLAG_IS_RENDERING , false ) ; } } public final void removePersistedFormData ( final Class formClass , final boolean disablePersistence ) { } public final void renderPage ( ) { } final void setFormComponentValuesFromCookies ( ) { } public final void setNumericId ( final int id ) { } final void setPageMap ( final PageMap pageMap ) { } public final void setStatelessHint ( boolean value ) { } public final void startComponentRender ( Component component ) { } public MarkupFragment getMarkupFragment ( final String id ) { } @ Override public final MarkupFragment getMarkupFragment ( ) { } @ Override public String toString ( ) { } }

Fix:
final MarkupStream associatedMarkupStream = new MarkupStream ( getMarkupFragment ( ) ) ;