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

OgnlValueStack causes race condition

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.16.1
    • Fix Version/s: 2.3.20
    • Component/s: Core Actions, Value Stack
    • Labels:
      None
    • Flags:
      Patch

      Description

      com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.callMethod is not thread safe because of unsynchronized reads and writes to HashMap:

      private static Map invalidMethods = new HashMap();
      ...
      public Object callMethod(Map context, Object target, String name, Object[] objects) throws MethodFailedException {
          ...
          if ((argTypes == null) || !invalidMethods.containsKey(mc)) {
              ...
              invalidMethods.put(mc, Boolean.TRUE);
              ...
          }
          ...
      }
      

      Propose to use ConcurrentHashMap

        Attachments

        1. CompoundRootAccessor.java.patch
          1 kB
          Igor Evgrafov

          Activity

            People

            • Assignee:
              lukaszlenart Lukasz Lenart
              Reporter:
              sergey.gromov Sergey Gromov
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: