Curious...

The thing is I downloaded the last nightly build and I don't get that error anymore, although the code for the _SerializableDataModel hasn't been altered...

Please, close this issue as not reproducible and I will reopen it if needed.

Thanks for your support.

2005/9/15, Mathias Broekelmann (JIRA) <[email protected]>:
    [ http://issues.apache.org/jira/browse/MYFACES-522?page=comments#action_12329409 ]

Mathias Broekelmann commented on MYFACES-522:
---------------------------------------------

I´ve tried to reproduce the problem but found everything working with the current nightly.
dataModel.setRowIndex(...) only throws an IllegalArgumentException if the given value is less than -1 which is not the case.
Is it possible to post a stacktrace of the Exception you get?

> PreserveDataModel not working (java.lang.IllegalArgumentException: row is unavailable)
> --------------------------------------------------------------------------------------
>
>          Key: MYFACES-522
>          URL: http://issues.apache.org/jira/browse/MYFACES-522
>      Project: MyFaces
>         Type: Bug
>   Components: Tomahawk
>     Versions: Nightly Build
>  Environment: N/A
>     Reporter: Enrique Medina Montenegro
>  Attachments: _SerializableDataModel_Patch.txt
>
> When setting the preserveDataModel attribute in a dataTable, a new _SerializableDataModel is internally build by MyFaces.
> However, if the number of rows to display is less than the total number of possible rows, an IllegalArgumentException is thrown. This problem is caused by the following bunch of lines in the _SerializableDataModel constructor (public _SerializableDataModel(int first, int rows, DataModel dataModel)):
>
>         _list = new ArrayList(rows);
>         for (int i = 0; i < _rows; i++)
>         {
>             dataModel.setRowIndex(_first + i);
>             if (!dataModel.isRowAvailable()) break;
>             _list.add(dataModel.getRowData());
>         }
>         _rowIndex = -1;
> As can be clearly seen, first the dataModel.setRowIndex is set, independently of whether the row is really available or not, as it is checked after.
> The solution would be as simple as swapping the order:
>         _list = new ArrayList(rows);
>         for (int i = 0; i < _rows; i++)
>         {
>             if (!dataModel.isRowAvailable()) break;
>             dataModel.setRowIndex(_first + i);
>             _list.add(dataModel.getRowData());
>         }
>         _rowIndex = -1;

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Reply via email to