Hi All,

We are glad to see that the issue WICKET-5387 (Page#onInitialize called after 
an exception in the constructor of Page) has been resolved in 6.13.0. However 
when I tried this version (and 6.14.0) with below code, the issue still exist:

public class TestPage extends WebPage {

    public TestPage() {
        throw new RuntimeException("exception");
    }

    @Override
    protected void onInitialize() {
        super.onInitialize();
        
        System.out.println("onInitialize");
    }
    
}

As you can see from above code, I intentionally throws an exception in TestPage 
constructor and hoping that onInitialize() method is not called when I visit 
that page. But the result is that "onInitialize" is still getting called in 
this case. Am I understanding WICKET-5387 incorrectly? And is there any 
approach to prevent onInitialize() from being called in case of a constructor 
exception? We want this as onInitialize() might rely on some params setup in 
the constructor, and calling onInitialize() will lead to other exceptions 
hiding exceptions thrown in constructor.

Regards

Robin

Reply via email to