You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Robin Shine (JIRA)" <ji...@apache.org> on 2011/03/07 01:21:59 UTC

[jira] Created: (WICKET-3512) results in MarkupException when used with multiple

<wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
------------------------------------------------------------------------------------

                 Key: WICKET-3512
                 URL: https://issues.apache.org/jira/browse/WICKET-3512
             Project: Wicket
          Issue Type: Bug
    Affects Versions: 1.5-RC2
            Reporter: Robin Shine


Put below simple pages into a Wicket web application:

TestPage1.html:

<html>
	<head>
		<title>title</title>
	</head>
	<body>
		<div wicket:id="test1"></div>
		<wicket:child></wicket:child>
	</body>
</html>

TestPage1.java:

package com.example.test;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;

public class TestPage1 extends WebPage {

	public TestPage1() {
		add(new Label("test1", "test1"));
	}
}

TestPage2.html:

<wicket:extend>
	<wicket:enclosure child="test2">
		<div wicket:id="test2"></div>
	</wicket:enclosure>
	<wicket:child></wicket:child>
</wicket:extend>

TestPage2.java:

package com.example.test;

import org.apache.wicket.markup.html.basic.Label;

public class TestPage2 extends TestPage1 {
	
	public TestPage2() {
		add(new Label("test2", "test2"));
	}

}

TestPage3.html:

<wicket:extend>
	<wicket:enclosure child="test3">
		<div wicket:id="test3"></div>
	</wicket:enclosure>
</wicket:extend>

TestPage3.java:


package com.example.test;

import org.apache.wicket.markup.html.basic.Label;

public class TestPage3 extends TestPage2 {
	
	public TestPage3() {
		add(new Label("test3", "test3"));
	}

}


Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:

Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2

Root cause:

org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
	 at org.apache.wicket.Page.componentRendered(Page.java:299)
	 at org.apache.wicket.Component.rendered(Component.java:2570)
	 at org.apache.wicket.Component.internalRender(Component.java:2377)
	 at org.apache.wicket.Component.render(Component.java:2301)
	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
         ...

This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Issue Comment Edited] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009699#comment-13009699 ] 

Pedro Santos edited comment on WICKET-3512 at 3/22/11 4:34 PM:
---------------------------------------------------------------

Rendering the TransparentWebMarkupContainer for the wicket:extend tag in TestPage3.html, ComponentResolvers return the parent Enclosure component, since in the hierarchy we have now an instance of IComponentResolver ( the TransparentWebMarkupContainer created to the wicket:child tag in TestPage2.html ). So the same enclosure get rendered twice, generating this bug.

Relevant stack trace:

TransparentWebMarkupContainer.resolve(MarkupContainer, MarkupStream, ComponentTag) line: 50
          --> TransparentWebMarkupContainer created to the wicket:child tag in TestPage2.html is a resolver, he know who is the "_enclosure1" because its parent has an homonym child, and return it to be rendered twice
ComponentResolvers.resolveByComponentHierarchy(MarkupContainer, MarkupStream, ComponentTag) line: 111	
ComponentResolvers.resolve(MarkupContainer, MarkupStream, ComponentTag, ComponentResolvers$ResolverFilter) line: 54	
TransparentWebMarkupContainer(MarkupContainer).renderNext(MarkupStream) line: 1407	
           --> TransparentWebMarkupContainer for the wicket:extend tag in TestPage3.html trying to render "_enclosure1". As there are no such child, the resolvers are called.

      was (Author: pedrosans):
    Rendering the TransparentWebMarkupContainer for the wicket:extend tag in TestPage3.html, ComponentResolvers return the parent Enclosure component, since in the hierarchy we have now an instance of IComponentResolver ( the TransparentWebMarkupContainer created to the wicket:extend tag in TestPage2.html ). So the same enclosure get rendered twice, generating this bug.

Relevant stack trace:

TransparentWebMarkupContainer.resolve(MarkupContainer, MarkupStream, ComponentTag) line: 50
          --> TransparentWebMarkupContainer created to the wicket:extend tag in TestPage2.html is a resolver, he know who is the "_enclosure1", and return it to be rendered twice
ComponentResolvers.resolveByComponentHierarchy(MarkupContainer, MarkupStream, ComponentTag) line: 111	
ComponentResolvers.resolve(MarkupContainer, MarkupStream, ComponentTag, ComponentResolvers$ResolverFilter) line: 54	
TransparentWebMarkupContainer(MarkupContainer).renderNext(MarkupStream) line: 1407	
           --> TransparentWebMarkupContainer for the wicket:extend tag in TestPage3.html trying to render "_enclosure1". As there are no such child, the resolvers are called.
  
> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pedro Santos resolved WICKET-3512.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5-RC3

> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>             Fix For: 1.5-RC3
>
>         Attachments: WICKET-3512-2.patch, WICKET-3512.patch
>
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009786#comment-13009786 ] 

Juergen Donnerstag commented on WICKET-3512:
--------------------------------------------

Pedro is spot on. The root cause is the "counter" in AMF. The counter must be Page unique. Unfortunately the Page is not available. The Session is but I don't like that the numbers (ID) are growing very fast. Instead of Page we might use RequestCycle instead, but RequestCycle has no counter yet. Adding that counter to RC shouldn't be a big deal I think.

> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010858#comment-13010858 ] 

Juergen Donnerstag commented on WICKET-3512:
--------------------------------------------

looks good. feel free and commit.

> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>         Attachments: WICKET-3512-2.patch, WICKET-3512.patch
>
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Issue Comment Edited] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009803#comment-13009803 ] 

Pedro Santos edited comment on WICKET-3512 at 3/24/11 8:12 PM:
---------------------------------------------------------------

The main cause is also that TransparentWebMarkupContainer is resolving its parent's children components to their grandchildren even when its parent container declared an homonymous component in markup, meaning that he is the one who wants to render the component, and that it should not be resolved to grandchildren. I'm preparing an patch fixing and exposing this bug with another test case.


      was (Author: pedrosans):
    The main cause is also that TransparentWebMarkupContainer is resolving its parent child components to their grandchildren even when its parent container declared an homonymous component in markup, meaning that he is the one who wants to render the component, and that it should not be resolved to grandchildren. I'm preparing an patch fixing and exposing this bug with another test case.

  
> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>             Fix For: 1.5-RC3
>
>         Attachments: WICKET-3512-2.patch, WICKET-3512.patch
>
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Issue Comment Edited] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009819#comment-13009819 ] 

Pedro Santos edited comment on WICKET-3512 at 3/24/11 8:28 PM:
---------------------------------------------------------------

Who ultimately set the Enclosure id is the EnclosureHandler, he knows the page and can use its auto index.

- return new Enclosure(tag.getId(), tag.getAttribute(EnclosureHandler.CHILD_ATTRIBUTE));
+ return new Enclosure(tag.getId() + container.getPage().getAutoIndex(), tag.getAttribute(EnclosureHandler.CHILD_ATTRIBUTE));

MarkupInheritanceResolver is already assemblying this kind of id, if both changes are OK I think we are done.
Add RC as a markup parser dependence implies that we could not use it outside wicket lifecyle, test cases do it all the time.

      was (Author: pedrosans):
    Who ultimately set the Enclosure id is the EnclosureHandler, he knows the page and can use it's auto index.

- return new Enclosure(tag.getId(), tag.getAttribute(EnclosureHandler.CHILD_ATTRIBUTE));
+ return new Enclosure(tag.getId() + container.getPage().getAutoIndex(), tag.getAttribute(EnclosureHandler.CHILD_ATTRIBUTE));

MarkupInheritanceResolver is already assemblying this kind of id, if both changes are OK I think we are done.
Add RC as a markup parser dependence implies that we could not use it outside wicket lifecyle, test cases do it all the time.
  
> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>             Fix For: 1.5-RC3
>
>         Attachments: WICKET-3512-2.patch, WICKET-3512.patch
>
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009677#comment-13009677 ] 

Pedro Santos commented on WICKET-3512:
--------------------------------------

Initial investigation shows that AbstractMarkupFilter has an counter variable giving the same value to both enclosure components.

the markup loader load TestPage3.html
the parser create the "enclosure_1"
the markup loader load TestPanel2.html, create a new set of filters, the counter is created again having its initial value
the parser create the "enclosure_1" again

Changing EnclosureHandler or WicketTagIdentifier to assign different wicket ids fix the problem. But I still don't know why, I see nested components with identical wicket ids working all the time.

> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pedro Santos reassigned WICKET-3512:
------------------------------------

    Assignee: Pedro Santos

> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009819#comment-13009819 ] 

Pedro Santos commented on WICKET-3512:
--------------------------------------

Who ultimately set the Enclosure id is the EnclosureHandler, he knows the page and can use it's auto index.

- return new Enclosure(tag.getId(), tag.getAttribute(EnclosureHandler.CHILD_ATTRIBUTE));
+ return new Enclosure(tag.getId() + container.getPage().getAutoIndex(), tag.getAttribute(EnclosureHandler.CHILD_ATTRIBUTE));

MarkupInheritanceResolver is already assemblying this kind of id, if both changes are OK I think we are done.
Add RC as a markup parser dependence implies that we could not use it outside wicket lifecyle, test cases do it all the time.

> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>         Attachments: WICKET-3512.patch
>
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pedro Santos updated WICKET-3512:
---------------------------------

    Attachment: WICKET-3512-2.patch

In a very unlikely scenario involving user declaring the same wicket id generated by WicketTagIdentifier to it's own components just above a TWMC enclosing wicket tags to be resolved, user will be able to break our renderer because the page auto index improvement is not enough. 
I'm sending the patch again with the API improvement, thanks Juergen, plus more test cases exposing this problem fixed in TWMC.

> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>         Attachments: WICKET-3512-2.patch, WICKET-3512.patch
>
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pedro Santos updated WICKET-3512:
---------------------------------

    Attachment: WICKET-3512.patch

> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>         Attachments: WICKET-3512.patch
>
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009699#comment-13009699 ] 

Pedro Santos commented on WICKET-3512:
--------------------------------------

Rendering the TransparentWebMarkupContainer for the wicket:extend tag in TestPage3.html, ComponentResolvers return the parent Enclosure component, since in the hierarchy we have now an instance of IComponentResolver ( the TransparentWebMarkupContainer created to the wicket:extend tag in TestPage2.html ). So the same enclosure get rendered twice, generating this bug.

Relevant stack trace:

TransparentWebMarkupContainer.resolve(MarkupContainer, MarkupStream, ComponentTag) line: 50
          --> TransparentWebMarkupContainer created to the wicket:extend tag in TestPage2.html is a resolver, he know who is the "_enclosure1", and return it to be rendered twice
ComponentResolvers.resolveByComponentHierarchy(MarkupContainer, MarkupStream, ComponentTag) line: 111	
ComponentResolvers.resolve(MarkupContainer, MarkupStream, ComponentTag, ComponentResolvers$ResolverFilter) line: 54	
TransparentWebMarkupContainer(MarkupContainer).renderNext(MarkupStream) line: 1407	
           --> TransparentWebMarkupContainer for the wicket:extend tag in TestPage3.html trying to render "_enclosure1". As there are no such child, the resolvers are called.

> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Issue Comment Edited] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010660#comment-13010660 ] 

Pedro Santos edited comment on WICKET-3512 at 3/24/11 8:30 PM:
---------------------------------------------------------------

In a very unlikely scenario involving user declaring the same wicket id generated by WicketTagIdentifier to its own components just above a TWMC enclosing wicket tags to be resolved, user will be able to break our renderer because the page auto index improvement is not enough. 
I'm sending the patch again with the API improvement, thanks Juergen, plus more test cases exposing this problem fixed in TWMC.

      was (Author: pedrosans):
    In a very unlikely scenario involving user declaring the same wicket id generated by WicketTagIdentifier to it's own components just above a TWMC enclosing wicket tags to be resolved, user will be able to break our renderer because the page auto index improvement is not enough. 
