ICEfaces
  1. ICEfaces
  2. ICE-1263

SelectInputText.populateItemList() needs to check for NULL list

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5.2
    • Fix Version/s: 1.6DR#1, 1.6
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Operating System: Windows XP
      Platform: PC

      Description

      a client ran into the following NPE:

      Caused by: java.lang.NullPointerException
          at
      com.icesoft.faces.component.selectinputtext.SelectInputText.populateItemList(SelectInputText.java:239)
          at
      com.icesoft.faces.component.selectinputtext.SelectInputText.broadcast(SelectInputText.java:255)
          at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:269)
          at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:363)
          at
      com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:98)
          ... 32 more


      They were using a session-scoped bean with concurrentDOMViews and setting the
      list temporarily to null. We should check for null like so:

      void populateItemList() {
              if (getSelectFacet() != null) {
                  //facet being used on jsf page, so get the list from the value binding
                  itemList = getListValue();
              } else {
                  //selectItem or selectItems has been used on jsf page, so get the
      selectItems
                  itemList = Util.getSelectItems(FacesContext.getCurrentInstance(),
                                                 this);
              }
              if( itemList != null ){
                  Iterator items = itemList.iterator();
                  SelectItem item = null;
                  itemMap.clear();
                  while (items.hasNext()) {
                      item = (SelectItem) items.next();
                      itemMap.put(item.getLabel(), item);
                  }
              }
          }

        Activity

        Hide
        Adnan Durrani added a comment -

        The NullPointerException has been caught, which let application to execute and developer to know about it.

        Fixed have -r 13330

        Show
        Adnan Durrani added a comment - The NullPointerException has been caught, which let application to execute and developer to know about it. Fixed have -r 13330

          People

          • Assignee:
            Unassigned
            Reporter:
            Philip Breau
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: