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

svn commit: r327119 - /myfaces/api/trunk/src/java/javax/faces/webapp/UIComponentTag.java

Author: mmarinschek
Date: Fri Oct 21 01:34:57 2005
New Revision: 327119

URL: http://svn.apache.org/viewcvs?rev=327119&view=rev
Log:
better reporting of problems with duplicate ids

Modified:
    myfaces/api/trunk/src/java/javax/faces/webapp/UIComponentTag.java

Modified: myfaces/api/trunk/src/java/javax/faces/webapp/UIComponentTag.java
URL: http://svn.apache.org/viewcvs/myfaces/api/trunk/src/java/javax/faces/webapp/UIComponentTag.java?rev=327119&r1=327118&r2=327119&view=diff
==============================================================================
--- myfaces/api/trunk/src/java/javax/faces/webapp/UIComponentTag.java (original)
+++ myfaces/api/trunk/src/java/javax/faces/webapp/UIComponentTag.java Fri Oct 21 01:34:57 2005
@@ -399,13 +399,32 @@
                 else
                 {
                     throw new FacesException("cannot add component with id '" +
-                            _componentInstance.getId() + "' and path : "
-                            +getPathToComponent(_componentInstance)+" to its parent component. This might be a problem due to duplicate ids.");
+                            _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(_childrenAdded));
                 }
             }
             addChildIdToParentTag(parentTag, id);
             return _componentInstance;
         }
+    }
+
+    private String printSet(Set childrenAdded)
+    {
+        StringBuffer buf = new StringBuffer();
+        Iterator it = childrenAdded.iterator();
+
+        while (it.hasNext())
+        {
+            Object obj =  it.next();
+            buf.append(obj);
+
+            if(it.hasNext())
+                buf.append(",");
+        }
+
+        return buf.toString();
     }