Buggy code:
public class ClientPageSavingSessionStore extends HttpSessionStore { private ThreadLocal < Map < String , Object > > pages = new ThreadLocal < Map < String , Object > > ( ) ; public ClientPageSavingSessionStore ( ) { } private Map < String , Object > getStore ( Request request ) { } @ Override public void onBeginRequest ( Request request ) { } @ Override public void onEndRequest ( Request request ) { } @ Override public final Object getAttribute ( Request request , String name ) { } @ Override public final List < String > getAttributeNames ( Request request ) { } @ Override public final void removeAttribute ( Request request , String name ) { } @ Override public final void setAttribute ( Request request , String name , Object value ) { } @ Override public PageMap createPageMap ( String name , Session session ) { } private static final class ClientPageSessionStorePageMap extends PageMap { private static final long serialVersionUID = 1L ; private ClientPageSessionStorePageMap ( String name , Session session ) { } @ Override protected void removeEntry ( IPageMapEntry entry ) { } @ Override protected void put ( Page page ) { } @ Override protected Page get ( int id , int versionNumber ) { } } static final class StateWriter implements IResponseFilter { public AppendingStringBuffer filter ( AppendingStringBuffer responseBuffer ) { IRequestTarget rt = RequestCycle . get ( ) . getRequestTarget ( ) ; int index = responseBuffer . indexOf ( "<head>" ) ; int bodyIndex = responseBuffer . indexOf ( "<//body>" ) ; if ( ( index != ( - 1 ) ) && ( bodyIndex != ( - 1 ) ) ) { Page page = null ; if ( rt instanceof IPageRequestTarget ) { page = ( ( IPageRequestTarget ) ( rt ) ) . getPage ( ) ; } else if ( rt instanceof BookmarkablePageRequestTarget ) { page = ( ( BookmarkablePageRequestTarget ) ( rt ) ) . getPage ( ) ; } <START_BUG> if ( ( page == null ) || ( page . isStateless ( ) ) ) { <END_BUG> return responseBuffer ; } page . detachModels ( ) ; String encodedState ; try { ByteArrayOutputStream out = new ByteArrayOutputStream ( 256 ) ; GZIPOutputStream gzip = new GZIPOutputStream ( out ) ; ObjectOutputStream oos = new ObjectOutputStream ( gzip ) ; oos . writeObject ( page ) ; oos . close ( ) ; byte [ ] unencoded = out . toByteArray ( ) ; byte [ ] encoded = Base64 . encodeBase64 ( unencoded ) ; encodedState = new String ( encoded ) ; } catch ( IOException e ) { throw new WicketRuntimeException ( "Internal<seq2seq4repair_space>error<seq2seq4repair_space>serializing<seq2seq4repair_space>object" , e ) ; } AppendingStringBuffer response = new AppendingStringBuffer ( ( ( encodedState . length ( ) ) + 100 ) ) ; response . append ( SCRIPT_OPEN_TAG ) ; response . append ( "\n" ) ; response . append ( "var<seq2seq4repair_space>wicketState<seq2seq4repair_space>=<seq2seq4repair_space>'" ) ; response . append ( encodedState ) ; response . append ( "\';\n" ) ; response . append ( SCRIPT_CLOSE_TAG ) ; final AppendingStringBuffer forms = new AppendingStringBuffer ( 64 ) ; forms . append ( SCRIPT_OPEN_TAG ) ; page . visitChildren ( Form . class , new IVisitor ( ) { public Object component ( Component component ) { forms . append ( "document.getElementById('" ) ; Form form = ( ( Form ) ( component ) ) ; forms . append ( form . getHiddenFieldId ( HIDDEN_FIELD_WICKET_STATE ) ) ; forms . append ( "\').value=wicketState;\n" ) ; return null ; } } ) ; forms . append ( SCRIPT_CLOSE_TAG ) ; responseBuffer . insert ( bodyIndex , forms ) ; responseBuffer . insert ( ( index + 6 ) , response ) ; } return responseBuffer ; } } }

Fix:
if ( ( page == null ) || ( page . isPageStateless ( ) ) ) {