You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2015/01/22 17:35:34 UTC

[jira] [Updated] (SLING-4344) Modifying i18n language node in a path outside the resource resolver's search path will not invalidate the ResourceBundle cache

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

Konrad Windszus updated SLING-4344:
-----------------------------------
    Summary: Modifying i18n language node in a path outside the resource resolver's search path will not invalidate the ResourceBundle cache  (was: Removing a i18n key in a path outside the resource resolver search path will not invalidate the ResourceBundleCache)

> Modifying i18n language node in a path outside the resource resolver's search path will not invalidate the ResourceBundle cache
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-4344
>                 URL: https://issues.apache.org/jira/browse/SLING-4344
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: i18n 2.3.4
>            Reporter: Konrad Windszus
>
> Currently any modification of a Sling i18n message will not invalidate the {{resourceBundleCache}} in the {{JcrResourceBundleProvide}} (https://github.com/apache/sling/blob/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java#L118), because the {{languageRoots}} for a {{JcrResourceBundle}} with a unique basename are always empty (https://github.com/apache/sling/blob/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundle.java#L211).
> I would argue that it should be allowed to place language nodes anywhere in the repository, which seems to work well except for the cache invalidation. The problem is in the {{loadFully}} method (https://github.com/apache/sling/blob/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundle.java#L155) which will only set languageRoots if they are below any of the resource resolver's search paths.
> To reproduce the issue you can just add the following node structure
> {code}
> /content/languages
>            +-- English (nt:folder, mix:language)
>            |    +-- jcr:language = en
>            |    +-- basename = myuniquebasename
>            |    +-- m1 (sling:messageEntry)
>            |    |    +-- sling:key = "msg001"
>            |    |    +-- sling:message = "This is a message"
> {code}
> Then load the key from this resource bundle (by giving the right basename). It will internally put the resource bundle into the cache (although all contents of the given resource bundle are outside any of the default search paths /apps or /libs). Whenever you change the message that won't be notified (because of the empty {{languageRoots}} therefore the old message would still be exposed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)