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

XWorkMapPropertyAccessor calls getProperty twice if the value is null

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.1.1
    • Fix Version/s: 2.3.3
    • Component/s: Value Stack
    • Labels:
    • Flags:
      Patch

      Description

      If you evaluate an OGNL expression which has null value, XWorkMapPropertyAccessor does the evaluation twice.
      First in line 81: result = super.getProperty(context, target, name);
      Second in line 91: return super.getProperty(context, target, name);

      Performance can be improved by removing the second evaluation.
      Line 91: return null;
      This saves an extra evaluation, and at this point we can be sure that the result can only be null.

      Patch is attached.
      Please review it.

        Attachments

        1. WW-3743.diff
          0.8 kB
          Pelladi Gabor

          Activity

            People

            • Assignee:
              lukaszlenart Lukasz Lenart
              Reporter:
              pelladi Pelladi Gabor
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: