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 2009/10/19 03:24:40 UTC

svn commit: r826572 - /myfaces/core/branches/1.2.x/api/src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java

Author: lu4242
Date: Mon Oct 19 01:24:39 2009
New Revision: 826572

URL: http://svn.apache.org/viewvc?rev=826572&view=rev
Log:
MYFACES-2382 Duplicate id exception when weblogic portal and jsf native portlet (faces-adapter.jar) is used

Modified:
    myfaces/core/branches/1.2.x/api/src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java

Modified: myfaces/core/branches/1.2.x/api/src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/api/src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java?rev=826572&r1=826571&r2=826572&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/api/src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java (original)
+++ myfaces/core/branches/1.2.x/api/src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java Mon Oct 19 01:24:39 2009
@@ -1102,15 +1102,35 @@
         if (_componentInstance == null)
         {
             _componentInstance = createComponent(context, id);
-            _created = true;
-            int index = parentTag.getIndexOfNextChildTag();
-            if (index > parent.getChildCount())
+            if (id.equals(_componentInstance.getId()) )
             {
-                index = parent.getChildCount();
+                _created = true;
+                int index = parentTag.getIndexOfNextChildTag();
+                if (index > parent.getChildCount())
+                {
+                    index = parent.getChildCount();
+                }
+
+                List<UIComponent> children = parent.getChildren();
+                children.add(index, _componentInstance);
             }
+            // On weblogic portal using faces-adapter, the id set and the retrieved 
+            // one for <netuix:namingContainer> is different. The reason is 
+            // this custom solution for integrate jsf changes the id of the parent
+            // component to allow the same native portlet to be allocated multiple
+            // times in the same page
+            else if (null == findComponent(parent,_componentInstance.getId()))
+            {
+                _created = true;
+                int index = parentTag.getIndexOfNextChildTag();
+                if (index > parent.getChildCount())
+                {
+                    index = parent.getChildCount();
+                }
 
-            List<UIComponent> children = parent.getChildren();
-            children.add(index, _componentInstance);
+                List<UIComponent> children = parent.getChildren();
+                children.add(index, _componentInstance);
+            }
         }
 
         return _componentInstance;