Simon Kitching wrote:
    public HtmlRowSelector() {
        setRendererType(DEFAULT_RENDERER_TYPE);

        UIComponent child = new SelectBoolean();
        this.getChildren().add(child);
    }
    ...
    // override encodeChildren to render a checkbox per row
}


This component renders fine when the page is first viewed. However on first postback I get:

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
    at java.util.ArrayList.get(ArrayList.java:322)

Nevermind, I figured it out. As soon as I assigned an explicit id to the child component created in the constructor the problem became obvious.

Just in case anyone is interested:
In the "restore view" phase, a new instance of each UIComponent is created. Instances of the previous children are then created and added to the UIComponent. So there are then two children of this component. And trying to restore one serialized child for a component that now has two children causes the array-out-of-bounds.

Regards,

Simon

Reply via email to