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

Incorrect behavior for ELSupport.containsNulls()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.14.3
    • Fix Version/s: 2.3.16
    • Component/s: Plugin - Embedded JSP
    • Labels:
    • Environment:

      any

    • Flags:
      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. patch2.diff
          0.7 kB
          Adrian Nistor
        2. patch.diff
          0.6 kB
          Adrian Nistor

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: