[
https://issues.apache.org/jira/browse/MYFACES-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12621290#action_12621290
]
Simon Kitching commented on MYFACES-1903:
-----------------------------------------
A possible patch is:
ValueExpression expression = getValueExpression("rows");
if (expression != null)
{
// Deliberately use Number here, so that the EL expression can
return type Long
// without triggering a ClassCastException. Yes, technically a
non-integer
// return type is wrong. However myfaces 1.1.x supported that, and
it seems
// friendly..
Number n = (Number)
expression.getValue(getFacesContext().getELContext());
if (n != null)
{
return n.intValue();
}
}
return 0; // show them all
Alternatively this issue could of course be considered a bug in the tomahawk
examples rather than in core. In that case, documentation should be added to
UIData.rows to specify that there is an incompatibility with core 1.1.x (and
the example should be fixed).
> In core1.2.x, a ClassCastException occurs when UIData.rows is an EL
> expression that returns type Long
> -----------------------------------------------------------------------------------------------------
>
> Key: MYFACES-1903
> URL: https://issues.apache.org/jira/browse/MYFACES-1903
> Project: MyFaces Core
> Issue Type: Bug
> Affects Versions: 1.2.3
> Reporter: Simon Kitching
>
> The UIData component has a "rows" property of type int. When an EL expression
> is used, and the referenced user method returns int or Integer then all is ok.
> When the user method returns long or Long, this still works with myfaces
> 1.1.x.
> However with myfaces 1.2.x a ClassCastException occurs.
> One example is the Tomahawk "simple" examples, where selecting the "data
> scroller" example causes an immediate exception.
> The code in 1.1.x is:
> ValueBinding vb = getValueBinding("rows");
> Number v = vb != null ? (Number) vb.getValue(getFacesContext()) :
> null;
> return v != null ? v.intValue() : DEFAULT_ROWS;
> The code in 1.2.x is:
> ValueExpression expression = getValueExpression("rows");
> if (expression != null)
> {
> return (Integer)expression.getValue(getFacesContext().getELContext());
> }
> return 0;
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.