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

Wasted work in Struts1Factory.convertErrors()

    Details

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

      any

    • Flags:
      Patch, Important

      Description

      The problem appears in version 2.3.14.3 and in revision 1495522. I
      attached a simple patch that fixes it. This problem and the attached
      patch are similar to the previously fixed WW-4116 and its patch.

      In method "Struts1Factory.convertErrors", the loop over "errors"
      should only be executed when "text != null" or "vaction != null" are
      "true", because the loop has no side effects when "text != null" and
      "vaction != null" are both "false". Note that "text" and "vaction"
      are not modified inside the loop.

      The patch just adds one line, the check:

      if (text != null || vaction != null) {
      

      The patch looks large because the entire loop is indented one level,
      but the above check is the only code added.

        Attachments

        1. patch.diff
          2 kB
          Adrian Nistor

          Activity

            People

            • Assignee:
              lukaszlenart Lukasz Lenart
              Reporter:
              adriannistor Adrian Nistor
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: