[jira] Commented: (MYFACES-522) PreserveDataModel not working (java.lang.IllegalArgumentException: row is unavailable)

2005-09-16 Thread Enrique Medina Montenegro (JIRA)
[ 
http://issues.apache.org/jira/browse/MYFACES-522?page=comments#action_12329521 
] 

Enrique Medina Montenegro commented on MYFACES-522:
---

Mathias, please close this issue as it is not reproducing any more...

Thanks.

 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



[jira] Commented: (MYFACES-522) PreserveDataModel not working (java.lang.IllegalArgumentException: row is unavailable)

2005-09-15 Thread Mathias Broekelmann (JIRA)
[ 
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



Re: [jira] Commented: (MYFACES-522) PreserveDataModel not working (java.lang.IllegalArgumentException: row is unavailable)

2005-09-15 Thread Enrique Medina
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) myfaces-dev@incubator.apache.org:
[ 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-522URL: http://issues.apache.org/jira/browse/MYFACES-522Project: MyFaces Type: Bug
 Components: Tomahawk Versions: Nightly BuildEnvironment: N/A Reporter: Enrique Medina MontenegroAttachments: _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