You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2011/10/21 21:49:30 UTC

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

Author: bommel
Date: Fri Oct 21 19:49:29 2011
New Revision: 1187529

URL: http://svn.apache.org/viewvc?rev=1187529&view=rev
Log:
suggested fix for (MYFACES-3364) and (MYFACES-3268)

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=1187529&r1=1187528&r2=1187529&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 Fri Oct 21 19:49:29 2011
@@ -616,35 +616,8 @@ public abstract class UIComponentBase ex
             throw new IllegalArgumentException("Intermediate identifier " + id + " in search expression " + expr
                     + " identifies a UIComponent that is not a NamingContainer");
 
-        if (id.equals(findBase.getId()))
-        {
-            // At this point, findBase has a NamingContainer that match with the id.
-            // So we need to call findComponent over the rest of the expression without take
-            // into account the base id, to allow use the same id on the inner component.
-            //return findBase.findComponent(expr.substring(separator + 1));
-            String innerExpr = expr.substring(separator + 1);
-            separator = innerExpr.indexOf(separatorChar);
-            //String innerExpr1 = null;
-            //String nextId = null;
-            if (separator == -1)
-            {
-                //innerExpr1 = null;
-                //nextId= innerExpr;
-                return _ComponentUtils.findComponentChildOrFacetFrom(findBase, innerExpr, null);
-            }
-            else
-            {
-                //innerExpr1 = innerExpr.substring(separator+1);
-                //nextId = innerExpr.substring(0,separator);
-                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.findComponentChildOrFacetFrom(findBase, expr, null);
-        }
+        return findBase.findComponent(expr.substring(separator + 1));
+
     }
 
     /**

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=1187529&r1=1187528&r2=1187529&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 Fri Oct 21 19:49:29 2011
@@ -110,7 +110,7 @@ class _ComponentUtils
      */
     static UIComponent findComponent(UIComponent findBase, String id, final char separatorChar)
     {
-        if (idsAreEqual(id, findBase, separatorChar))
+        if (!(findBase instanceof NamingContainer) && idsAreEqual(id, findBase, separatorChar))
         {
             return findBase;
         }
@@ -148,6 +148,11 @@ class _ComponentUtils
             }
         }
 
+        if (findBase instanceof NamingContainer && idsAreEqual(id, findBase, separatorChar))
+        {
+            return findBase;
+        }
+
         return null;
     }