Wicket
  1. Wicket
  2. WICKET-4258

DebugBar displays stacktrace with FeedbackPanels

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5.3
    • Fix Version/s: 1.5.4, 6.0.0-beta1
    • Component/s: wicket-devutils
    • Labels:
      None

      Description

      Clicking Inspector from DebugBar when a FeedbackPanel is displaying a message results in this stacktrace in log. Everything seems to work, extra stuff in logs is just annoying.

      ERROR - Component - Error while getting default model object for Component: [ListItem [Component id = 0, page = com.mycompany.HomePage, path = 8:form:feedback:feedbackul:messages:0.ListItem, isVisible = true, isVersioned = false], children = [Component id = message]]
      java.lang.IndexOutOfBoundsException: Index: 0
      at java.util.Collections$EmptyList.get(Collections.java:3204)
      at org.apache.wicket.markup.html.list.ListItemModel.getObject(ListItemModel.java:58)
      at org.apache.wicket.Component.getDefaultModelObject(Component.java:1640)
      at org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1668)
      at org.apache.wicket.markup.html.debug.PageView$4.component(PageView.java:211)
      at org.apache.wicket.markup.html.debug.PageView$4.component(PageView.java:184)
      at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:143)
      at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
      at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
      at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
      at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
      at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:122)
      at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:191)
      at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:923)
      at org.apache.wicket.markup.html.debug.PageView.getComponentData(PageView.java:182)
      at org.apache.wicket.markup.html.debug.PageView.<init>(PageView.java:130)
      at org.apache.wicket.devutils.inspector.InspectorPage.<init>(InspectorPage.java:66)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
      at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:173)
      at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:97)
      at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:47)
      at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:107)
      at org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:264)
      at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165)
      at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)
      at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
      at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
      at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
      at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
      at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
      at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
      at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
      at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
      at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
      at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1326)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:940)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:874)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
      at org.eclipse.jetty.server.Server.handle(Server.java:349)
      at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
      at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:904)
      at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:565)
      at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:217)
      at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:50)
      at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:245)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
      at java.lang.Thread.run(Thread.java:722)

      1. WICKET-4258.patch
        2 kB
        Sven Meier
      2. WICKET-4258-quickstart.tar.gz
        19 kB
        Juha Syrjälä

        Activity

        Juha Syrjälä created issue -
        Juha Syrjälä made changes -
        Field Original Value New Value
        Summary DebugBar throws exception with DebugBar displays stacktrace with FeedbackPanels
        Hide
        Juha Syrjälä added a comment -

        Attached quickstart

        Show
        Juha Syrjälä added a comment - Attached quickstart
        Juha Syrjälä made changes -
        Attachment WICKET-4258-quickstart.tar.gz [ 12505031 ]
        Juha Syrjälä made changes -
        Description Clicking Inspector from DebugBar when a FeedbackPanel is displaying a message results in this stacktrace in log:

        ERROR - Component - Error while getting default model object for Component: [ListItem [Component id = 0, page = com.mycompany.HomePage, path = 8:form:feedback:feedbackul:messages:0.ListItem, isVisible = true, isVersioned = false], children = [Component id = message]]
        java.lang.IndexOutOfBoundsException: Index: 0
        at java.util.Collections$EmptyList.get(Collections.java:3204)
        at org.apache.wicket.markup.html.list.ListItemModel.getObject(ListItemModel.java:58)
        at org.apache.wicket.Component.getDefaultModelObject(Component.java:1640)
        at org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1668)
        at org.apache.wicket.markup.html.debug.PageView$4.component(PageView.java:211)
        at org.apache.wicket.markup.html.debug.PageView$4.component(PageView.java:184)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:143)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:122)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:191)
        at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:923)
        at org.apache.wicket.markup.html.debug.PageView.getComponentData(PageView.java:182)
        at org.apache.wicket.markup.html.debug.PageView.<init>(PageView.java:130)
        at org.apache.wicket.devutils.inspector.InspectorPage.<init>(InspectorPage.java:66)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
        at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:173)
        at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:97)
        at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:47)
        at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:107)
        at org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:264)
        at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165)
        at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)
        at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
        at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
        at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
        at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
        at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
        at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
        at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
        at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
        at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1326)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:940)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:874)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
        at org.eclipse.jetty.server.Server.handle(Server.java:349)
        at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
        at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:904)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:565)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:217)
        at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:50)
        at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:245)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
        at java.lang.Thread.run(Thread.java:722)
        Clicking Inspector from DebugBar when a FeedbackPanel is displaying a message results in this stacktrace in log. Everything seems to work, extra stuff in logs is just annoying.

        ERROR - Component - Error while getting default model object for Component: [ListItem [Component id = 0, page = com.mycompany.HomePage, path = 8:form:feedback:feedbackul:messages:0.ListItem, isVisible = true, isVersioned = false], children = [Component id = message]]
        java.lang.IndexOutOfBoundsException: Index: 0
        at java.util.Collections$EmptyList.get(Collections.java:3204)
        at org.apache.wicket.markup.html.list.ListItemModel.getObject(ListItemModel.java:58)
        at org.apache.wicket.Component.getDefaultModelObject(Component.java:1640)
        at org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1668)
        at org.apache.wicket.markup.html.debug.PageView$4.component(PageView.java:211)
        at org.apache.wicket.markup.html.debug.PageView$4.component(PageView.java:184)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:143)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:122)
        at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:191)
        at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:923)
        at org.apache.wicket.markup.html.debug.PageView.getComponentData(PageView.java:182)
        at org.apache.wicket.markup.html.debug.PageView.<init>(PageView.java:130)
        at org.apache.wicket.devutils.inspector.InspectorPage.<init>(InspectorPage.java:66)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
        at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:173)
        at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:97)
        at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:47)
        at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:107)
        at org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:264)
        at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165)
        at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)
        at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
        at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
        at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
        at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
        at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
        at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
        at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
        at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
        at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1326)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:940)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:874)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
        at org.eclipse.jetty.server.Server.handle(Server.java:349)
        at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
        at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:904)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:565)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:217)
        at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:50)
        at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:245)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
        at java.lang.Thread.run(Thread.java:722)
        Juha Syrjälä made changes -
        Comment [ The problem seems to be in ListItemModel.getObject() that throws IndexOutOfBoundsException when the ListView points to empty list. Maybe ListItemModel.getObject() should just return null in this case or there should be a null safe version of getObject() method.


        /**
        * @see org.apache.wicket.model.IModel#getObject()
        */
        public T getObject()
        {
        return listView.getModelObject().get(index);
        }
        ]
        Hide
        Sven Meier added a comment -

        When PageView tries to get component data from FeedbackPanel's list items, these don't have access to their feedback messages because these are already cleared in the session. Since r1180799 the exception stracktrace is logged, making this more annoying.

        The attached patches makes FeedbackPanel's list item model fail save.

        I'm not sure this is the way we want to go though. It seems the item's css attribute modifier and the label component both keep a hard reference to the message anyway. If this is intentional, there's no reason why the list item's model shouldn't do the same.

        Show
        Sven Meier added a comment - When PageView tries to get component data from FeedbackPanel's list items, these don't have access to their feedback messages because these are already cleared in the session. Since r1180799 the exception stracktrace is logged, making this more annoying. The attached patches makes FeedbackPanel's list item model fail save. I'm not sure this is the way we want to go though. It seems the item's css attribute modifier and the label component both keep a hard reference to the message anyway. If this is intentional, there's no reason why the list item's model shouldn't do the same.
        Hide
        Sven Meier added a comment -

        fail save item model

        Show
        Sven Meier added a comment - fail save item model
        Sven Meier made changes -
        Attachment WICKET-4258.patch [ 12505086 ]
        Hide
        Martin Grigorov added a comment -

        Sven, your solution looks good to me.

        Show
        Martin Grigorov added a comment - Sven, your solution looks good to me.
        Martin Grigorov made changes -
        Assignee Sven Meier [ svenmeier ]
        Sven Meier committed 1221142 (1 file)
        Reviews: none

        WICKET-4258 feedback messages are cleared before wicket-devutils's PageView accesses the model object

        Sven Meier committed 1221143 (1 file)
        Reviews: none

        WICKET-4258 feedback messages are cleared before wicket-devutils's PageView accesses the model object

        Hide
        Sven Meier added a comment -

        added check for message in list model

        Show
        Sven Meier added a comment - added check for message in list model
        Sven Meier made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.5.4 [ 12319051 ]
        Fix Version/s 6.0.0 [ 12315431 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Sven Meier
            Reporter:
            Juha Syrjälä
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development