[ 
https://issues.apache.org/jira/browse/SLING-4344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14301462#comment-14301462
 ] 

Alexander Klimetschek commented on SLING-4344:
----------------------------------------------

IMO Sling i18n is not really designed for customer-changeable string 
dictionaries.

> 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.2
>            Reporter: Konrad Windszus
>             Fix For: i18n 2.3.4
>
>         Attachments: SLING-4344-v02.patch
>
>
> 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 and contents only outside of the resource resolver's search path 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 
> reflected, because the resource bundle cache is not invalidated (caused by 
> the empty {{languageRoots}}) therefore the old message would still be 
> exposed, until you restart the Sling i18n bundle.



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

Reply via email to