I'm sending the patch again with the API improvement, thanks Juergen, plus more test cases exposing this problem fixed in TWMC.
  
> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>             Fix For: 1.5-RC3
>
>         Attachments: WICKET-3512-2.patch, WICKET-3512.patch
>
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010486#comment-13010486 ] 

Juergen Donnerstag commented on WICKET-3512:
--------------------------------------------

I played a bit with your patches and tests. 

I think using page.getAutoIndex() is the right approach. The id will always be page unique and MarkupContainer.autoAdd() will make sure the markup gets assigned.

on your additional test case, it actually works fine when java and markup are like they should be. But when users forgot to add one of the labels, like you deliberately did in your test cases, than wicket will throw an exception "has already been rendered" instead of "component not found". Clearly giving the wrong hint to the user. That's what the TWMC patch is about. It would not be needed for Wicket to render properly.

Page.wasRendered should be final and the javadoc should mention that it's a Wicket internal API which should not be used by users (=> contract or behavior might change in the futur releases)

> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>         Attachments: WICKET-3512.patch
>
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3512) results in MarkupException when used with multiple

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009803#comment-13009803 ] 

Pedro Santos commented on WICKET-3512:
--------------------------------------

The main cause is also that TransparentWebMarkupContainer is resolving its parent child components to their grandchildren even when its parent container declared an homonymous component in markup, meaning that he is the one who wants to render the component, and that it should not be resolved to grandchildren. I'm preparing an patch fixing and exposing this bug with another test case.


> <wicket:enclosure> results in MarkupException when used with multiple <wicket:child>
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-3512
>                 URL: https://issues.apache.org/jira/browse/WICKET-3512
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5-RC2
>            Reporter: Robin Shine
>            Assignee: Pedro Santos
>
> Put below simple pages into a Wicket web application:
> TestPage1.html:
> <html>
> 	<head>
> 		<title>title</title>
> 	</head>
> 	<body>
> 		<div wicket:id="test1"></div>
> 		<wicket:child></wicket:child>
> 	</body>
> </html>
> TestPage1.java:
> package com.example.test;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage1 extends WebPage {
> 	public TestPage1() {
> 		add(new Label("test1", "test1"));
> 	}
> }
> TestPage2.html:
> <wicket:extend>
> 	<wicket:enclosure child="test2">
> 		<div wicket:id="test2"></div>
> 	</wicket:enclosure>
> 	<wicket:child></wicket:child>
> </wicket:extend>
> TestPage2.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage2 extends TestPage1 {
> 	
> 	public TestPage2() {
> 		add(new Label("test2", "test2"));
> 	}
> }
> TestPage3.html:
> <wicket:extend>
> 	<wicket:enclosure child="test3">
> 		<div wicket:id="test3"></div>
> 	</wicket:enclosure>
> </wicket:extend>
> TestPage3.java:
> package com.example.test;
> import org.apache.wicket.markup.html.basic.Label;
> public class TestPage3 extends TestPage2 {
> 	
> 	public TestPage3() {
> 		add(new Label("test3", "test3"));
> 	}
> }
> Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now mount TestPage3 and access it, below errors will be generated:
> Message: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> Root cause:
> org.apache.wicket.markup.MarkupException: The component [Component id = test2] was rendered already. You can render it only once during a render phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2
> 	 at org.apache.wicket.Page.componentRendered(Page.java:299)
> 	 at org.apache.wicket.Component.rendered(Component.java:2570)
> 	 at org.apache.wicket.Component.internalRender(Component.java:2377)
> 	 at org.apache.wicket.Component.render(Component.java:2301)
> 	 at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
>          ...
> This error won't occur if <wicket:enclosure> is removed from one of the page. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira