[
https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Joseph Pachod reopened WICKET-2819:
-----------------------------------
hi igor
just for the sake of completeness, some more explanations.
My idea is to change the AnnotatedMountScanner for it to check whether it can
effectively create the annotated pages it founds (for example in
AnnotatedMountScanner.getPatternMatches(String pattern)).
So, how does page creation work ? BookmarkablePageRequestTarget uses the
IPageFactory.
So, how do I check a page can be created later on ? Creating the page at
scanning time just for checking I could create them later on seems a bit over
the top to me (but then I could be wrong). I would prefer to check if the
pages' signatures are in sync with the requirements for creating page.
But there, I've no formal way to check that. For sure, the default
implementation of IPageFactory expects a default constructor or one with page
parameters. But the whole point of making IPageFactory an interface is to allow
anyone to change that. As such, just relying on empty constructor/page
parameters seems potentially broken and not generic enough. That's why I spoke
of adding some way in the IPageFactory to check whether it can use some given
page.
If the interface was to change in 1.5, that would be ok, in between I would
write a temporary patch for it, so we don't run into these "cannot create page
exceptions" locally.
About the "we don't need a specific exception for page creation exceptions,
since they shouldn't happen in production", could I've spotted that in any
javadoc/code somewhere ? Or is it true in general for WicketRuntimeException ?
In such case, I guess the javadoc from WicketRuntimeException could be more
explicit.
> When unable to create a page, throw a specific exception instead of
> WicketRuntimeException
> ------------------------------------------------------------------------------------------
>
> Key: WICKET-2819
> URL: https://issues.apache.org/jira/browse/WICKET-2819
> Project: Wicket
> Issue Type: Improvement
> Reporter: Joseph Pachod
> Assignee: Igor Vaynberg
> Priority: Minor
>
> currently, when the DefaultPageFactory doesn't succeed in creating a given
> page, it throws a WicketRuntimeException with some message like " Unable to
> create page from class org.demo.TestPage. Class does neither have a
> constructor with PageParameter nor a default constructor".
> Could it be possible to have a specific exception being thrown (extending
> WicketRuntimeException for sure) ?
> Thus, it would allow us to deal cleanly with this type of exception (and
> providing a better error message to our users).
> thanks in advance
> joseph
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.