[
https://issues.apache.org/jira/browse/MYFACES-2775?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Leonardo Uribe updated MYFACES-2775:
------------------------------------
Status: Resolved (was: Patch Available)
Assignee: Leonardo Uribe
Fix Version/s: 2.0.1-SNAPSHOT
Resolution: Fixed
Instead of call getClientId(), since the target of the component is one facet
inside UIViewRoot, we can call createUniqueId() and assign to the component
resource id. getClientId() has the side effect of generate an client id based
on the location of the component in the tree, but note in this case the
component is being relocated.
In theory, the developer must set an id to the component before add it as
component resource, but if not, there is no reason why not set a generated id,
since the component after the resolution will be part of the tree, and a later
call to getClientId() could do that.
Thanks to Martin Kočí for provide this patch.
> StackOverflowError when adding componentResource with id=null
> -------------------------------------------------------------
>
> Key: MYFACES-2775
> URL: https://issues.apache.org/jira/browse/MYFACES-2775
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-314
> Affects Versions: 2.0.1-SNAPSHOT
> Environment: myfaces trunk, tomcat 6.0.26
> Reporter: Martin Kočí
> Assignee: Leonardo Uribe
> Fix For: 2.0.1-SNAPSHOT
>
> Attachments: MYFACES-2775.patch
>
>
> If second parameter - the componentResource:
> UIViewRoot.addComponentResource(FacesContext context, UIComponent
> componentResource)
> has null id then StackOverflowError occurs:
> Caused by: java.lang.StackOverflowError
> at java.lang.ThreadLocal.get(ThreadLocal.java:124)
> at
> javax.faces.context.FacesContext.getCurrentInstance(FacesContext.java:71)
> at
> javax.faces.component.UIComponentBase.getFacesContext(UIComponentBase.java:1057)
> at
> javax.faces.component.UIComponentBase.setParent(UIComponentBase.java:174)
> at
> javax.faces.component._ComponentChildrenList.childRemoved(_ComponentChildrenList.java:123)
> at
> javax.faces.component._ComponentChildrenList.remove(_ComponentChildrenList.java:147)
> at
> javax.faces.component._ComponentChildrenList.removeChildrenFromParent(_ComponentChildrenList.java:136)
> at
> javax.faces.component._ComponentChildrenList.add(_ComponentChildrenList.java:76)
> at
> javax.faces.component._ComponentChildrenList.add(_ComponentChildrenList.java:30)
> at
> javax.faces.component.UIViewRoot.addComponentResource(UIViewRoot.java:188)
> at
> org.apache.myfaces.renderkit.html.HtmlStylesheetRenderer.processEvent(HtmlStylesheetRenderer.java:86)
> at
> javax.faces.component.UIComponent$EventListenerWrapper.processEvent(UIComponent.java:1098)
> at javax.faces.event.SystemEvent.processListener(SystemEvent.java:43)
> at
> org.apache.myfaces.application.ApplicationImpl._traverseListenerList(ApplicationImpl.java:1955)
> at
> org.apache.myfaces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:504)
> at
> javax.faces.component.UIComponentBase._publishPostAddToViewEvent(UIComponentBase.java:201)
> at
> javax.faces.component.UIComponentBase.setParent(UIComponentBase.java:186)
> at
> javax.faces.component._ComponentChildrenList.updateParent(_ComponentChildrenList.java:128)
> at
> javax.faces.component._ComponentChildrenList.add(_ComponentChildrenList.java:79)
> at
> javax.faces.component._ComponentChildrenList.add(_ComponentChildrenList.java:30)
> at
> javax.faces.component.UIViewRoot.addComponentResource(UIViewRoot.java:188)
> at
> org.apache.myfaces.renderkit.html.HtmlStylesheetRenderer.processEvent(HtmlStylesheetRenderer.java:86)
> at
> javax.faces.component.UIComponent$EventListenerWrapper.processEvent(UIComponent.java:1098)
> ....
> This probably does not happen if componentResource is created from a facelet
> but only if it created from java code (a listener in my case)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.