You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Jeanne Waldman (JIRA)" <de...@myfaces.apache.org> on 2007/08/08 00:31:59 UTC
[jira] Created: (TRINIDAD-145) ClassCastException when binding
number-grouping-separator
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
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.
[jira] Commented: (TRINIDAD-145) ClassCastException when binding
number-grouping-separator
Posted by "Jeanne Waldman (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518525 ]
Jeanne Waldman commented on TRINIDAD-145:
-----------------------------------------
Ok, I think this is what you wanted. Can you review again?
Also, I don't understand how creating a dummy ELContext to pass into createValueExpression works. I guess code doesn't care?
Thanks!
> 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, LazyValueExpressionPatch2.patch, UnwrapStringToCharPatch.patch, UnwrapStringToCharPatch2.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.
[jira] Commented: (TRINIDAD-145) ClassCastException when binding
number-grouping-separator
Posted by "Adam Winer (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518541 ]
Adam Winer commented on TRINIDAD-145:
-------------------------------------
Mostly looks good - _getValueExpression and createValueExpression have a bunch of code in common though.
> 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, LazyValueExpressionPatch2.patch, UnwrapStringToCharPatch.patch, UnwrapStringToCharPatch2.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.
[jira] Commented: (TRINIDAD-145) ClassCastException when binding
number-grouping-separator
Posted by "Adam Winer (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518283 ]
Adam Winer commented on TRINIDAD-145:
-------------------------------------
And for the 1.1 code, you have to support both String and Character objects.
You want the code in CoreRenderer.toChar().
> 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.
[jira] Updated: (TRINIDAD-145) ClassCastException when binding
number-grouping-separator
Posted by "Jeanne Waldman (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jeanne Waldman updated TRINIDAD-145:
------------------------------------
Resolution: Fixed
Status: Resolved (was: Patch Available)
New Revision: 564247 on 1.2.2-branch
New Revision: 564025 on Trunk
The two fixes are described above.
> 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, LazyValueExpressionPatch2.patch, UnwrapStringToCharPatch.patch, UnwrapStringToCharPatch2.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.
[jira] Updated: (TRINIDAD-145) ClassCastException when binding
number-grouping-separator
Posted by "Jeanne Waldman (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jeanne Waldman updated TRINIDAD-145:
------------------------------------
Status: Patch Available (was: Open)
> 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
>
> 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.
[jira] Commented: (TRINIDAD-145) ClassCastException when binding
number-grouping-separator
Posted by "Jeanne Waldman (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518542 ]
Jeanne Waldman commented on TRINIDAD-145:
-----------------------------------------
Ok, I'll fix that and check it in.
I was focusing on the dummy ELContext, which I still don't understand how that is working. I guess the ValueExpression doesn't really need it?
> 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, LazyValueExpressionPatch2.patch, UnwrapStringToCharPatch.patch, UnwrapStringToCharPatch2.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.
[jira] Commented: (TRINIDAD-145) ClassCastException when binding
number-grouping-separator
Posted by "Adam Winer (JIRA)" <de...@myfaces.apache.org>.
[ 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.