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

NullPointerException when <s:iterator> value array contains a null in the first entry

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 6.4.0
    • 6.6.1
    • None
    • None

    Description

      When the first entry in an array contains a null value, and that array is used as the source for an <s:iterator> tag, a NullPointerException is thrown. This exception did not occur in prior versions of Struts 6.x

      Exception:

       

      ERROR org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler - Exception occurred during processing request: null
      java.lang.NullPointerException: null
          at org.apache.struts2.components.IteratorComponent.start(IteratorComponent.java:309) ~[struts2-core-6.4.0.jar:6.4.0]
          at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:51) ~[struts2-core-6.4.0.jar:6.4.0]
          ...

       

       

      A trivial example would be this tag:

      <s:iterator value="pages">
          ...
      </s:iterator>

      and Action:

       

      public class TestAction extends ActionSupport {    
          private Object[] pages = null;    
          
          public String prompt() throws Exception {
              pages = new Object[10];
              return SUCCESS;
          }
      }
      

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jonp Jon Pulice
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m