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

(Application|Session|Request)Map.put(key,value) breaks Map-contract, returning new value, not old value

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.1.8.1
    • Fix Version/s: 2.2.1
    • Component/s: Dispatch Filter
    • Labels:
      None

      Description

      Noticed that the Map-wrapper classes (org.apache.struts2.dispatcher.RequestMap etc.) returns the new value from put-method.

      request.setAttribute(key.toString(), value);
      return get(key);

      Should be:

      V value = get(key);
      request.setAttribute(key.toString(), value);
      return value;

      in order to be consistent with other Map-implementations.

        Attachments

          Activity

            People

            • Assignee:
              lukaszlenart Lukasz Lenart
              Reporter:
              erlingm Erling Molde
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: