struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aleksandr Mashchenko (JIRA)" <>
Subject [jira] [Commented] (WW-4827) Not fully initialized ObjectFactory tries to create beans
Date Fri, 28 Jul 2017 07:32:01 GMT


Aleksandr Mashchenko commented on WW-4827:

You mean {{buildConverter}} in {{ObjectFactory}}? Not sure.

One particular case when the injection fails goes like that: {{ObjectFactory}} is created
and injections begins: {{InterceptorFactory}} -> {{ReflectionProvider}} -> {{OgnlUtil}}
-> {{XWorkConverter}} -> {{ConversionPropertiesProcessor}} -> {{TypeConverterCreator}}
-> {{ObjectFactory}}. Then {{ObjectFactory#buildBean}} is called, next {{ObjectFactory#injectInternalBeans}}
and {{container}} is null. This is because injection in {{ObjectFactory}} started with {{setInterceptorFactory}}
and {{setContainer}} wasn't called yet.

> Not fully initialized ObjectFactory tries to create beans
> ---------------------------------------------------------
>                 Key: WW-4827
>                 URL:
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.5.12
>            Reporter: Aleksandr Mashchenko
>            Priority: Critical
>             Fix For: 2.5.13
> 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
> Proposed solution moves Container injection from method to constructor in ObjectFactory
> The downside is it isn't backward-compatible, custom object factories must be updated.

This message was sent by Atlassian JIRA

View raw message