devutils -- A child with id 'debug' already exists

View: New views
5 Messages — Rating Filter:   Alert me  

devutils -- A child with id 'debug' already exists

by ryantxu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying out the new devuitls package.

When I:
- checkout /trunk
- clean install
- run examples
- (from any page)
   - click on the "Live Sessions Page" link in the debug header
   - click "Enable request recording"

i get this error:

ERROR - RequestCycle               - A child with id 'debug' already exists:
[Page class = org.apache.wicket.devutils.inspector.LiveSessionsPage,
id = 0, version = 1, ajax = 0]
java.lang.IllegalArgumentException: A child with id 'debug' already exists:
[Page class = org.apache.wicket.devutils.inspector.LiveSessionsPage,
id = 0, version = 1, ajax = 0]
        at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:145)
        at org.apache.wicket.devutils.DevUtilsPage.onBeforeRender(DevUtilsPage.java:61)
        at org.apache.wicket.Component.internalBeforeRender(Component.java:1063)
        at org.apache.wicket.Component.beforeRender(Component.java:1097)
        at org.apache.wicket.Component.prepareForRender(Component.java:2242)
        at org.apache.wicket.Component.prepareForRender(Component.java:2269)
        at org.apache.wicket.Page.renderPage(Page.java:893)
        at org.apache.wicket.protocol.http.WebRequestCycle.redirectTo(WebRequestCycle.java:166)


Any thoughts?

Re: devutils -- A child with id 'debug' already exists

by Antony Stubbs :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I get the same thing. But it's just a cosmetic problem because if you  
reload the page - it does indeed get enabled.

Sent from my iPhone
http://friendfeed.com/astubbs

On 31/05/2009, at 6:14 AM, Ryan McKinley <ryantxu@...> wrote:

> I'm trying out the new devuitls package.
>
> When I:
> - checkout /trunk
> - clean install
> - run examples
> - (from any page)
>   - click on the "Live Sessions Page" link in the debug header
>   - click "Enable request recording"
>
> i get this error:
>
> ERROR - RequestCycle               - A child with id 'debug' already  
> exists:
> [Page class = org.apache.wicket.devutils.inspector.LiveSessionsPage,
> id = 0, version = 1, ajax = 0]
> java.lang.IllegalArgumentException: A child with id 'debug' already  
> exists:
> [Page class = org.apache.wicket.devutils.inspector.LiveSessionsPage,
> id = 0, version = 1, ajax = 0]
>    at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:145)
>    at  
> org.
> apache.wicket.devutils.DevUtilsPage.onBeforeRender(DevUtilsPage.java:
> 61)
>    at  
> org.apache.wicket.Component.internalBeforeRender(Component.java:1063)
>    at org.apache.wicket.Component.beforeRender(Component.java:1097)
>    at org.apache.wicket.Component.prepareForRender(Component.java:
> 2242)
>    at org.apache.wicket.Component.prepareForRender(Component.java:
> 2269)
>    at org.apache.wicket.Page.renderPage(Page.java:893)
>    at  
> org.
> apache.
> wicket.protocol.http.WebRequestCycle.redirectTo(WebRequestCycle.java:
> 166)
>
>
> Any thoughts?
___________________________
http://stubbisms.wordpress.com

Re: devutils -- A child with id 'debug' already exists

by Max Bowsher-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ryan McKinley wrote:

> I'm trying out the new devuitls package.
>
> When I:
> - checkout /trunk
> - clean install
> - run examples
> - (from any page)
>    - click on the "Live Sessions Page" link in the debug header
>    - click "Enable request recording"
>
> i get this error:
>
> ERROR - RequestCycle               - A child with id 'debug' already exists:
> [Page class = org.apache.wicket.devutils.inspector.LiveSessionsPage,
> id = 0, version = 1, ajax = 0]
> java.lang.IllegalArgumentException: A child with id 'debug' already exists:
> [Page class = org.apache.wicket.devutils.inspector.LiveSessionsPage,
> id = 0, version = 1, ajax = 0]
> at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:145)
> at org.apache.wicket.devutils.DevUtilsPage.onBeforeRender(DevUtilsPage.java:61)
> at org.apache.wicket.Component.internalBeforeRender(Component.java:1063)
> at org.apache.wicket.Component.beforeRender(Component.java:1097)
> at org.apache.wicket.Component.prepareForRender(Component.java:2242)
> at org.apache.wicket.Component.prepareForRender(Component.java:2269)
> at org.apache.wicket.Page.renderPage(Page.java:893)
> at org.apache.wicket.protocol.http.WebRequestCycle.redirectTo(WebRequestCycle.java:166)
>
>
> Any thoughts?
DevUtilsPage is modifying the component hierarchy in onBeforeRender,
which is not allowed IIUC. This should fix it:


Index: src/main/java/org/apache/wicket/devutils/DevUtilsPage.java
===================================================================
--- src/main/java/org/apache/wicket/devutils/DevUtilsPage.java (revision
779350)
+++ src/main/java/org/apache/wicket/devutils/DevUtilsPage.java (working
copy)
@@ -54,11 +54,14 @@
  public DevUtilsPage(PageParameters parameters) {
  super(parameters);
  }
-
+
+ {
+ add(new DebugBar("debug"));
+ }
+
  @Override
  protected void onBeforeRender() {
  super.onBeforeRender();
- add(new DebugBar("debug"));
  DevelopmentUtilitiesNotEnabledException.check();
  }
 }


Max.



signature.asc (204 bytes) Download Attachment

Re: devutils -- A child with id 'debug' already exists

by Martijn Dashorst :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, May 31, 2009 at 10:48 AM, Max Bowsher <maxb@...> wrote:
> DevUtilsPage is modifying the component hierarchy in onBeforeRender,
> which is not allowed IIUC.

You're remembering it wrong: in yea old days you weren't allowed to
modify component hierarchy in onAttach(). modifying component
hierarchy in onbeforerender is perfectly allowed, and the only option
to modify the hierarchy once a page has been rendered.

Martijn

Re: devutils -- A child with id 'debug' already exists

by Max Bowsher-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Martijn Dashorst wrote:
> On Sun, May 31, 2009 at 10:48 AM, Max Bowsher <maxb@...> wrote:
>> DevUtilsPage is modifying the component hierarchy in onBeforeRender,
>> which is not allowed IIUC.
>
> You're remembering it wrong: in yea old days you weren't allowed to
> modify component hierarchy in onAttach(). modifying component
> hierarchy in onbeforerender is perfectly allowed, and the only option
> to modify the hierarchy once a page has been rendered.

Ah, ok. Thanks for the clarification. However, it must still be wrong to
do things in onBeforeRender() which are just basic setting up of the
component tree to match the markup, and make no sense to redo every
render, so I think my previous patch is still correct.

Max.



signature.asc (204 bytes) Download Attachment