You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2009/06/17 18:20:59 UTC

svn commit: r785702 - /myfaces/trinidad/branches/1.2.11.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java

Author: matzew
Date: Wed Jun 17 16:20:58 2009
New Revision: 785702

URL: http://svn.apache.org/viewvc?rev=785702&view=rev
Log:
TRINIDAD-1511 - Minor bug in the scoped id generator util class - base component being namingcontainer not handled

Thanks to Prakash Udupa for the patch

Modified:
    myfaces/trinidad/branches/1.2.11.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java

Modified: myfaces/trinidad/branches/1.2.11.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.11.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java?rev=785702&r1=785701&r2=785702&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.11.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java (original)
+++ myfaces/trinidad/branches/1.2.11.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java Wed Jun 17 16:20:58 2009
@@ -477,16 +477,22 @@
 
   /**
    * Returns the naming container of the component. This method makes sure that
-   * we don't go beyond the root component. 
+   * we don't go beyond the a supplied base component. 
    * @param component the UIComponent 
    * @param baseComponent The component to limit the search up to.
    * @return the naming container of the component which has to be in the 
-   * hierarchy of the root parent
+   * subtree rooted by the baseComponent. Returns null if no such ancestor 
+   * naming container component exists.
    */
   private static UIComponent _getParentNamingContainer(
     UIComponent component,
     UIComponent baseComponent)
   {
+    // Optimize when both arguments are the same - could happen due to recursion
+    //  in _buildScopedId()
+    if (component.equals(baseComponent))
+      return null;
+    
     UIComponent checkedParent = component.getParent();
     
     while(checkedParent != null)