You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Joseph Pachod (JIRA)" <ji...@apache.org> on 2010/04/08 23:30:36 UTC

[jira] Issue Comment Edited: (WICKET-2819) When unable to create a page, throw a specific exception instead of WicketRuntimeException

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

Joseph Pachod edited comment on WICKET-2819 at 4/8/10 9:28 PM:
---------------------------------------------------------------

hi

a better solution than the maven plugin would be, IMHO, that the AnnotatedMountScanner checks when scanning that the pages annotated are effectively usable by the IPageFactory (throwing exception if not). 

This is easy to do, apart that IPageFactory doesn't provide a way to check if it can use some given page class. 

Could it be possible to some methods  in IPageFactory, like for example (better names welcome):
    <C extends Page>  isNewPagePossible(final Class<C> pageClass);
    <C extends Page>  isNewPagePossible(final Class<C> pageClass, final PageParameters parameters);

The refactoring needed for the DefaultPageFactory is small (few lines of reflective code).

Such methods would allow the AnnotatedMountScanner to use for sure the same strategy as the current one in use.

What do you think of that ?

If ok, I would gladly provide the patches next week (long week end starting tomorrow).

best regards
joseph

      was (Author: joseph_p):
    hi

a better solution than the maven plugin would be, IMHO, that the AnnotatedMountScanner checks when scanning that the pages annotated are effectively usable by the IPageFactory (and throwing exception if not). 

This is easy to do, apart that IPageFactory doesn't provide a way to check if it can use some given page class. 

Could it be possible to some methods  in IPageFactory, like for example (better names welcome):
    <C extends Page>  isNewPagePossible(final Class<C> pageClass);
    <C extends Page>  isNewPagePossible(final Class<C> pageClass, final PageParameters parameters);

The refactoring needed for the DefaultPageFactory is small (few lines of reflective code).

Such methods would allow the AnnotatedMountScanner to use for sure the same strategy as the current one in use.

What do you think of that ?

If ok, I would gladly provide the patches next week (long week end starting tomorrow).

best regards
joseph
  
> 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.