[ 
https://issues.apache.org/jira/browse/WICKET-2102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674565#action_12674565
 ] 

Pavel Cernocky commented on WICKET-2102:
----------------------------------------

Attached diff2.patch contains fix which pulls out locale from session (when no 
component is given) and appends it to cacheKey.
It's not the cleanest solution (to access Session here), but definitely faster 
than before.

> Localizer never caches resources when component is not given
> ------------------------------------------------------------
>
>                 Key: WICKET-2102
>                 URL: https://issues.apache.org/jira/browse/WICKET-2102
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5
>            Reporter: Pavel Cernocky
>            Assignee: Juergen Donnerstag
>             Fix For: 1.4-RC3
>
>         Attachments: diff.patch, diff2.patch
>
>
> In org.apache.wicket.Localizer.getString(String, Component, IModel, String) 
> there's this code:
> // If this component is not yet added to page we do not want to check
> // cache as we can generate an invalid cache key
> if ((cache != null) && addedToPage)
> {
>       cacheKey = getCacheKey(key, component);
> }
> If the component is null, then addedToPage is always false, thus cacheKey is 
> never populated and possibly found resource is never put in cache.
> The condition should be:
> if ((cache != null) && (component == null || addedToPage))
> Cheers,
> Palo

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

Reply via email to