You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2005/12/01 10:41:19 UTC

svn commit: r350220 - /cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java

Author: joerg
Date: Thu Dec  1 01:41:11 2005
New Revision: 350220

URL: http://svn.apache.org/viewcvs?rev=350220&view=rev
Log:
Fixed yet another issue with caching of i18n bundles when using multiple locations.

Modified:
    cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java

Modified: cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java?rev=350220&r1=350219&r2=350220&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java Thu Dec  1 01:41:11 2005
@@ -236,7 +236,7 @@
                               ", directory: " + directories[index]);
         }
 
-        final String cacheKey = getCacheKey(directories, index, name, locale);
+        final String cacheKey = "XRB" + getCacheKey(directories, index, name, locale);
 
         XMLResourceBundle bundle = selectCached(cacheKey);
         if (bundle == null) {
@@ -319,10 +319,14 @@
      */
     protected String getCacheKey(String[] directories, int index, String name, Locale locale)
     throws SourceException {
-        StringBuffer cacheKey = new StringBuffer("XRB");
-        for (; index < directories.length; index++) {
+        StringBuffer cacheKey = new StringBuffer();
+        if (index < directories.length) {
             cacheKey.append(":");
             cacheKey.append(getSourceURI(directories[index], name, locale));
+            index++;
+            cacheKey.append(getCacheKey(directories, index, name, locale));
+        } else if ((locale != null && !locale.getLanguage().equals(""))) {
+            cacheKey.append(getCacheKey(directories, 0, name, getParentLocale(locale)));
         }
         return cacheKey.toString();
     }