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

        Tyler Johnson created issue -
        Tyler Johnson made changes -
        Field Original Value New Value
        Support Case References https://www.icesoft.ca:4443/supportilla/show_bug.cgi?id=5118
        Ken Fyten made changes -
        Fix Version/s 1.7.2 [ 10130 ]
        Assignee Priority P2
        Assignee Yip Ng [ yip.ng ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #17402 Fri Aug 22 10:42:38 MDT 2008 yip.ng ICE-3417
        Changed to check for return of null from converter.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/MenuRenderer.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #17403 Fri Aug 22 10:43:47 MDT 2008 yip.ng ICE-3417
        Changed to check for return of null from converter.
        Files Changed
        Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/MenuRenderer.java
        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.
        yip.ng made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        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?
        yip.ng made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Ken Fyten made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Assignee Priority P2
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Fix Version/s 1.7.2RC1 [ 10140 ]
        Fix Version/s 1.7.2 [ 10130 ]
        Ken Fyten made changes -
        Fix Version/s 1.7.2 [ 10130 ]
        Fix Version/s 1.7.2RC1 [ 10140 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Yip Ng [ yip.ng ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: