You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by jw...@apache.org on 2007/07/31 19:27:02 UTC

svn commit: r561404 - /myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java

Author: jwaldman
Date: Tue Jul 31 10:27:01 2007
New Revision: 561404

URL: http://svn.apache.org/viewvc?view=rev&rev=561404
Log:
TRINIDAD-133 SkinExtension's getTranslatedValue performance improvement
on trunk
https://issues.apache.org/jira/browse/TRINIDAD-133
Cache base skin's non-null translatedValue with this skin to make it faster. 
Additional check in to handle the case where the SkinExtension has no resource bundles --
we weren't caching on the SkinExtension in this case, although we want to. This change
fixes that.

Modified:
    myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java

Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java?view=diff&rev=561404&r1=561403&r2=561404
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java Tue Jul 31 10:27:01 2007
@@ -431,12 +431,7 @@
       throw new NullPointerException("Null key");
 
     List<String> resourceBundleNames = _getResourceBundleNames();
-    
-    // if there is nothing to check, return null
-    if (resourceBundleNames.size() == 0)
-      return null;
-      
-   
+
     return _getCachedTranslationValueFromLocale(lContext, 
                                                 resourceBundleNames, key);
     
@@ -468,6 +463,9 @@
     }
     else
     {
+      // in the usual program flow, this won't get called here because the keyValueMapStatus
+      // is created in getCachedTranslatedValue's call of _getCachedTranslationValueFromLocale
+      // it is here as a safeguard in case the keyValueMapStatus isn't there.
       _createKeyValueMapStatusInCache(locale, key, value);    
     }
   }
@@ -853,6 +851,9 @@
     // the keyValueMap.
             
     int numberOfBundleNames = resourceBundleNames.size();
+    // if there is nothing to check, return null
+    if (numberOfBundleNames == 0)
+      return null;
     
     // in theory, multiple threads could get the same processedBundleIndex
     // here, so we could get all these threads updating the same map, but