myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alois Vitasek (JIRA)" <>
Subject [jira] Created: (MYFACES-1382) SelectItem getValue type problem
Date Thu, 10 Aug 2006 14:55:14 GMT
SelectItem getValue type problem

                 Key: MYFACES-1382
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 1.1.3
         Environment: Tomcat 5.0.28
            Reporter: Alois Vitasek
            Priority: Minor

Sorry for my english please.

I am using list of SelectItem objects to fill data in listbox. Listbox is using
an converor.

SelectItem object has method getValue, which returns a type Object.
In my case is type of the value property an Integer.

In class 


is method matchValue which is testing if value of the componet exists
in set of values in the listbox. Listbox contais "raw values", value in listbox
is converted.

The code is

                Object itemValue = item.getValue();
                if(converter != null && itemValue instanceof String)
                    itemValue = converter.getConvertedValue(context, (String)itemValue);
                if (value==itemValue || value.equals(itemValue))

If in listbox are values not in type String (for example Integer), convertor is not
invoked and following test will fails and application will end with validation error exception.

This problem can be solved if only Strings  are used as value in listbox which are using
convertors. (trap ?)

Or change this code to something like this:

                Object itemValue = item.getValue();
                if(converter != null)
                    itemValue = converter.getConvertedValue(context, itemValue.toString());

Or not allow to use no String value in a SelectItem object.

Alois Vitasek

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message