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

Wasted work in PackageBasedActionConfigBuilder.checkPackageLocators()

    XMLWordPrintableJSON

Details

    • Patch, Important

    Description

      The problem appears in version 2.3.14.3 and in revision 1493157. I
      attached a two-line patch (patch.diff) that fixes it.

      In method "PackageBasedActionConfigBuilder.checkPackageLocators", the
      loop over "packageLocators" should only be executed when
      "classPackageName.length() > 0" is "true", because the loop's only
      side effect (the "return true;" statement) cannot be executed when
      "classPackageName.length() > 0" is "false". Note that
      "classPackageName" is not modified inside the loop.

      In fact, the loop over "packageLocators" should be executed only when
      the condition of the loop's "if":

      if (classPackageName.length() > 0
              && (packageLocatorsBasePackage == null || classPackageName
              .startsWith(packageLocatorsBasePackage)))
      

      is "true", because the loop's only side effect (the "return true;"
      statement) cannot be executed when this condition is false. Also, the
      elements inside this condition are not modified inside the loop. I
      attached a second patch (patchFull.diff) that implements this complete
      solution.

      Attachments

        1. patchFull.diff
          2 kB
          Adrian Nistor
        2. patch.diff
          1 kB
          Adrian Nistor

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: