Possible bug in dynamic tabs

22 views
Skip to first unread message

Mario Giammarco

unread,
Mar 29, 2018, 3:03:52 PM3/29/18
to invesdwin-platform
Hello,
I do a search that returns a list of  x tabs.
If I do a new search that returns less tabs than before I get:

WARN  RequestCycleExtra    - Handling the following exception
org.apache.wicket.WicketRuntimeException: Error attaching this container for rendering: [BorderBodyContainer [Component id = risultati_gridColumn_body]]
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1580)
    at org.apache.wicket.Component.onBeforeRender(Component.java:3877)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)
    at org.apache.wicket.Component.onBeforeRender(Component.java:3877)
    at org.apache.wicket.markup.html.border.Border.onBeforeRender(Border.java:637)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.Component.internalPrepareForRender(Component.java:2215)
    at org.apache.wicket.Component.prepareForRender(Component.java:2254)
    at org.apache.wicket.page.XmlPartialPageUpdate.writeComponent(XmlPartialPageUpdate.java:98)
    at org.apache.wicket.page.PartialPageUpdate.writeComponents(PartialPageUpdate.java:245)
    at org.apache.wicket.page.PartialPageUpdate.writeTo(PartialPageUpdate.java:158)
    at org.apache.wicket.ajax.AjaxRequestHandler.respond(AjaxRequestHandler.java:358)
    at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:865)
    at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
    at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:97)
    at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
    at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
    at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
    at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
    at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
    at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IndexOutOfBoundsException: Index: 6, Size: 1
    at java.util.ArrayList.rangeCheck(ArrayList.java:657)
    at java.util.ArrayList.get(ArrayList.java:433)
    at de.invesdwin.util.collections.delegate.ADelegateList.get(ADelegateList.java:34)
    at org.apache.wicket.extensions.markup.html.tabs.TabbedPanel$VisibilityCache.isVisible(TabbedPanel.java:524)
    at org.apache.wicket.extensions.markup.html.tabs.TabbedPanel.onBeforeRender(TabbedPanel.java:252)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)
    ... 39 more
WARN  RequestCycleExtra    - ********************************
ERROR faultExceptionMapper - Unexpected error occurred
org.apache.wicket.WicketRuntimeException: Error attaching this container for rendering: [BorderBodyContainer [Component id = risultati_gridColumn_body]]
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1580)
    at org.apache.wicket.Component.onBeforeRender(Component.java:3877)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)
    at org.apache.wicket.Component.onBeforeRender(Component.java:3877)
    at org.apache.wicket.markup.html.border.Border.onBeforeRender(Border.java:637)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.Component.internalPrepareForRender(Component.java:2215)
    at org.apache.wicket.Component.prepareForRender(Component.java:2254)
    at org.apache.wicket.page.XmlPartialPageUpdate.writeComponent(XmlPartialPageUpdate.java:98)
    at org.apache.wicket.page.PartialPageUpdate.writeComponents(PartialPageUpdate.java:245)
    at org.apache.wicket.page.PartialPageUpdate.writeTo(PartialPageUpdate.java:158)
    at org.apache.wicket.ajax.AjaxRequestHandler.respond(AjaxRequestHandler.java:358)
    at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:865)
    at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
    at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:97)
    at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
    at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
    at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
    at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
    at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
    at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IndexOutOfBoundsException: Index: 6, Size: 1
    at java.util.ArrayList.rangeCheck(ArrayList.java:657)
    at java.util.ArrayList.get(ArrayList.java:433)
    at de.invesdwin.util.collections.delegate.ADelegateList.get(ADelegateList.java:34)
    at org.apache.wicket.extensions.markup.html.tabs.TabbedPanel$VisibilityCache.isVisible(TabbedPanel.java:524)
    at org.apache.wicket.extensions.markup.html.tabs.TabbedPanel.onBeforeRender(TabbedPanel.java:252)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)
    ... 39 more


Edwin Stang

unread,
Mar 29, 2018, 4:38:28 PM3/29/18
to invesdwin-platform
I have fixed it: https://github.com/subes/invesdwin-nowicket/commit/4f41797e60c1cb2a05c8390f494642c9c335b034

TabbedPanel again is not designed for being dynamic, but with this it should not complain anymore about doing something it does not want to. :D

Thanks for reporting.

Mario Giammarco

unread,
Mar 30, 2018, 3:23:02 AM3/30/18
to invesdwin-platform
It was not designed to be dynamic but now it works perfectly! Cheers!

