When validating select items use converter on both sides
--------------------------------------------------------

                 Key: MYFACES-1730
                 URL: https://issues.apache.org/jira/browse/MYFACES-1730
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 1.1.5
            Reporter: Ondrej Svetlik


I'm using converters to convert enums to Strings and back and I get a 
validation error that "Value is not a valid option."

in class javax.faces.component._SelectItemsUtil
there is

    public static boolean matchValue(Object value,
                    Iterator selectItemsIter)
    {
        while (selectItemsIter.hasNext())
        {
            SelectItem item = (SelectItem) selectItemsIter.next();
            if (item instanceof SelectItemGroup)
            {
...
            }
            else
            {
                Object itemValue = item.getValue();
// here itemValue is a String but value (submited value) is already converted 
do my Enum<E>
                if (value==itemValue || value.equals(itemValue))
                {
                    return true;
                }
            }
        }
        return false;
    }
}

I cannot override the Enum.equals() method because it is final.

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

Reply via email to