Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3010

s:iterator fails to iterate over collections containing null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.14
    • 2.5
    • None
    • None
    • any

    Description

      When using the struts2 taglib's iterator tag to iterate over a collection which contains nulls, the current value ("id") is not set to null, but to the value it had in the last iteration before. This behaviour is explicitly coded without any obvious reason. See IteratorComponent.java from line 219:

                  if ((id != null) && (currentValue != null)) {
                      //pageContext.setAttribute(id, currentValue);
                      //pageContext.setAttribute(id, currentValue, PageContext.REQUEST_SCOPE);
                      stack.getContext().put(id, currentValue);
                  }
      

      Expected behaviour: just iterate over the null values as a plain java iterator would.

      If nulls are forbidden for some important reason, it should throw an execption, but not return a wrong value.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dbaldes Daniel Baldes
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: