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

OgnlValueStack causes race condition

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.16.1
    • 2.3.20
    • Core Actions, Value Stack
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: