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:23:47 UTC
svn commit: r826571 -
/myfaces/core/branches/1.1.x/api/src/main/java/javax/faces/webapp/UIComponentTag.java
Author: lu4242
Date: Mon Oct 19 01:23:46 2009
New Revision: 826571
URL: http://svn.apache.org/viewvc?rev=826571&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.1.x/api/src/main/java/javax/faces/webapp/UIComponentTag.java
Modified: myfaces/core/branches/1.1.x/api/src/main/java/javax/faces/webapp/UIComponentTag.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.1.x/api/src/main/java/javax/faces/webapp/UIComponentTag.java?rev=826571&r1=826570&r2=826571&view=diff
==============================================================================
--- myfaces/core/branches/1.1.x/api/src/main/java/javax/faces/webapp/UIComponentTag.java (original)
+++ myfaces/core/branches/1.1.x/api/src/main/java/javax/faces/webapp/UIComponentTag.java Mon Oct 19 01:23:46 2009
@@ -774,20 +774,46 @@
if (_componentInstance == null)
{
_componentInstance = createComponentInstance(context, id);
- setProperties(_componentInstance);
- int index = getAddedChildrenCount(parentTag);
- List children = parent.getChildren();
- if (index <= children.size())
+ if (id.equals(_componentInstance.getId()) )
{
- children.add(index, _componentInstance);
+ setProperties(_componentInstance);
+ int index = getAddedChildrenCount(parentTag);
+ List children = parent.getChildren();
+ if (index <= children.size())
+ {
+ children.add(index, _componentInstance);
+ }
+ else
+ {
+ throw new FacesException("cannot add component with id '" +
+ _componentInstance.getId() + " to its parent component with id : '"+parent.getId()+"' and path '"+
+ getPathToComponent(parent)+"'at position :"+index+" in list of children. "+
+ "This might be a problem due to a duplicate id in a previously added component,"+
+ "if this is the case, the problematic id might be one of : "+printSet(parentTag._childrenAdded));
+ }
}
- else
+ // 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()))
{
- throw new FacesException("cannot add component with id '" +
- _componentInstance.getId() + " to its parent component with id : '"+parent.getId()+"' and path '"+
- getPathToComponent(parent)+"'at position :"+index+" in list of children. "+
- "This might be a problem due to a duplicate id in a previously added component,"+
- "if this is the case, the problematic id might be one of : "+printSet(parentTag._childrenAdded));
+ setProperties(_componentInstance);
+ int index = getAddedChildrenCount(parentTag);
+ List children = parent.getChildren();
+ if (index <= children.size())
+ {
+ children.add(index, _componentInstance);
+ }
+ else
+ {
+ throw new FacesException("cannot add component with id '" +
+ _componentInstance.getId() + " to its parent component with id : '"+parent.getId()+"' and path '"+
+ getPathToComponent(parent)+"'at position :"+index+" in list of children. "+
+ "This might be a problem due to a duplicate id in a previously added component,"+
+ "if this is the case, the problematic id might be one of : "+printSet(parentTag._childrenAdded));
+ }
}
}
addChildIdToParentTag(parentTag, id);