You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bs...@apache.org on 2010/03/02 04:34:31 UTC

svn commit: r917861 - /myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java

Author: bsullivan
Date: Tue Mar  2 03:34:30 2010
New Revision: 917861

URL: http://svn.apache.org/viewvc?rev=917861&view=rev
Log:
The default for clientId caching was accidentally true.  Argh!! Fix case where the component is moved between NamingContainers and therefore needs to clear the cached clientIds

Modified:
    myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java

Modified: myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java?rev=917861&r1=917860&r2=917861&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java (original)
+++ myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java Tue Mar  2 03:34:30 2010
@@ -488,7 +488,25 @@
   @Override
   public void setParent(UIComponent parent)
   {
-    _parent = parent;
+    if (parent != _parent)
+    {
+      _parent = parent;
+    
+      // clear cached client ids if necessary
+      if (_clientId != null)
+      {
+        String newClientId = _calculateClientId(FacesContext.getCurrentInstance());
+        
+        // if our clientId changed as a result of being reparented (because we moved
+        // between NamingContainers for instance) then we need to clear out
+        // all of the cached client ids for our subtree
+        if (!_clientId.equals(newClientId))
+        {
+          clearCachedClientIds();
+          _clientId = newClientId;
+        }
+      }
+    }
   }
 
 
@@ -1790,8 +1808,8 @@
     
     if (cacheClientIds == null)
     {
-      // see if client  is enabled for the application (the default is on)
-      boolean cachingEnabled = !Boolean.TRUE.equals(
+      // see if client  is enabled for the application (the default is off)
+      boolean cachingEnabled = Boolean.TRUE.equals(
                           context.getExternalContext().
                           getApplicationMap().get(_INIT_PROP_CLIENT_ID_CACHING_ENABLED));