You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Adam Winer (JIRA)" <de...@myfaces.apache.org> on 2007/08/08 02:01:59 UTC

[jira] Commented: (TRINIDAD-145) ClassCastException when binding number-grouping-separator

    [ https://issues.apache.org/jira/browse/TRINIDAD-145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518281 ] 

Adam Winer commented on TRINIDAD-145:
-------------------------------------

For the 1.2 patch:  the code that tries to create the ValueExpression is off:  the logic should be:
- If there's a FacesContext, use its getELContext()
- Otherwise, create a dummy implementation, using Application.getELResolver().
   I think we likely have a dummy implementation lying around, perhaps in the test code

Also, we shouldn't have any need for testing NullPointerExceptions anymore - and if we do, we definitely shouldn't have comments talking about bugs in the 1.0 and 1.1 RI in our 1.2 code :)


> ClassCastException when binding number-grouping-separator
> ---------------------------------------------------------
>
>                 Key: TRINIDAD-145
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-145
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>    Affects Versions: 1.2.1-core
>            Reporter: Jeanne Waldman
>            Assignee: Jeanne Waldman
>         Attachments: LazyValueExpressionPatch.patch, UnwrapStringToCharPatch.patch
>
>
> In trinidad-config.xml, set this:
>        <number-grouping-separator>#{view.locale.language=='de' ? 'o' : 'x'}</number-grouping-separator>   
> Run a page.
> You'll get a ClassCastException trying to cast a String to a Character in RequestContextImpl in this code:
>   @Override
>   public char getNumberGroupingSeparator()
>   {
>     Character c = (Character) _bean.getProperty(
>       RequestContextBean.NUMBER_GROUPING_SEPARATOR_KEY);
>     if (c != null)
>       return c.charValue();
>     return (char) 0;
>   }
> This is a problem in both the 1.2.1 branch and the Trunk.
> Adam suggested as a fix:
> @ In 1.1, we should be unwrapping the String into a Character.
> @ In 1.2, we should change LazyValueBinding to LazyValueExpression and take
> @ advantage of the automatic coercion in ValueExpressions. 
> I have a patch for the 1.2 version that I will upload soon for review.

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