myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r924501 - /myfaces/core/branches/1.2.x/api/src/main/java/javax/faces/component/UIComponentBase.java
Date Wed, 17 Mar 2010 21:28:53 GMT
Author: lu4242
Date: Wed Mar 17 21:28:53 2010
New Revision: 924501

URL: http://svn.apache.org/viewvc?rev=924501&view=rev
Log:
MYFACES-2611 UIComponentBase.getFacetsAndChildren() must not access the component's facets
and children directly

Modified:
    myfaces/core/branches/1.2.x/api/src/main/java/javax/faces/component/UIComponentBase.java

Modified: myfaces/core/branches/1.2.x/api/src/main/java/javax/faces/component/UIComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/api/src/main/java/javax/faces/component/UIComponentBase.java?rev=924501&r1=924500&r2=924501&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/api/src/main/java/javax/faces/component/UIComponentBase.java
(original)
+++ myfaces/core/branches/1.2.x/api/src/main/java/javax/faces/component/UIComponentBase.java
Wed Mar 17 21:28:53 2010
@@ -481,38 +481,24 @@ public abstract class UIComponentBase
 
     public Iterator<UIComponent> getFacetsAndChildren()
     {
-        if (_facetMap == null)
+        // we can't use _facetMap and _childrenList here directly,
+        // because some component implementation could keep their 
+        // own properties for facets and children and just override
+        // getFacets() and getChildren() (e.g. seen in PrimeFaces).
+        // See MYFACES-2611 for details.
+        if (getFacetCount() == 0)
         {
-            if (_childrenList == null)
+            if (getChildCount() == 0)
                 return _EMPTY_UICOMPONENT_ITERATOR;
 
-            if (_childrenList.size() == 0)
-                return _EMPTY_UICOMPONENT_ITERATOR;
-            
-            return _childrenList.iterator();
+            return getChildren().iterator();
         }
         else
         {
-            if (_facetMap.size() == 0)
-            {
-                if (_childrenList == null)
-                    return _EMPTY_UICOMPONENT_ITERATOR;
-              
-                if (_childrenList.size() == 0)
-                    return _EMPTY_UICOMPONENT_ITERATOR;
-            
-                return _childrenList.iterator();  
-            }
-            else
-            {
-                if (_childrenList == null)
-                    return _facetMap.values().iterator();
-              
-                if (_childrenList.size() == 0)
-                    return _facetMap.values().iterator();
-              
-                return new _FacetsAndChildrenIterator<UIComponent>(_facetMap, _childrenList);
                           
-            }
+            if (getChildCount() == 0)
+                return getFacets().values().iterator();
+
+            return new _FacetsAndChildrenIterator(getFacets(), getChildren());
         }
     }
 



Mime
View raw message