[ https://issues.apache.org/jira/browse/WICKET-1765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg resolved WICKET-1765. ----------------------------------- Resolution: Fixed Fix Version/s: 1.4-M4 1.3.5 Assignee: Igor Vaynberg > 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 > Assignee: Igor Vaynberg > Priority: Minor > Fix For: 1.3.5, 1.4-M4 > > > 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.