You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Stefan Fussenegger (JIRA)" <ji...@apache.org> on 2010/05/17 15:51:44 UTC

[jira] Updated: (WICKET-2875) Heavily Broken Caching in Injector

     [ https://issues.apache.org/jira/browse/WICKET-2875?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Fussenegger updated WICKET-2875:
---------------------------------------

    Attachment: wicket-2875.patch

a very simple patch that fixes this bug

> Heavily Broken Caching in Injector
> ----------------------------------
>
>                 Key: WICKET-2875
>                 URL: https://issues.apache.org/jira/browse/WICKET-2875
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.4.9
>         Environment: current trunk version
>            Reporter: Stefan Fussenegger
>         Attachments: wicket-2875.patch
>
>
> The caching implementation in org.apache.wicket.injection.Injector is heavily broken. for each (!) component, a ConcurrentHashMap is created and findFields(..) get called. This happens as a new container is created for every yet unknown class instead of yet unknown ClassLoaders.
> this is the erroneous code:
> {code:java}
> // try cache
> ConcurrentHashMap<String, Field[]> container = cache.get(clazz.getClassLoader());
> if (container != null)
> {
> 	fields = container.get(clazz.getName());
> }
> if (fields == null)
> {
> 	fields = findFields(clazz, factory);
> 	// write to cache
> 	container = new ConcurrentHashMap<String, Field[]>();
> 	container.put(clazz.getName(), fields);
> 	cache.put(clazz.getClassLoader(), container);
> }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.