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

When a getter of an action calls getText("getterName.something"), method call stack overflow occurs

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.3.15.1
    • Fix Version/s: 2.5.x
    • Component/s: None
    • Labels:
      None
    • Environment:

      Windows Vista, Java 7, Tomcat 7

      Description

      Under a certain condition, calling a getter of an action causes method call stack overflow.
      If a jsp file contains a <s:debug /> tag, it doesn't work and throws java.util.ConcurrentModificationException.

      The condition is described below.

      • The action class extends com.opensymphony.xwork2.ActionSupport.
      • The action class has a getter and the getter calls the action class's method getText().
        The argument of getText() is like "getterName.something".
        If the getter is getFoo(), the argument is like 'foo.bar'.
      • An empty properties file exists with the same name as the action class in the same package.
        If the action class is TestAction, the name of the properties file is TestAction.properties
      • The JSP file has tag <s:debug />.

      It seems that <s:debug /> tries to call getFoo() and causes call stack overflow.
      It has something to do with the problem?

      1. <s:debug /> calls the action class's method getFoo().
      2. getFoo() calls getText("foo.bar").
      3. getText() calls LocalizedTextUtil.findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack).
      4. There is no property named foo.bar, so LocalizedTextUtil.findText() tries to get "foo.bar" from the value stack.
      5. The action class instance is on the top of the value stack, so the action class's getFoo() is called.
      6. Go back to 2. This loop continues infinitely....

        Attachments

        1. src.zip
          1.0 kB
          recyclebin5385
        2. WebContent.zip
          2 kB
          recyclebin5385

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              recyclebin5385@yahoo.co.jp recyclebin5385
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: