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

Not fully initialized ObjectFactory tries to create beans

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.5.12
    • 2.5.13
    • None
    • None

    Description

      This leads to issues when properties aren't injected in some cases, for example in custom type converters.

      The problem happens when ObjectFactory tries to create a bean in the same time not being fully initialized itself (e.g. ConverterFactory injected before Container).

      The issue happens more often under linux (all the time basically) than under windows, so it cannot be reproduced 100%. This behavior boils down to the fact that clazz.getDeclaredMethods() is used to get methods which needs to be injected and clazz.getDeclaredMethods() returned elements are - The elements in the array returned are not sorted and are not in any particular order.

      Proposed solution moves Container injection from method to constructor in ObjectFactory - https://github.com/aleksandr-m/struts/commit/6f91d0776a545c911ca4f2875ed9976614711ef9.

      The downside is it isn't backward-compatible, custom object factories must be updated.

      Attachments

        Activity

          People

            lukaszlenart Lukasz Lenart
            aleksandr-m Aleksandr Mashchenko
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: