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

[jira] [Comment Edited] (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:comment-tabpanel&focusedCommentId=13951819#comment-13951819 ] 

Sven Meier edited comment on WICKET-5546 at 3/29/14 9:51 AM:
-------------------------------------------------------------

Interestingly adding a behavior in the page's constructor does not expose this issue.

Reason:
Page's constructor calls #init(), which calls dirty(true). This leads to the page being marked dirty *without* calling pageManager#touchPage()
If a behavior is added afterwards, the page is already marked dirty.

But if the behavior is added from an instantiationListener, the constructor and #init() has not been called yet - thus the page is marked dirty *and* touched :/.


was (Author: svenmeier):
adding behavior in page constructor too

> 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: WICKET-5546.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)