You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "paul (JIRA)" <de...@myfaces.apache.org> on 2007/04/09 21:25:32 UTC

[jira] Commented: (MYFACES-278) UIData does not processColumnChildren() if rowCount() returns -1 (for ResultSetDataModel)

    [ https://issues.apache.org/jira/browse/MYFACES-278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487612 ] 

paul commented on MYFACES-278:
------------------------------

I have also verified that this bug still exists. 

If you are using a javax.sql.rowset.CachedRowSet, you can workaround this bug by extending the ResultSetDataModel and overriding the getRowCount() method to return CachedRowSet.size().  





> UIData does not processColumnChildren() if rowCount() returns -1 (for ResultSetDataModel)
> -----------------------------------------------------------------------------------------
>
>                 Key: MYFACES-278
>                 URL: https://issues.apache.org/jira/browse/MYFACES-278
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>            Reporter: Ahmed Ashour
>         Assigned To: Martin Marinschek
>            Priority: Minor
>             Fix For: 1.1.0
>
>
> Any code that iterates the rows using getRowCount() would fail, because it might be -1 (for ResultSetDataModel).
> Instead, isRowAvailable() should be used to iterator over the rows, and "break" otherwise.
> E.g. in javax.faces.component.UIData
> private void processColumnChildren(FacesContext context, int processAction) {
> 		int first = getFirst();
> 		int rows = getRows();
> 		int last;
> 		if (rows == 0) {
> 			last = getRowCount();
> 		} else {
> 			last = first + rows;
> 		}
> 		for (int rowIndex = first; rowIndex < last; rowIndex++) {
> 			setRowIndex(rowIndex);
> 			if (isRowAvailable()) {
> Should be replaced with 
> private void processColumnChildren(FacesContext context, int processAction) {
> 		int first = getFirst();
> 		int rows = getRows();
> 		int last;
> 		if (rows == 0) {
> 			last = getRowCount();
> 		} else {
> 			last = first + rows;
> 		}
> 		for (int rowIndex = first; last==-1 || rowIndex < last; rowIndex++) {
> 			setRowIndex(rowIndex);
> 			if (isRowAvailable()) {
> 			} else
> 			        break

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.