Details
Description
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
//-----------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)
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.