You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nils Liebelt <ni...@candor.co.za> on 2005/05/23 13:50:18 UTC

Populating growing List

Hi all,

I know that common issue with indexed properties as mentioned in the wiki
http://wiki.apache.org/struts/StrutsCatalogLazyList.

So I wrote a little handcranked lazy list but I still get an
indexoutofbounce exception. I really don't know whats going on here: 

    private ArrayList deleteSelection = new ArrayList();
    
    public void setDeleteSelection(int i, String toDelete) {
	this.deleteSelection.set(i, toDelete);
    }

    public String getDeleteSelection(int i) {
        while(i>=this.deleteSelection.size()) {
            this.deleteSelection.add(new String(""));
        }
        return (String) this.deleteSelection.get(i);

    }

The nested exception looks like this:

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.RangeCheck(ArrayList.java:508)
        at java.util.ArrayList.set(ArrayList.java:336)
at
com.candor.hummingbird.forms.AccountForm.setDeleteSelection(AccountForm.java
:74)



Regards,

Nils


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org