You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Pavitra Subramaniam (JIRA)" <de...@myfaces.apache.org> on 2009/12/02 01:30:20 UTC

[jira] Created: (TRINIDAD-1648) IllegalStateException in UIComponentBase when trying to add a resource (outputScript) to the body target...

IllegalStateException in UIComponentBase when trying to add a resource (outputScript) to the body target...
-----------------------------------------------------------------------------------------------------------

                 Key: TRINIDAD-1648
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1648
             Project: MyFaces Trinidad
          Issue Type: New Feature
          Components: Components
    Affects Versions: 2.0.0-core
         Environment: Running Trinidad 2.0.x; with Facelets; no Partial State Saving and using JSF Ajax request rather than the Trinidad PPR mechanism
            Reporter: Pavitra Subramaniam


1. I have a simple usecase where I have changed the Trinidad PPR code to use the jsf.ajax. The client postback works ok and the command is processed on the server properly. 
2. During render response phase though, an <h:outputScript> tag present in the page, gets re-targeted to be under the <body> tag and this causes an IllegalStateException in the following method in UICOmponentBase.java.

3. It appears that the JSF RI, throws an ISE when the parent does not contain a child either in its child list or the facets. 

     * <p>If the specified {@link UIComponent} has a non-null parent,
     * remove it as a child or facet (as appropriate) of that parent.
     * As a result, the <code>parent</code> property will always be
     * <code>null</code> when this method returns.</p>
     *
    private static void eraseParent(UIComponent component)

4. To reproduce the problem , download the patch provided. This exception is only apparent when testing with JSF Ajax. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-1648) IllegalStateException in UIComponentBase when trying to add a resource (outputScript) to the body target...

Posted by "Matthias Weßendorf (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1648?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12785819#action_12785819 ] 

Matthias Weßendorf commented on TRINIDAD-1648:
----------------------------------------------

entire IllegalStateException stack trace:

WARNING: The id "sp11" is used more than once.
java.lang.IllegalStateException: Parent was not null, but this component not related
	at javax.faces.component.UIComponentBase.eraseParent(UIComponentBase.java:520)
	at javax.faces.component.UIComponentBase.access$400(UIComponentBase.java:104)
	at javax.faces.component.UIComponentBase$ChildrenList.add(UIComponentBase.java:2437)
	at javax.faces.component.UIComponentBase$ChildrenList.add(UIComponentBase.java:2411)
	at javax.faces.component.UIViewRoot.addComponentResource(UIViewRoot.java:531)
	at com.sun.faces.renderkit.html_basic.ScriptStyleBaseRenderer.processEvent(ScriptStyleBaseRenderer.java:99)
	at javax.faces.component.UIComponent$ComponentSystemEventListenerAdapter.processEvent(UIComponent.java:2342)
	at javax.faces.event.SystemEvent.processListener(SystemEvent.java:102)
	at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:1993)
	at com.sun.faces.application.ApplicationImpl.invokeComponentListenersFor(ApplicationImpl.java:1941)
	at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:285)
	at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:243)
	at javax.faces.component.UIComponentBase.publishAfterViewEvents(UIComponentBase.java:2005)
	at javax.faces.component.UIComponentBase.doPostAddProcessing(UIComponentBase.java:1691)
	at javax.faces.component.UIComponentBase.setParent(UIComponentBase.java:403)
	at org.apache.myfaces.trinidad.component.ChildArrayList.add(ChildArrayList.java:61)
	at org.apache.myfaces.trinidad.component.ChildArrayList.add(ChildArrayList.java:69)
	at org.apache.myfaces.trinidad.component.ChildArrayList.add(ChildArrayList.java:33)
	at com.sun.faces.facelets.tag.jsf.ComponentSupport.addComponent(ComponentSupport.java:346)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:220)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
	at com.sun.faces.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:149)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
	at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:86)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
	at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:75)
	at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:145)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:715)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:311)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
	at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
	at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148)
	at org.apache.myfaces.trinidaddemo.webapp.RedirectFilter.doFilter(RedirectFilter.java:97)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:387)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535)
	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:880)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
Dec 4, 2009 9:04:34 AM org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit createResponseWriter
SEVERE: No RenderingContext has been created.


> IllegalStateException in UIComponentBase when trying to add a resource (outputScript) to the body target...
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1648
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1648
>             Project: MyFaces Trinidad
>          Issue Type: New Feature
>          Components: Components
>    Affects Versions: 2.0.0-core
>         Environment: Running Trinidad 2.0.x; with Facelets; no Partial State Saving and using JSF Ajax request rather than the Trinidad PPR mechanism
>            Reporter: Pavitra Subramaniam
>         Attachments: IllegalStateException-II.patch, IllegalStateException.patch
>
>
> 1. I have a simple usecase where I have changed the Trinidad PPR code to use the jsf.ajax. The client postback works ok and the command is processed on the server properly. almost...
> 2. During render response phase though, an <h:outputScript> tag present in the page, gets re-targeted to be under the <body> tag and this causes an IllegalStateException in the following method in UICOmponentBase.java.
> 3. It appears that the JSF RI, throws an ISE when the parent does not contain a child either in its child list or the facets. 
>      * <p>If the specified {@link UIComponent} has a non-null parent,
>      * remove it as a child or facet (as appropriate) of that parent.
>      * As a result, the <code>parent</code> property will always be
>      * <code>null</code> when this method returns.</p>
>      *
>     private static void eraseParent(UIComponent component)
> 4. To reproduce the problem , 
>  a. download the patch provided. 
>  b. Run the ajaxPPRDemos.jspx. Notice the page comes up fine. also notice the <h:outputScript> used. 
>  c. Click on the 'partial Submit' button. This is wired to use the JSF Ajax mechanism. On the server notice the ISE as mentioned above. 
> 5. from debugging it appears to be a weird bug in the RI implementation. 
>  a. Before adding the component (in this case the h:outputScript) to the current parent, it does doPostAddProcessing() which publishes a PostAddToViewEvent. It calls the listener registered for the SystemEvent (as one is available for the source component, ComponentSystemEventListenerAdapter). 
>  b. The event listener gets called, which eventually calls the ScriptStyleBaseRenderer, which determines that the component actually needs to be added to the facets in the body and then adds it. It's all fine until here.
> c. But when the component is being added to the facet, it's also erased from its current parent. When it can't find the component in the current parent it throws an ISE. But we got here in the first place because we were trying to add it to the parent. Anyways, the ISE in UIComponentBase.eraseParent() seems like a bug to me.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TRINIDAD-1648) IllegalStateException in UIComponentBase when trying to add a resource (outputScript) to the body target...

Posted by "Pavitra Subramaniam (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/TRINIDAD-1648?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavitra Subramaniam updated TRINIDAD-1648:
------------------------------------------

    Status: Patch Available  (was: Open)

> IllegalStateException in UIComponentBase when trying to add a resource (outputScript) to the body target...
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1648
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1648
>             Project: MyFaces Trinidad
>          Issue Type: New Feature
>          Components: Components
>    Affects Versions: 2.0.0-core
>         Environment: Running Trinidad 2.0.x; with Facelets; no Partial State Saving and using JSF Ajax request rather than the Trinidad PPR mechanism
>            Reporter: Pavitra Subramaniam
>
> 1. I have a simple usecase where I have changed the Trinidad PPR code to use the jsf.ajax. The client postback works ok and the command is processed on the server properly. 
> 2. During render response phase though, an <h:outputScript> tag present in the page, gets re-targeted to be under the <body> tag and this causes an IllegalStateException in the following method in UICOmponentBase.java.
> 3. It appears that the JSF RI, throws an ISE when the parent does not contain a child either in its child list or the facets. 
>      * <p>If the specified {@link UIComponent} has a non-null parent,
>      * remove it as a child or facet (as appropriate) of that parent.
>      * As a result, the <code>parent</code> property will always be
>      * <code>null</code> when this method returns.</p>
>      *
>     private static void eraseParent(UIComponent component)
> 4. To reproduce the problem , download the patch provided. This exception is only apparent when testing with JSF Ajax. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.