ICEfaces
  1. ICEfaces
  2. ICE-3417

formattedSelectedValue is accessed without checking if its value is null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.1
    • Fix Version/s: 1.7.2
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      All

      Description

      Hi,
      I'm using ICEFaces 1.7.1.
      In the following method:

      com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer.isSelected(Object, Object, FacesContext, UIComponent)

      at line 478 a NullPointerException occurs.
      The problem is that the variable formattedSelectedValue is accessed without checking if its value is null:

      else if (formattedSelectedValue.equals(formattedSentinel))

      This situation is very uncommon in most cases, but in my application a Converter can return a null value when is executed and this is the reason why the NPE occurs.
      In fact, "nextSelectedValue" is not null, but the following line of code returns null (line 462 in MenuRenderer) because the registered Converter returns null:

      formattedSelectedValue = formatComponentValue(facesContext, uiComponent, nextSelectedValue);

      I've modified ICEFaces sources with this little fix and now every thing seems working fine:

      } else if (formattedSelectedValue!=null && formattedSelectedValue.equals(formattedSentinel)) {

      I hope you can fix this in the next version of ICEFaces.

        Activity

        Hide
        yip.ng added a comment -

        Fix applied, but note that according the JSF API specs (1.1 & 1.2), the converter should return an empty string rather than null.

        Show
        yip.ng added a comment - Fix applied, but note that according the JSF API specs (1.1 & 1.2), the converter should return an empty string rather than null.
        Hide
        yip.ng added a comment -

        From Jacky:

        How do you reproduce the error for testing?

        Show
        yip.ng added a comment - From Jacky: How do you reproduce the error for testing?

          People

          • Assignee:
            Unassigned
            Reporter:
            Tyler Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: