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 2010/06/28 20:10:27 UTC

svn commit: r958667 - /myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java

Author: lu4242
Date: Mon Jun 28 18:10:26 2010
New Revision: 958667

URL: http://svn.apache.org/viewvc?rev=958667&view=rev
Log:
MYFACES-2775 StackOverflowError when adding componentResource with id=null (thanks to Martin Koci for provide this patch)

Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java?rev=958667&r1=958666&r2=958667&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java Mon Jun 28 18:10:26 2010
@@ -156,6 +156,14 @@ public class UIViewRoot extends UICompon
         // If the component ID of componentResource matches the ID of a resource that has already been added, remove the old resource.
         String componentId = componentResource.getId();
         
+        if (componentId == null)
+        {
+            // componentResource can have no id - calling createUniqueId makes us sure that component will have one
+            // https://issues.apache.org/jira/browse/MYFACES-2775
+            componentId = createUniqueId(context, null);
+            componentResource.setId(componentId);
+        }
+        
         // This var helps to handle the case when we try to add a component that already is
         // on the resource list, because PostAddToViewEvent also is sent to components 
         // backing resources. The problem start when a component is already inside