You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Robin Shine (JIRA)" <ji...@apache.org> on 2014/03/28 10:24:14 UTC

[jira] [Updated] (WICKET-5546) Adding behavior in component instantiation listener causes Page.onInitialize() being called even if constructor throws an exception

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

Robin Shine updated WICKET-5546:
--------------------------------

    Attachment: myproject.zip

To reproduce the issue, extract attached file to a directory, and run "mvn jetty:run" inside extracted directory. Then visit http://localhost:8080. The page will throw an exception in constructor intentionally. Now check the console the "onInitialize" text will be printed indicating that Page.onInitialize has been called.

> Adding behavior in component instantiation listener causes Page.onInitialize() being called even if constructor throws an exception
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-5546
>                 URL: https://issues.apache.org/jira/browse/WICKET-5546
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.13.0, 6.14.0
>            Reporter: Robin Shine
>            Priority: Minor
>         Attachments: myproject.zip
>
>
> Page.onInitialize() will be called even if constructor throws an exception
> in case below code is added in wicket WebApplication.init():
> getComponentInstantiationListeners().add(new IComponentInstantiationListener() {
>               @Override
>               public void onInstantiation(Component component) {
>                   component.add(new Behavior() {
>                   });
>               }
>              
>           });
> It seems that the instantiation listener adds the behavior to the page at very start of the page constructor, and then the page is marked as dirty to cause onInitialize() being called afterwards.



--
This message was sent by Atlassian JIRA
(v6.2#6252)