Description
Refresh for page, containing feedback panel causes WicketRuntimeException.
I have MarkupContainer wich has overriden
protected void onBeforeRender()
where I call addOrReplace to add or replace component with feedback panel.
I have noticed that refreshing such page causes
Caused by: java.lang.RuntimeException: An error occurred while getting the model object for Component: [MessageListView [Component id = messages, page = <No Page>, ...
During dubug Wicket 6.3.0 I see that
Component.beforeRender() method has multiple feedbacks in getRequestCycle().getMetaData(FEEDBACK_LIST)
insteas of one - witch I've replaced in MarkupContainer.onBeforeRender().
Call to
oldFeedBack.prepareForRender();
before addOrReplace fixes problem, but prepareForRender is not in public API.
StackTrace:
org.apache.wicket.WicketRuntimeException: Error attaching this container for rendering: [Component id = feedbackPanel]
at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1692)
at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
at org.apache.wicket.Component.internalPrepareForRender(Component.java:2222)
at org.apache.wicket.Page.internalPrepareForRender(Page.java:247)
at org.apache.wicket.Component.render(Component.java:2289)
at org.apache.wicket.Page.renderPage(Page.java:1021)
at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:116)
at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:196)
at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:830)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:253)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:281)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
<....>
Caused by: java.lang.RuntimeException: An error occurred while getting the model object for Component: [MessageListView [Component id = messages, page = <No Page> ...
at org.apache.wicket.Component.getDefaultModelObject(Component.java:1620)
at org.apache.wicket.markup.html.list.ListView.getModelObject(ListView.java:644)
at org.apache.wicket.markup.html.panel.FeedbackPanel.getCurrentMessages(FeedbackPanel.java:307)
at org.apache.wicket.markup.html.panel.FeedbackPanel.anyMessage(FeedbackPanel.java:200)
at org.apache.wicket.markup.html.panel.FeedbackPanel.anyMessage(FeedbackPanel.java:187)
at org.apache.wicket.markup.html.panel.FeedbackPanel$1.onConfigure(FeedbackPanel.java:155)
at org.apache.wicket.Component.configure(Component.java:1028)
at org.apache.wicket.Component.internalBeforeRender(Component.java:913)
at org.apache.wicket.Component.beforeRender(Component.java:990)
at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)