You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Patrick Schwarzer <Pa...@tomtec.de> on 2019/01/16 12:56:23 UTC
Bug in AnnotProxyFieldValueFactory::getBeanName
Dear Sir or Madam,
we have done a Performance measurement on our application, which uses Wicket 7.10 to identify performance hotspots.
During this, we identified a programming issue in AnnotProxyFieldValueFactory::getBeanName:
/**
*
* @param field
* @return bean name
*/
private String getBeanName(final Field field, String name, boolean required, Class<?> generic)
{
if (Strings.isEmpty(name))
{
Class<?> fieldType = field.getType();
SimpleEntry<Class<?>, Class<?>> keyPair =
new SimpleEntry<Class<?>, Class<?>>(fieldType, generic);
name = beanNameCache.get(fieldType); // BUG HERE, must be keyPair, NOT fieldType
if (name == null)
{
name = getBeanNameOfClass(contextLocator.getSpringContext(), fieldType,
generic, field.getName());
if (name != null)
{
String tmpName = beanNameCache.putIfAbsent(keyPair, name); // keyPair is inserted into the Map here
if (tmpName != null)
{
name = tmpName;
}
}
}
}
...
It seems, that the caching mechanism is never used, because the get call uses the wrong parameter (fieldType instead of keyPair).
We are using Spring with Wicket, with many Components using @Inject annotation. We figured out, that this bug slows down the inject process of beans in our components significantly.
We also checked the current Wicket version 7.11 and 8.2, both having this issues.
Can you confirm this bug and told us, when there will be a bugfix?
Kind regards
PATRICK SCHWARZER
SOFTWARE ENGINEER
o +49 89 32175 655
TOMTEC Imaging Systems GmbH
Edisonstrasse 6, 85716 Unterschleissheim, Germany, Managing Director:
Johannes Waldinger, Dr. Thomas Piehler, HRB 235646 Amtsgericht Muenchen
[cid:image001.jpg@01D4AD9F.79464280]<http://www.tomtec.de/>
Re: Bug in AnnotProxyFieldValueFactory::getBeanName
Posted by sven <sv...@meiers.net>.
Hi Patrick,
confirmed, see WICKET-6631
We'll fix it as soon as possible.
Have fun
Sven
>
> On 16.01.2019 at 13:56, <Patrick Schwarzer> wrote:
>
>
>
>
> Dear Sir or Madam,
>
>
>
>
>
>
>
> we have done a Performance measurement on our application, which uses Wicket 7.10 to identify performance hotspots.
>
>
>
> During this, we identified a programming issue in AnnotProxyFieldValueFactory::getBeanName:
>
>
>
>
>
>
> /**
> *
> * @param field
> * @return bean name
> */
> private String getBeanName(final Field field, String name, boolean required, Class<?> generic)
> {
> if (Strings.isEmpty(name))
> {
> Class<?> fieldType = field.getType();
> SimpleEntry<Class<?>, Class<?>> keyPair =
> new SimpleEntry<Class<?>, Class<?>>(fieldType, generic);
>
> name = beanNameCache.get(fieldType); // BUG HERE, must be keyPair, NOT fieldType
> if (name == null)
> {
> name = getBeanNameOfClass(contextLocator.getSpringContext(), fieldType,
> generic, field.getName());
>
> if (name != null)
> {
>
> String tmpName = beanNameCache.putIfAbsent(keyPair, name); // keyPair is inserted into the Map here
> if (tmpName != null)
> {
> name = tmpName;
> }
> }
> }
> }
>
>
>
>
>
> …
>
>
>
>
>
>
>
> It seems, that the caching mechanism is never used, because the get call uses the wrong parameter (fieldType instead of keyPair).
>
>
>
> We are using Spring with Wicket, with many Components using @Inject annotation. We figured out, that this bug slows down the inject process of beans in our components significantly.
>
>
>
>
>
>
>
> We also checked the current Wicket version 7.11 and 8.2, both having this issues.
>
>
>
>
>
>
>
> Can you confirm this bug and told us, when there will be a bugfix?
>
>
>
>
>
>
>
> Kind regards
>
>
>
>
>
>
>
> PATRICK SCHWARZER
> SOFTWARE ENGINEER
>
> o+49 89 32175 655
>
> TOMTEC Imaging Systems GmbH
> Edisonstrasse 6, 85716 Unterschleissheim, Germany, Managing Director:
> Johannes Waldinger, Dr. Thomas Piehler, HRB 235646 Amtsgericht Muenchen
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>