[ 
https://issues.apache.org/jira/browse/MYFACES-3710?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Leonardo Uribe resolved MYFACES-3710.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.12
                   2.0.18
         Assignee: Leonardo Uribe

_SelectItemsIterator usually involves evaluate EL expressions and that can be 
slow. The array is inexpensive compared to that, so it has sense to use it also 
in UISelectOne.

Thanks to Dennis Hoersch for provide this patch.
                
> Create SelectItemsIterator only once in UISelectOne.validateValue()
> -------------------------------------------------------------------
>
>                 Key: MYFACES-3710
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3710
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.1.11
>            Reporter: dennis hoersch
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.18, 2.1.12
>
>
> Creating the SelectItemsIterator seams to be a bit slow when using a big 
> collection. (At least using the Tomahawk UISlectItems and transforming a list 
> of Objects to SelectItems with evaluating expressions on each item.)
> UISelectMany stores the Iterator in a local collection to use that twice. I 
> think the same could be done in UISelectOne:
>       Collection<SelectItem> items = new ArrayList<SelectItem>();
>       for (Iterator<SelectItem> iter = new _SelectItemsIterator(this, 
> context); iter.hasNext();)
>       {
>           items.add(iter.next());
>       }
>       
>       // selected value must match to one of the available options
>       // and if required is true it must not match an option with 
> noSelectionOption set to true (since 2.0)
>       Converter converter = getConverter();
>       
>       if (_SelectItemsUtil.matchValue(context, this, value, items.iterator(), 
> converter))
>       {
>           if (! this.isRequired())
>           {
>               return; // Matched & Required false, so return ok.
>           }
>           if (! _SelectItemsUtil.isNoSelectionOption(context, this, value,
>                       items.iterator(), converter))
>           {
>               return; // Matched & Required true & No-selection did NOT 
> match, so return ok.
>           }
>       }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to