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

Incorrect behavior for ELSupport.containsNulls()

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.14.3
    • 2.3.16
    • Plugin - Embedded JSP
    • any

    • Patch, Important

    Description

      The incorrect behavior appears in version 2.3.14.3 and in revision
      1495522. I attached a one-line patch (patch.diff) that fixes it.

      Method "ELSupport.containsNulls" checks if the "Object[] obj" array
      contains nulls like this:

      for (int i = 0; i < obj.length; i++) {
          if (obj[0] == null) {
              return true;
          }
      }
      return false;
      

      Instead of "obj[0]", the code should be "obj[i]", as in patch.diff.

      If indeed the code is intended to check only "obj[0]", then there is
      no need for a loop and the entire method body should be only "return
      obj[0] == null;" (I attached patch2.diff, though it's unlikely that
      this is the correct behavior).

      Attachments

        1. patch.diff
          0.6 kB
          Adrian Nistor
        2. patch2.diff
          0.7 kB
          Adrian Nistor

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            bphillips Bruce Allen Phillips
            adriannistor Adrian Nistor
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment