[ https://issues.apache.org/jira/browse/WICKET-5704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14149577#comment-14149577 ]
Jesse Long commented on WICKET-5704: ------------------------------------ Short version: Problem is we are trying to find from element 1 in a MarkupFragment with size 0. It is theoretically possible for MarkupFragment to have size of 0, so MarkupFragment#find() should probably have this at the beginning: if (size < 2){ return null; } That will fix the problem. Long version: I cant seem to find a way to create a MarkupFragment with size 0, I would be very interested to find out how that could happen. MarkupFragment constructor seems to expect size to be 0 some times. This is being triggered by an attempt to render a component, which is inside some sort of component resolver, to an Ajax response. This usage in itself is not a problem, it is fine, and usually works 100%. The component causing the problem may be entirely unrelated to the component being rendered. When rendering a component to an ajax response, Wicket must find markup for component. The default strategy if to find the component tag with the same id as the child that is a direct child of the component tag of the child's Java parent. If the component tag for the child is not an immediate child of the Java parent's component tag, there is some component resolving going on. The markup sourcing strategy (default, associated) works down the component tree from looking for MarkupContainers that are also IComponentResolvers. The idea is that the sought component tag could be a child of the component tag for any of these component resolving markup containers. If there is more than one such component resolving markup container, all are visited until the child markup is found. This is why I say the component with the problem could be unrelated to the component being rendered. It could be some other component resolving markup container that is just being checked. For each component resolving markup container descendant, we try find the markup for the component being rendered, ultimately calling find() on that markup containers MarkupFragment. It is on one of these that size == 0, but we start looking from index 1. I cant seem to reproduce this problem with anonymous inner classes or non-inherited wicket:child tags. I would be interested to see that if you can easily create a quickstart. > IllegalArgument exception with wicket:child in ajaxrequest > ---------------------------------------------------------- > > Key: WICKET-5704 > URL: https://issues.apache.org/jira/browse/WICKET-5704 > Project: Wicket > Issue Type: Bug > Components: wicket > Affects Versions: 6.16.0, 6.17.0 > Reporter: Ted Roeloffzen > > We have a page in our application with a DataView. > In this DataView we have an anonymous inner class of a component which has a > wicket:child-tag. > When there is ajaxrequest, in our case because we want to go to the next page > in our dataview, an exception is thrown. > java.lang.IllegalArgumentException: Argument 'streamOffset' must have a value > within [0,0], but was 1 > at org.apache.wicket.util.lang.Args.withinRange(Args.java:120) > at > org.apache.wicket.markup.AbstractMarkupFragment.find(AbstractMarkupFragment.java:43) > at > org.apache.wicket.markup.MarkupFragment.find(MarkupFragment.java:150) > at > org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.getMarkup(DefaultMarkupSourcingStrategy.java:94) > at > org.apache.wicket.MarkupContainer.getMarkup(MarkupContainer.java:451) > at > org.apache.wicket.markup.html.panel.AbstractMarkupSourcingStrategy$1.component(AbstractMarkupSourcingStrategy.java:72) > at > org.apache.wicket.markup.html.panel.AbstractMarkupSourcingStrategy$1.component(AbstractMarkupSourcingStrategy.java:66) > I have the feeling that is caused by the fix in the following jira-issue > https://issues.apache.org/jira/browse/WICKET-5580 > When we remove the wicket:child-tag completely, there is no problem. > When we change the anonymous inner class, to a nested class and give it an > html-file with wicket:extend-tags without anything between them, it also > works. > I believe that the fix for WICKET-5580, failed to take in account subclasses > of components that don't need to add markup and therefor don't have their own > HTML-file. > I hope I can get around to making a quickstart testcase for this in the next > couple of days -- This message was sent by Atlassian JIRA (v6.3.4#6332)