[seam-issues] [JBoss JIRA] (JBSEAM-4163) Nullpointerexception from s:selectItems when noSelectionLabel is present and converter of selectOneMenu evaluates to null

Marek Novotny (JIRA) issues at jboss.org
Wed Apr 2 09:55:15 EDT 2014


     [ https://issues.jboss.org/browse/JBSEAM-4163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marek Novotny closed JBSEAM-4163.
---------------------------------

    Resolution: Rejected

    
> Nullpointerexception from s:selectItems when noSelectionLabel is present and converter of selectOneMenu evaluates to null
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-4163
>                 URL: https://issues.jboss.org/browse/JBSEAM-4163
>             Project: Seam 2
>          Issue Type: Bug
>          Components: JSF Integration
>    Affects Versions: 2.1.1.GA
>            Reporter: Jakub Janczak
>
> The problem is that when you have the noSelectionLabel in s:selectItems it installs a converter chain in the h:selectOneMenu.
> <h:selectOneMenu converter="#{conv}" .... >
>    <s:selectItems noSelectionLabel="#{messages['noSelectionLabel']}" />
> </h:selectOneMenu>
> So when the #{conv} evaluates to null it  blows. The problem is in the PrioritizableConverter as it has the constructor:
> public PrioritizableConverter(ValueExpression vb, int priority)
>    {
>       this.valueExpression = vb;
>       this.priority = priority;
>    }
> and then
> public String getAsString(FacesContext context, UIComponent component, Object value)
>             throws ConverterException
>    {
>       return getDelegate().getAsString(context, component, value);
>    }
> public Converter getDelegate()
>    {
>       if (valueExpression != null)
>       {
>          return (Converter) valueExpression.getValue(FacesContext.getCurrentInstance().getELContext());
>       }
>       else
>       {
>          return delegate;
>       }
>    }
> so if getDelegate returns null it's not able to convert.
> The solution would be to disable adding the PrioritizableConverter to the chain when the #{conv} evaluates to null (ConverterChain.java : 73)

--
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


More information about the seam-issues mailing list