You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Martin Koci (JIRA)" <de...@myfaces.apache.org> on 2010/02/10 22:15:27 UTC

[jira] Created: (MYFACES-2546) Conversion rules for obtaing renderable String from the "value" property of SelectItem

Conversion rules for obtaing renderable String from the "value" property of SelectItem
--------------------------------------------------------------------------------------

                 Key: MYFACES-2546
                 URL: https://issues.apache.org/jira/browse/MYFACES-2546
             Project: MyFaces Core
          Issue Type: Improvement
          Components: JSR-314
    Affects Versions: 2.0.0-beta-2
         Environment: myfaces trunk
            Reporter: Martin Koci
            Priority: Minor


<h:selectOneMenu>
        <f:selectItems value="#{model.selectItemsWithNonStringValue}" />
</h:selectOneMenu>

if SelectItem.getValue() returns other type than String and there is no converter for that type, myfaces throw exception: java.lang.IllegalArgumentException: Value is no String
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:633)
	at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:652)
	at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderSelectOptions(HtmlRendererUtils.java:538)


RI does not throw a exception but with quietness outputs toString() as <option> value.

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


[jira] Commented: (MYFACES-2546) Conversion rules for obtaing renderable String from the "value" property of SelectItem

Posted by "Martin Koci (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12832227#action_12832227 ] 

Martin Koci commented on MYFACES-2546:
--------------------------------------

Trinidad also renders item.value.toString() - see org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectOneChoiceRenderer.encodeSelectItems() for example.

> Conversion rules for obtaing renderable String from the "value" property of SelectItem
> --------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2546
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2546
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>         Environment: myfaces trunk
>            Reporter: Martin Koci
>            Priority: Minor
>         Attachments: MYFACES-2546.patch
>
>
> <h:selectOneMenu>
>         <f:selectItems value="#{model.selectItemsWithNonStringValue}" />
> </h:selectOneMenu>
> if SelectItem.getValue() returns other type than String and there is no converter for that type, myfaces throw exception: java.lang.IllegalArgumentException: Value is no String
> at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:633)
> 	at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:652)
> 	at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderSelectOptions(HtmlRendererUtils.java:538)
> RI does not throw a exception but with quietness outputs toString() as <option> value.

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


[jira] Updated: (MYFACES-2546) Conversion rules for obtaing renderable String from the "value" property of SelectItem

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2546?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe updated MYFACES-2546:
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0
         Assignee: Leonardo Uribe
           Status: Resolved  (was: Patch Available)

> Conversion rules for obtaing renderable String from the "value" property of SelectItem
> --------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2546
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2546
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>         Environment: myfaces trunk
>            Reporter: Martin Koci
>            Assignee: Leonardo Uribe
>            Priority: Minor
>             Fix For: 2.0.0
>
>         Attachments: MYFACES-2546.patch
>
>
> <h:selectOneMenu>
>         <f:selectItems value="#{model.selectItemsWithNonStringValue}" />
> </h:selectOneMenu>
> if SelectItem.getValue() returns other type than String and there is no converter for that type, myfaces throw exception: java.lang.IllegalArgumentException: Value is no String
> at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:633)
> 	at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:652)
> 	at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderSelectOptions(HtmlRendererUtils.java:538)
> RI does not throw a exception but with quietness outputs toString() as <option> value.

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


[jira] Updated: (MYFACES-2546) Conversion rules for obtaing renderable String from the "value" property of SelectItem

Posted by "Martin Koci (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2546?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Koci updated MYFACES-2546:
---------------------------------

    Status: Patch Available  (was: Open)

> Conversion rules for obtaing renderable String from the "value" property of SelectItem
> --------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2546
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2546
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>         Environment: myfaces trunk
>            Reporter: Martin Koci
>            Priority: Minor
>         Attachments: MYFACES-2546.patch
>
>
> <h:selectOneMenu>
>         <f:selectItems value="#{model.selectItemsWithNonStringValue}" />
> </h:selectOneMenu>
> if SelectItem.getValue() returns other type than String and there is no converter for that type, myfaces throw exception: java.lang.IllegalArgumentException: Value is no String
> at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:633)
> 	at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:652)
> 	at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderSelectOptions(HtmlRendererUtils.java:538)
> RI does not throw a exception but with quietness outputs toString() as <option> value.

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


[jira] Commented: (MYFACES-2546) Conversion rules for obtaing renderable String from the "value" property of SelectItem

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12854142#action_12854142 ] 

Leonardo Uribe commented on MYFACES-2546:
-----------------------------------------

The patch is correct. The interpretation of the javadoc is that is necessary first to convert the value property using the conversion rules, that means, get a converter for the value if available and othewise try to use the default converter. We are doing this step when we call RendererUtils.findUISelectManyConverter, HtmlRendererUtils.findUIOutputConverterFailSafe, RendererUtils.findUIOutputConverter.

Really we are doing what spec says, but if ri is calling toString() as last effort, we should do the same too.

> Conversion rules for obtaing renderable String from the "value" property of SelectItem
> --------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2546
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2546
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>         Environment: myfaces trunk
>            Reporter: Martin Koci
>            Priority: Minor
>             Fix For: 2.0.0
>
>         Attachments: MYFACES-2546.patch
>
>
> <h:selectOneMenu>
>         <f:selectItems value="#{model.selectItemsWithNonStringValue}" />
> </h:selectOneMenu>
> if SelectItem.getValue() returns other type than String and there is no converter for that type, myfaces throw exception: java.lang.IllegalArgumentException: Value is no String
> at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:633)
> 	at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:652)
> 	at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderSelectOptions(HtmlRendererUtils.java:538)
> RI does not throw a exception but with quietness outputs toString() as <option> value.

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