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

Jakub Janczak (JIRA) jira-events at lists.jboss.org
Wed May 6 09:08:46 EDT 2009


Nullpointerexception from s:selectItems when noSelectionLabel is present and converter of selectOneMenu evaluates to null
-------------------------------------------------------------------------------------------------------------------------

                 Key: JBSEAM-4163
                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4163
             Project: Seam
          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 (Converter.java : 73)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list