You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2009/02/13 17:14:20 UTC

svn commit: r744158 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/Localizer.java

Author: jdonnerstag
Date: Fri Feb 13 16:14:20 2009
New Revision: 744158

URL: http://svn.apache.org/viewvc?rev=744158&view=rev
Log:
fixed wicket-2102: Localizer never caches resources when component is not given

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/Localizer.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Localizer.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Localizer.java?rev=744158&r1=744157&r2=744158&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Localizer.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Localizer.java Fri Feb 13 16:14:20 2009
@@ -41,7 +41,7 @@
  * <p>
  * You may register additional IStringResourceLoader to extend or replace Wickets default search
  * strategy for the properties. E.g. string resource loaders which load the properties from a
- * database. There should be no need to extend Localizer.
+ * database. There should be hardly any need to extend Localizer.
  * 
  * @see org.apache.wicket.settings.Settings#getLocalizer()
  * @see org.apache.wicket.resource.loader.IStringResourceLoader
@@ -186,7 +186,7 @@
 		boolean addedToPage = false;
 		if (component != null)
 		{
-			if ((component instanceof Page) || null != component.findParent(Page.class))
+			if ((component instanceof Page) || (null != component.findParent(Page.class)))
 			{
 				addedToPage = true;
 			}
@@ -206,7 +206,7 @@
 
 		// If this component is not yet added to page we do not want to check
 		// cache as we can generate an invalid cache key
-		if ((cache != null) && addedToPage)
+		if ((cache != null) && ((component == null) || addedToPage))
 		{
 			cacheKey = getCacheKey(key, component);
 		}