myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakob Korherr (JIRA)" <>
Subject [jira] Resolved: (MYFACES-2614) EnumConverter uses toString() instead of name()
Date Fri, 19 Mar 2010 14:15:27 GMT


Jakob Korherr resolved MYFACES-2614.

       Resolution: Fixed
    Fix Version/s:     (was: 1.2.9-SNAPSHOT)

As Leonardo wrote, we can only fix this for MyFaces 2.0, because the spec javadoc of JSF 1.2
specificly says that we have to use toString().

So if you don't want to change your application to use JSF 2.0, I am afraid you have to use
a custom converter. Sorry, but that is all we can do for this one!

> EnumConverter uses toString() instead of name()
> -----------------------------------------------
>                 Key: MYFACES-2614
>                 URL:
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.2.8, 2.0.0-beta-3
>            Reporter: gui
>            Assignee: Jakob Korherr
>             Fix For: 2.0.0-beta-3
> Hi, 
> I have an enum that has overridden the toString method. 
> It seems the EnumConverter uses toString to convert an enum to a string (and Enum.valueOf(..)
to find it back). However, since my toString is overriden, the value it returns is not valid
input for the Enum.valueOf(..) function and the converter raises an exception. 
> A better approach is to use .name() as string representation of an Enum. 

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

View raw message