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

Default TypeConverters always created with default ObjectFactory

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.6
    • Fix Version/s: 2.0.7, 2.1.0
    • Component/s: XML Configuration
    • Labels:
      None
    • Flags:
      Patch

      Description

      XWorkConverter uses ObjectFactory.getObjectFactory() when loading default TypeConvertors in its constructor. However, currently in struts-default.xml, the ObjectFactory has its static injections after the XWorkConverter does, so when the XWorkConverter is constructed, it ends up using the default ObjectFactory (as set in DefaultConfiguration.reload()).

      The fix is easy, just move:
      <bean class="com.opensymphony.xwork2.ObjectFactory" static="true" />
      to be the first static injection.

      Also, while you are there,
      <bean class="com.opensymphony.xwork2.util.XWorkConverter" static="true" />
      should also be moved to be before
      <bean class="com.opensymphony.xwork2.util.OgnlValueStack" static="true" />

      This is because XWorkMapPropertyAccessor staticly creates an instance of XWorkMapPropertyAccessor which in turn staticlly gets an instance of the XWorkConverter. (Necessary until the XWork 2 issue is resolved: http://jira.opensymphony.com/browse/XW-492)

        Attachments

          Activity

            People

            • Assignee:
              husted Ted Husted
              Reporter:
              perfnorm Jasper Rosenberg
            • Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: