You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Paul Stanton (JIRA)" <ji...@apache.org> on 2012/09/07 02:03:07 UTC

[jira] [Created] (TAP5-2000) empty element causes 'unbalanced elements' exception

Paul Stanton created TAP5-2000:
----------------------------------

             Summary: empty element causes 'unbalanced elements' exception
                 Key: TAP5-2000
                 URL: https://issues.apache.org/jira/browse/TAP5-2000
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-core
    Affects Versions: 5.3.3
            Reporter: Paul Stanton


consider the following TML markup:
<col t:type="if" t:test="myTest"></col>

If 'myTest' is true, I want to render an empty <col> element, if it is false render nothing.

TRUE: [<col></col>]
FALSE: []

however the above markup causes this exception:

Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Component MyPage:mycomponent.if_4 has rendered unbalanced elements; either it has started an element with MarkupWriter.element() and not followed up with MarkupWriter.end(), or it has invoked MarkupWriter.end() without first invoking MarkupWriter.element(). [at classpath:com/me/components/MyComponent.tml, line 26]
	at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$PostRenderCleanupPhase.render(ComponentPageElementImpl.java:441)
	at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
	... 81 more

To work around, include any character (space) within the element:
<col t:type="if" t:test="myTest"> </col>

which renders:
TRUE: [<col> </col>]
FALSE: []

I also imagine you could do:
<t:if test="myTest"><col></col></t:if>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (TAP5-2000) empty element causes 'unbalanced elements' exception

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-2000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13452129#comment-13452129 ] 

Howard M. Lewis Ship commented on TAP5-2000:
--------------------------------------------

I find this one highly unlikely; not impossible, but unlikely. I'd really need to see a test case.  Is there any possibility that the value for myTest changes during the render of the If component?

Possibly this is a bug in the render phase optimization step, where the AfterRender phase because the element's body is empty. But that's off the top of my head.
                
> empty element causes 'unbalanced elements' exception
> ----------------------------------------------------
>
>                 Key: TAP5-2000
>                 URL: https://issues.apache.org/jira/browse/TAP5-2000
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.3
>            Reporter: Paul Stanton
>
> consider the following TML markup:
> <col t:type="if" t:test="myTest"></col>
> If 'myTest' is true, I want to render an empty <col> element, if it is false render nothing.
> TRUE: [<col></col>]
> FALSE: []
> however the above markup causes this exception:
> Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Component MyPage:mycomponent.if_4 has rendered unbalanced elements; either it has started an element with MarkupWriter.element() and not followed up with MarkupWriter.end(), or it has invoked MarkupWriter.end() without first invoking MarkupWriter.element(). [at classpath:com/me/components/MyComponent.tml, line 26]
> 	at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$PostRenderCleanupPhase.render(ComponentPageElementImpl.java:441)
> 	at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
> 	... 81 more
> To work around, include any character (space) within the element:
> <col t:type="if" t:test="myTest"> </col>
> which renders:
> TRUE: [<col> </col>]
> FALSE: []
> I also imagine you could do:
> <t:if test="myTest"><col></col></t:if>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (TAP5-2000) empty element causes 'unbalanced elements' exception

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-2000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13452129#comment-13452129 ] 

Howard M. Lewis Ship commented on TAP5-2000:
--------------------------------------------

I find this one highly unlikely; not impossible, but unlikely. I'd really need to see a test case.  Is there any possibility that the value for myTest changes during the render of the If component?

Possibly this is a bug in the render phase optimization step, where the AfterRender phase because the element's body is empty. But that's off the top of my head.
                
> empty element causes 'unbalanced elements' exception
> ----------------------------------------------------
>
>                 Key: TAP5-2000
>                 URL: https://issues.apache.org/jira/browse/TAP5-2000
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.3
>            Reporter: Paul Stanton
>
> consider the following TML markup:
> <col t:type="if" t:test="myTest"></col>
> If 'myTest' is true, I want to render an empty <col> element, if it is false render nothing.
> TRUE: [<col></col>]
> FALSE: []
> however the above markup causes this exception:
> Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Component MyPage:mycomponent.if_4 has rendered unbalanced elements; either it has started an element with MarkupWriter.element() and not followed up with MarkupWriter.end(), or it has invoked MarkupWriter.end() without first invoking MarkupWriter.element(). [at classpath:com/me/components/MyComponent.tml, line 26]
> 	at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$PostRenderCleanupPhase.render(ComponentPageElementImpl.java:441)
> 	at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
> 	... 81 more
> To work around, include any character (space) within the element:
> <col t:type="if" t:test="myTest"> </col>
> which renders:
> TRUE: [<col> </col>]
> FALSE: []
> I also imagine you could do:
> <t:if test="myTest"><col></col></t:if>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira