You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/08/16 00:16:12 UTC

svn commit: r1158033 - in /myfaces/core/trunk/api/src/main/java/javax/faces/component: UIComponentBase.java _ComponentUtils.java

Author: lu4242
Date: Mon Aug 15 22:16:11 2011
New Revision: 1158033

URL: http://svn.apache.org/viewvc?rev=1158033&view=rev
Log:
MYFACES-3268 UIComponentBase.findComponent does not allow use the same id for a child component (limit search to current NamingContainer)

Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java
    myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentUtils.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java?rev=1158033&r1=1158032&r2=1158033&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java Mon Aug 15 22:16:11 2011
@@ -630,20 +630,20 @@ public abstract class UIComponentBase ex
             {
                 //innerExpr1 = null;
                 //nextId= innerExpr;
-                return _ComponentUtils.innerFindComponent(findBase, innerExpr, null);
+                return _ComponentUtils.findComponentChildOrFacetFrom(findBase, innerExpr, null);
             }
             else
             {
                 //innerExpr1 = innerExpr.substring(separator+1);
                 //nextId = innerExpr.substring(0,separator);
-                return _ComponentUtils.innerFindComponent(findBase, innerExpr.substring(0,separator), innerExpr);
+                return _ComponentUtils.findComponentChildOrFacetFrom(findBase, innerExpr.substring(0,separator), innerExpr);
             }
         }
         else
         {
             //At this point, findBase has a NamingContainer that does not match with the id.
             //We need to scan from this component the full expression.
-            return _ComponentUtils.innerFindComponent(findBase, expr, null);
+            return _ComponentUtils.findComponentChildOrFacetFrom(findBase, expr, null);
         }
     }
 

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentUtils.java?rev=1158033&r1=1158032&r2=1158033&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentUtils.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentUtils.java Mon Aug 15 22:16:11 2011
@@ -151,7 +151,7 @@ class _ComponentUtils
         return null;
     }
     
-    static UIComponent innerFindComponent(UIComponent parent, String id, String innerExpr)
+    static UIComponent findComponentChildOrFacetFrom(UIComponent parent, String id, String innerExpr)
     {
         if (parent.getFacetCount() > 0)
         {
@@ -172,9 +172,9 @@ class _ComponentUtils
                         }
                     }
                 }
-                else
+                else if (!(facet instanceof NamingContainer))
                 {
-                    UIComponent find = innerFindComponent(facet, id, innerExpr);
+                    UIComponent find = findComponentChildOrFacetFrom(facet, id, innerExpr);
                     if (find != null)
                     {
                         return find;
@@ -202,9 +202,9 @@ class _ComponentUtils
                         }
                     }
                 }
-                else
+                else if (!(child instanceof NamingContainer))
                 {
-                    UIComponent find = innerFindComponent(child, id, innerExpr);
+                    UIComponent find = findComponentChildOrFacetFrom(child, id, innerExpr);
                     if (find != null)
                     {
                         return find;
@@ -215,7 +215,6 @@ class _ComponentUtils
         return null;
     }
 
-
     /*
      * Return true if the specified component matches the provided id. This needs some quirks to handle components whose
      * id value gets dynamically "tweaked", eg a UIData component whose id gets the current row index appended to it.