ICEfaces
  1. ICEfaces
  2. ICE-4545

selectItem will not render if label is null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 1.8.2-RC1, 1.8.2
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      All
    • Workaround Exists:
      Yes
    • Workaround Description:
      Ensure SelectItems are constructed with non null values.

      Description

      If the SelectItem constructer's label is null (SelectItem(java.lang.Object value, java.lang.String label)), ICEfaces will fail to render the SelectItem and will throw an exception. Here is the code required to reproduce the issue:

      public class BackingBean {

      private String selectedItem;

      private SelectItem[] items = new SelectItem[]{
      new SelectItem("value1","label1"),
      new SelectItem("value2","label2"),
      new SelectItem("value3",null),
      new SelectItem("value4","label4")
      };
      ........

      main.jspx

      <ice:selectOneMenu id="SlctCompTyp"
      partialSubmit="true">
      <f:selectItems id="SlctcompTypeItms"
      value="#{backingBean.items}"/>
      </ice:selectOneMenu>
      ........

      will cause the following exception to be thrown:

      16:21:06,926 WARN [lifecycle] executePhase(RENDER_RESPONSE 6,com.icesoft.faces.context.BridgeFacesContext@1e212d0) threw exception
      java.lang.NullPointerException
      at java.io.Writer.write(Unknown Source)
      at com.icesoft.faces.util.DOMUtils.printNode(DOMUtils.java:182)
      at com.icesoft.faces.util.DOMUtils.printNode(DOMUtils.java:168)
      at com.icesoft.faces.util.DOMUtils.printNode(DOMUtils.java:168)
      .....

      The workaround would of course be to have non null values. It would be nice to not throw such a nasty exception and instead handle it a bit more gracefully.

        Activity

          People

          • Assignee:
            yip.ng
            Reporter:
            Tyler Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: