Wicket
  1. Wicket
  2. WICKET-4895

WicketRuntimeException: addOrReplace for feedback panel does not clear Component.FEEDBACK_LIST - feedback from replaced component causes error.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.3.0
    • Fix Version/s: 6.4.0, 1.5.10
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      Wicket 6.3.0

      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)

      1. quickstart.zip
        20 kB
        Artem Morozov

        Activity

        Hide
        Martin Grigorov added a comment -

        An improvement is added to prevent this error.
        Until 6.4.0 you can use the solution from my previous comment.

        Show
        Martin Grigorov added a comment - An improvement is added to prevent this error. Until 6.4.0 you can use the solution from my previous comment.
        Hide
        Artem Morozov added a comment -

        Very unusual thing, but seems it works, thanks

        Show
        Artem Morozov added a comment - Very unusual thing, but seems it works, thanks
        Hide
        Martin Grigorov added a comment -

        In org.test.TestPanel#onBeforeRender() first do the replacements and then call super.onBeforeRender().

        Show
        Martin Grigorov added a comment - In org.test.TestPanel#onBeforeRender() first do the replacements and then call super.onBeforeRender().
        Hide
        Martin Grigorov added a comment -

        Thanks

        Show
        Martin Grigorov added a comment - Thanks
        Hide
        Artem Morozov added a comment -

        I've attached quickstart.zip
        Just press F5 2 times to reproduce,
        Thanks

        Show
        Artem Morozov added a comment - I've attached quickstart.zip Just press F5 2 times to reproduce, Thanks
        Hide
        Martin Grigorov added a comment -

        Please attach a quickstart and we will investigate.
        Thanks!

        Show
        Martin Grigorov added a comment - Please attach a quickstart and we will investigate. Thanks!
        Hide
        Martin Grigorov added a comment -

        Please attach a quickstart.

        Show
        Martin Grigorov added a comment - Please attach a quickstart.

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Artem Morozov
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development