incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sabina Albu" <sabina.a...@gmail.com>
Subject Dynamic tr:table(rows) IndexOutOfBoundsException
Date Wed, 22 Nov 2006 17:08:05 GMT
Hi,

I am getting an java.lang.IndexOutOfBoundsException when I change the
content/rows
in the underlying model/list of a Trinidad table.

The number of rows in my table changes upon clicking on a button:
In XHTML:
...
<tr:commandButton text="Reload" action="#{personBean.reloadTable}"/>
...
<tr:table id="tbl" value="#{personBean.persons}" var="person">
  <tr:column>
        ...
        <tr:outputText value="${person.firstname}"/>
  </tr:column>
    ...
</tr:table>

In bean:
private java.util.List<Person> persons;
 ...
public void reloadTable() {
   persons = null;
   persons = getPersons();//DB call to get new List of persons
}

In the initial load getPersons() returns 1 row. After a reload I get 3 rows
and that's when I get the exception:

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.RangeCheck(ArrayList.java:547)
        at java.util.ArrayList.get(ArrayList.java:322)
        at
org.apache.myfaces.trinidad.component.StampState.restoreChildStampState(
StampState.java:152)
        at org.apache.myfaces.trinidad.component.UIXTable.restoreStampState(
UIXTable.java:320)
        at
org.apache.myfaces.trinidad.component.UIXCollection._restoreStampState(
UIXCollection.java:1088)
        at
org.apache.myfaces.trinidad.component.UIXCollection.postRowDataChange(
UIXCollection.java:690)
        at org.apache.myfaces.trinidad.component.UIXCollection.setRowIndex(
UIXCollection.java:406)
        at org.apache.myfaces.trinidad.component.UIXTable._processStamps(
UIXTable.java:395)
        at
org.apache.myfaces.trinidad.component.UIXTable.processFacetsAndChildren(
UIXTable.java:268)
        at
org.apache.myfaces.trinidad.component.UIXCollection.decodeChildrenImpl(
UIXCollection.java:159)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(
UIXComponentBase.java:874)
        at
org.apache.myfaces.trinidad.component.UIXCollection.processDecodes(
UIXCollection.java:153)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(
UIXComponentBase.java:889)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(
UIXComponentBase.java:874)
        at org.apache.myfaces.trinidad.component.UIXForm.processDecodes(
UIXForm.java:60)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(
UIXComponentBase.java:889)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(
UIXComponentBase.java:874)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(
UIXComponentBase.java:725)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(
UIXComponentBase.java:889)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(
UIXComponentBase.java:874)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(
UIXComponentBase.java:725)
        at javax.faces.component.UIComponentBase.processDecodes(
UIComponentBase.java:872)
        at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java
:306)
    .....


What I found out until now is that the row index is set, at some point, to
the wrong value(-1).
Also in the sources from Trinidad in
org.apache.myfaces.trinidad.component.UIXComponent
I found this comment in the getRowKey() method:
// See bug 4534104.
// Sometimes the rowKey for a particular row changes during update model
// (this happens in ADFM if you edit the primary key of a row).
// It is bad if the rowKey changes after _restoreStampState() and
// before _saveStampState(). Therefore, we cache it:

I know that coding the lines from within the bean is an option but
I would like to keep the tags. It's easier to do table formatting and
styling.


Any advise is welcomed.


Thanks,
Sabina

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message