You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Daniel Freitas (JIRA)" <ji...@apache.org> on 2008/08/01 06:04:31 UTC

[jira] Updated: (WICKET-1765) Extending from org.apache.wicket.Page causes StackOverflowError

     [ https://issues.apache.org/jira/browse/WICKET-1765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Freitas updated WICKET-1765:
-----------------------------------

    Fix Version/s:     (was: 1.3.4)

> Extending from org.apache.wicket.Page causes StackOverflowError
> ---------------------------------------------------------------
>
>                 Key: WICKET-1765
>                 URL: https://issues.apache.org/jira/browse/WICKET-1765
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>         Environment: Windows XP, Eclipse Ganymede, Wicket 1.3.4, Embedded Jetty
>            Reporter: Daniel Freitas
>            Priority: Minor
>
> Extending directly from Page, instead of WebPage, causes a StackOverflowError due to a recursive loop.
> The problem could be tracked down to the following code:
> Example code:
> public class ClockPage extends Page{ // Extends page directly
> }
> //-----------Page extends MarkupContainer
> public class MarkupContainer ...
> public String getMarkupType()
>     {
>         return getPage().getMarkupType();
>     }
> ...
> }
> //---------getPpage() is inherited from Component:
> public abstract class Component ... {
> ...
> public final Page getPage()
>     {
>         // Search for nearest Page
>         final Page page = findPage();
>         // If no Page was found
>         if (page == null)
>         {
>             // Give up with a nice exception
>             throw new IllegalStateException("No Page found for component " + this);
>         }
>         return page;
>     }
> ...
> }
> When extending directly from page, getPage() (inherited from Component) returns an instance to the ClockPage in the example above, which then calls getMarkupType() on itself which will call getPage() again and on an on until a stack overflow occur.

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