You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2013/02/27 17:39:14 UTC

[jira] [Commented] (WICKET-5008) PageProvider#getPageInstance() calls wrong Page Constructor if pageParameters is null

    [ https://issues.apache.org/jira/browse/WICKET-5008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13588490#comment-13588490 ] 

Martin Grigorov commented on WICKET-5008:
-----------------------------------------

I miss the essential part in your description and comment - how to reproduce the problem ?

I've tried the quickstart application and it works OK.
Should I wait for expiration ? There is no session-config in web.xml so I'm not sure this is important in this case.

You say the wrong constructor is called. Which one is the wrong and which one is the correct ?
Additionally org.apache.wicket.core.request.handler.PageProvider#getPageInstance() doesn't call any constructor. It asks org.apache.wicket.core.request.handler.PageProvider#resolvePageInstance to do some checks and then finally getPageSource().newPageInstance() delegates to IPageFactory to call any constructors.

And finally what I think really is what makes you feel there is a problem is org.apache.wicket.DefaultMapperContext#newPageInstance(). It checks for "parameters == null" while PageProvider#resolvePageInstance() always passes non-null. The explanation is in org.apache.wicket.session.DefaultPageFactory#newPage(Class, PageParameters) - if the page has no constructor with PageParameters then it falls back to the default constructor. Since your page has both default constructor and one with PageParameters the latter is prefered. This is the default way Wicket works. If you need custom behavior then you need custom IPageFactory.

In the future please try to keep technical and try to avoid giving opinion on how messy/stupid/... is the code. Often you are not correct and such statements just lead to ignorance. I'm trying to say that I refuse to debug a problem just because its description is too arrogant. Thank you!
                
> PageProvider#getPageInstance() calls wrong Page Constructor if pageParameters is null
> -------------------------------------------------------------------------------------
>
>                 Key: WICKET-5008
>                 URL: https://issues.apache.org/jira/browse/WICKET-5008
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.4.0
>            Reporter: bernard
>         Attachments: TestCase.zip
>
>
> I was wondering why my pages' default constructors aren't called anymore since after 1.4.
> The problem is that PageProvider#getPageInstance() does not distinguish between pages that have parameters and pages that don't.
> This creates a messy situation for pages that accept page parameters.
> One case I know of is ListenerInterfaceRequestHandler#respond() which calls ListenerInterfaceRequestHandler#getPage().
> If this call hits an expired page then the page crashes in the constructor Page(final PageParameters parameters) because of the bogus parameters.
> I would expect that the default constructor is called in this case.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira