Konrad Windszus created SLING-4344:
--------------------------------------

             Summary: Removing a i18n key in a path outside the resource 
resolver search path will not invalidate the ResourceBundleCache
                 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)

Reply via email to