Struts 2
  1. Struts 2
  2. WW-1814

Default TypeConverters always created with default ObjectFactory

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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)

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        5d 12h 46m 1 Ted Husted 20/Mar/07 02:58
        Resolved Resolved Closed Closed
        2049d 19h 9m 1 Lukasz Lenart 28/Oct/12 22:08
        Lukasz Lenart made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Jeff Turner made changes -
        Project Import Mon Feb 01 01:17:42 UTC 2010 [ 1264987062082 ]
        Antonio Petrelli made changes -
        Workflow Struts - editable closed status (temporary) [ 47218 ] Struts - editable closed status [ 52474 ]
        Antonio Petrelli made changes -
        Workflow Struts - editable closed status [ 42487 ] Struts - editable closed status (temporary) [ 47218 ]
        Jeff Turner made changes -
        Workflow Struts [ 41121 ] Struts - editable closed status [ 42487 ]
        Hide
        Jasper Rosenberg added a comment -

        That looks great to me! Can't wait for 2.0.7 so I can ditch some of this local customization...

        Show
        Jasper Rosenberg added a comment - That looks great to me! Can't wait for 2.0.7 so I can ditch some of this local customization...
        Ted Husted made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Ted Husted [ husted ]
        Fix Version/s 2.1.0 [ 21794 ]
        Hide
        Ted Husted added a comment -

        Completed: At revision: 520241, 520243

        The static block now reads

        <!-- Only have static injections -->
        <bean class="com.opensymphony.xwork2.ObjectFactory" static="true" />
        <bean class="com.opensymphony.xwork2.util.XWorkConverter" static="true" />
        <bean class="com.opensymphony.xwork2.util.OgnlValueStack" static="true" />
        <bean class="org.apache.struts2.dispatcher.Dispatcher" static="true" />
        <bean class="org.apache.struts2.components.Include" static="true" />
        <bean class="org.apache.struts2.dispatcher.FilterDispatcher" static="true" />
        <bean class="org.apache.struts2.views.util.ContextUtil" static="true" />
        <bean class="org.apache.struts2.views.util.UrlHelper" static="true" />

        Show
        Ted Husted added a comment - Completed: At revision: 520241, 520243 The static block now reads <!-- Only have static injections --> <bean class="com.opensymphony.xwork2.ObjectFactory" static="true" /> <bean class="com.opensymphony.xwork2.util.XWorkConverter" static="true" /> <bean class="com.opensymphony.xwork2.util.OgnlValueStack" static="true" /> <bean class="org.apache.struts2.dispatcher.Dispatcher" static="true" /> <bean class="org.apache.struts2.components.Include" static="true" /> <bean class="org.apache.struts2.dispatcher.FilterDispatcher" static="true" /> <bean class="org.apache.struts2.views.util.ContextUtil" static="true" /> <bean class="org.apache.struts2.views.util.UrlHelper" static="true" />
        Ted Husted made changes -
        Field Original Value New Value
        Fix Version/s 2.0.7 [ 21796 ]
        Hide
        Jasper Rosenberg added a comment -

        Whoops, I see the primary issue was already solved here: WW-1754

        It would still be a good idea to reverse the order of the OgnlValueStack and XWorkConverter static injections though.

        Show
        Jasper Rosenberg added a comment - Whoops, I see the primary issue was already solved here: WW-1754 It would still be a good idea to reverse the order of the OgnlValueStack and XWorkConverter static injections though.
        Jasper Rosenberg created issue -

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development