You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Ionut S <si...@yahoo.com> on 2006/05/30 14:12:53 UTC

IndexOutOfBoundsException with custom component

Hi there,
I have created a custom components that agregates 2 other components. The component works just fine until a submit is performed. Then I get the following error:
..............
14:57:10,531 WARN  [HtmlGridRendererBase] PanelGrid _id0:holder has not enough children. Child count should be a multiple of the columns attribute.
14:57:11,240 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.RangeCheck(ArrayList.java:546)
        at java.util.ArrayList.get(ArrayList.java:321)
        at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:499)
        at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:502)
        at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:502)
...............

I set ids for all the children in the custom component and also for the component itself. Is somebody who had this problem before ?

Thank you,
Ionut

		
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.

Re: IndexOutOfBoundsException with custom component

Posted by Rogerio Pereira <ro...@gmail.com>.
Right now i'm getting many problems related to arraylist and i'm getting
similar error when using dependency injection with ArrayLists in session
scope.

2006/5/30, Ionut S <si...@yahoo.com>:
>
> Hi there,
> I have created a custom components that agregates 2 other components. The
> component works just fine until a submit is performed. Then I get the
> following error:
> ..............
> 14:57:10,531 WARN  [HtmlGridRendererBase] PanelGrid _id0:holder has not
> enough children. Child count should be a multiple of the columns attribute.
> 14:57:11,240 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces
> Servlet threw exception
> java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
>         at java.util.ArrayList.RangeCheck(ArrayList.java:546)
>         at java.util.ArrayList.get(ArrayList.java:321)
>         at javax.faces.component.UIComponentBase.processRestoreState(
> UIComponentBase.java:499)
>         at javax.faces.component.UIComponentBase.processRestoreState(
> UIComponentBase.java:502)
>         at javax.faces.component.UIComponentBase.processRestoreState(
> UIComponentBase.java:502)
> ...............
>
> I set ids for all the children in the custom component and also for the
> component itself. Is somebody who had this problem before ?
>
> Thank you,
> Ionut
>
> ------------------------------
> Love cheap thrills? Enjoy PC-to-Phone calls to 30+ countries<http://us.rd.yahoo.com/mail_us/taglines/postman9/*http://us.rd.yahoo.com/evt=39666/*http://messenger.yahoo.com/>for just 2¢/min with Yahoo! Messenger with Voice.
>
>


-- 
Yours truly (Atenciosamente),

Rogério

Re: IndexOutOfBoundsException with custom component

Posted by Ionut S <si...@yahoo.com>.
I thought I should post the code for the component, maybe somebody can help:

public class TabLabelComponent extends UIPanel {
    private static int id = 0;
    
    /** Creates a new instance of TabLabelComponent */
    public TabLabelComponent() {
        setId("tab_" + id);

        UIGraphic leftTabEnd = new UIGraphic();
        leftTabEnd.setUrl("images/left_unselected.gif");
        leftTabEnd.setId("left_" + id);
        
        UIGraphic rightTabEnd = new UIGraphic();
        rightTabEnd.setUrl("images/right_unselected.gif");
        rightTabEnd.setId("right_" + id);
        
        UIOutput tabTitle = new UIOutput();
        tabTitle.setValue("Tab");
        tabTitle.setId("title_" + id);
        
        UIGraphic closeIcon = new UIGraphic();
        closeIcon.setUrl("images/close.gif");
        closeIcon.setId("closeIcon_" + id);
        HtmlCommandLink close = new HtmlCommandLink();
        close.addActionListener(new CloseListener());
        close.setId("close_" + id);
        close.getChildren().add(closeIcon);
        
        List kids = getChildren();
        kids.add(leftTabEnd);
        kids.add(tabTitle);
        kids.add(close);
        kids.add(rightTabEnd);

        id++;
    }
    
}

Can anybody spot any error in it ? I mean, why that error ?

I found the same problem here, but there is no solution to it:
http://mail-archives.apache.org/mod_mbox/myfaces-users/200511.mbox/%3C436AC46D.6000805@obsidium.com%3E

Thank you,
Ionut

Ionut S <si...@yahoo.com> wrote: Anybody cares to help ?

Ionut S <si...@yahoo.com> wrote: Hi there,
I have created a custom components that agregates 2 other components. The component works just fine until a submit is performed. Then I get the following error:
..............
14:57:10,531 WARN  [HtmlGridRendererBase] PanelGrid _id0:holder has not enough children. Child count should be a multiple of the columns attribute.
14:57:11,240 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.RangeCheck(ArrayList.java:546)
        at java.util.ArrayList.get(ArrayList.java:321)
        at  javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:499)
        at  javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:502)
        at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:502)
...............

I set ids for all the children in the custom component and also for the component itself. Is somebody who had this problem before ?

Thank you,
Ionut
   

---------------------------------
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2�/min with Yahoo! Messenger with Voice.
   

---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail Beta.

Re: IndexOutOfBoundsException with custom component

Posted by Ionut S <si...@yahoo.com>.
Anybody cares to help ?

Ionut S <si...@yahoo.com> wrote: Hi there,
I have created a custom components that agregates 2 other components. The component works just fine until a submit is performed. Then I get the following error:
..............
14:57:10,531 WARN  [HtmlGridRendererBase] PanelGrid _id0:holder has not enough children. Child count should be a multiple of the columns attribute.
14:57:11,240 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.RangeCheck(ArrayList.java:546)
        at java.util.ArrayList.get(ArrayList.java:321)
        at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:499)
        at  javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:502)
        at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:502)
...............

I set ids for all the children in the custom component and also for the component itself. Is somebody who had this problem before ?

Thank you,
Ionut
   

---------------------------------
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.

		
---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.