Mario Giammarco

unread,
Apr 17, 2018, 3:40:29 PM4/17/18
to invesdwin-platform
I unfortunately have discovered another bad behaviour: I start a new search, I return a List of tabs (one tab because the search returns only one result).
Then I start a new search, I create a new empty List and I add one result. Unfortunately the result tabs shows the previous result!
I am pretty sure that my part of code is ok, I have logged result just before returning it.
Can you help me again?
Thanks,
Mario

sub es

unread,
Apr 17, 2018, 4:46:55 PM4/17/18
to Mario Giammarco, invesdwin-platform
Thanks for reporting, I will look into it the next days.

--
You received this message because you are subscribed to the Google Groups "invesdwin-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platf...@googlegroups.com.
To post to this group, send email to invesdwin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/invesdwin-platform/99535b93-40c6-42d7-82df-720e52b400d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mario Giammarco

unread,
Apr 18, 2018, 5:18:38 AM4/18/18
to invesdwin-platform
I have tried also the workaround to reuse the same same arraylist using .clear() method but without luck.
To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platform+unsub...@googlegroups.com.

Mario Giammarco

unread,
Apr 18, 2018, 1:25:39 PM4/18/18
to subes, invesdwin-platform
QueryReplyModel extends AValueObject. I have modified the code and I checked that the page is refreshed using target.add() when the result of second search is ready.
Nothing changes.

I have done a deep test:

Search that returns one result. Correct result is displayed.
Second search with one result. One tabs is shown with previous result. (wrong)
Third search that returns 5 results. Five tabs are shown with updated results (right)
Fourth search that returns 5  results. Crash:
Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 2

        at java.util.ArrayList.rangeCheck(ArrayList.java:657)
        at java.util.ArrayList.get(ArrayList.java:433)
        at de.invesdwin.util.collections.delegate.ADelegateList.get(ADelegateList.java:34)
        at org.apache.wicket.extensions.markup.html.tabs.TabbedPanel$VisibilityCache.isVisible(TabbedPanel.java:524)
        at org.apache.wicket.extensions.markup.html.tabs.TabbedPanel.onBeforeRender(TabbedPanel.java:252)
        at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
        at org.apache.wicket.Component.beforeRender(Component.java:1017)
        at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)


2018-04-18 11:43 GMT+02:00 subes <gsu...@gmail.com>:
I remember that your check inside the ajax timer remembers the last size and only updates the tabbed component when that size has changed/increased. In your case it could happen that between the refreshes the size always stays 1, thus your ajax timer does not correctly detect the change because your clear() and so on happens between the ajax timer calls.

Can you try disabling the size check and if that helps, change that check to compare the hashcode of the arraylist or some other value based method to make the check in the ajax timer more intelligent?

To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platform+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "invesdwin-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platform+unsubscribe@googlegroups.com.
To post to this group, send email to invesdwin-platform@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/invesdwin-platform/ae88db60-df02-4796-9b30-ee5a2f5e507f%40googlegroups.com.

Edwin Stang

unread,
Apr 18, 2018, 1:53:16 PM4/18/18
to invesdwin-platform
Ok, I guess TabbedPanel does not like it when the tabs change during the rendering process. I will make the component thread safe in that regard so that the internal tabs list only changes during onConfigure in the components lifecycle.
To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platform+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "invesdwin-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platform+unsub...@googlegroups.com.

To post to this group, send email to invesdwin-platform@googlegroups.com.

Edwin Stang

unread,
Apr 18, 2018, 3:50:17 PM4/18/18
to invesdwin-platform
I was able to fix the issues. See the commit here: https://github.com/subes/invesdwin-nowicket/commit/a410b91e1fb92a799bc1ff7d7d7968115532129e

I have also added a new example for the AjaxTimer: http://invesdwin.de/nowicket/ajaxtimer
Sourcecode here: https://github.com/subes/invesdwin-nowicket/tree/master/invesdwin-nowicket-parent/invesdwin-nowicket-examples/invesdwin-nowicket-examples-guide/src/main/java/de/invesdwin/nowicket/examples/guide/page/wicket/ajaxtimer

Please make sure you use CopyOnWriteArrayList or a Collections.synchronizedList(...) or else your asynchronous updates will not be thread safe, thus you could still encounter ArrayIndexOutOfBoundsExceptions otherwise.

Best regards,
Edwin
Reply all
Reply to author
Forward
0 new messages