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/02 22:51:27 UTC

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

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
            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.


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

Posted by "Joseph Pachod (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12861779#action_12861779 ] 

Joseph Pachod commented on WICKET-2819:
---------------------------------------

I don't know much of Page and its various usages/subclasses... 

I was assuming that trying to create all theses pages would be quite a performance drag (notably since it would happen all on startup). 

Anyway, I'll do it this way

thanks again

> 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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2819.
-----------------------------------

    Resolution: Won't Fix

no, i do not think i agree. how would a more specific exception help you here? what would you show to the user? "woops, sorry, our developer forgot to add a constructor"? if a different user-related action made sense i would have no problem adding something more specific, but i just dont see it.

on the other hand, checking for something like this should be pretty easy. scan your classes and look for the classes with that annotation and then check if they have the required constructor. it is trivial to write a maven2 plugin that does the scanning and use ASM to do the check. you can use the maven2 plugin from salve.googlecode.com source to get you most of the way there.

> 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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852955#action_12852955 ] 

Igor Vaynberg commented on WICKET-2819:
---------------------------------------

> Thus, it would allow us to deal cleanly with this type of exception 

this exception is a development-time error, how would you deal with it cleanly?

> (and providing a better error message to our users). 
once again, this is development time - who are your "users" you are refering to? also the exception has all the information one may need to fix the problem...


> 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
>            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.


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

Posted by "Joseph Pachod (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852962#action_12852962 ] 

Joseph Pachod commented on WICKET-2819:
---------------------------------------

The issue pops up in production when some users use their browsers to bookmark pages which aren't bookmarkable. For us, it's mostly about the "Registration successful" page, but can happen for some others as well.

Later, when the user try to access the page, an exception is thrown.

What happens next is application specific. In our case, we catch all exceptions in a specific request cycle and we can then attach specific behavior to some exception class or fall back to the default error page.

In the case of a non bookmarkable page that someone tries to access, this is not an unknown error, we know what occurred and for which reason. Thus we would like to provide a more meaningful message, like for example "The page you requested isn't directly accessible. Please use the navigation to get back there". 

But maybe I'm missing something... 

As a side note, is it better to speak first on the mailing list of such requests or going directly at jira is fine enough ?

> 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
>            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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2819.
-----------------------------------

    Resolution: Won't Fix

why would those methods be in the interface? they are there only to help debugging...they have no meaning to wicket. besides, we cannot change the interface in 1.4.x anyways so even if we did it would have to wait for 1.5.

the contract for the pagestore is well known, you can easily accomplish what you want by writing the checks yourself.

> 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.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Joseph Pachod (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joseph Pachod reopened WICKET-2819:
-----------------------------------


please have a look at the previous comment

> 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.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Joseph Pachod (JIRA)" <ji...@apache.org>.
     [ 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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852973#action_12852973 ] 

Igor Vaynberg commented on WICKET-2819:
---------------------------------------

if the users bookmark a non-bookmarkable url they should get a page-expired exception...

> 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
>            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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12861438#action_12861438 ] 

Igor Vaynberg commented on WICKET-2819:
---------------------------------------

you do have a formal way, use the factory to instantiate a page and look for an exception. if we go down your path then every interface will have to have a canDoSomething() in addition to every doSomething() method, which just pollutes the API.

> 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.


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

Posted by "Joseph Pachod (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12853818#action_12853818 ] 

Joseph Pachod commented on WICKET-2819:
---------------------------------------

I found the reason for this exception being thrown: we have a page annotated with @MountHybrid(redirectOnBookmarkableRequest = true) which doesn't provide the required constructor (empty or with pageparameters).

The exact trace is the following:
ERROR - RequestCycle               - Unable to create page from class de.thomasdaily.project.tdpublic.wicket.registration.pages.RegistrationDonePage. Class does neither have a constructor with PageParameter nor a default constructor
org.apache.wicket.WicketRuntimeException: Unable to create page from class de.thomasdaily.project.tdpublic.wicket.registration.pages.RegistrationDonePage. Class does neither have a constructor with PageParameter nor a default constructor
	at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:68)
	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:299)
	at org.apache.wicket.request.target.coding.HybridUrlCodingStrategy$HybridBookmarkablePageRequestTarget.newPage(HybridUrlCodingStrategy.java:888)
	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:321)
	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
	at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
	at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
	at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468)
	at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:301)
	at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
	at org.codesmell.jpsak.servlet.EntityManagerFilter.doFilter(EntityManagerFilter.java:40)
	at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
	at com.softculture.services.errornotification.wicket.ENFilter.doFilter(ENFilter.java:45)
	at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
	at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:181)
	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
	at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:269)
	at com.caucho.server.port.TcpConnection.run(TcpConnection.java:603)
	at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
	at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
	at java.lang.Thread.run(Thread.java:619)

On the bigger picture, I would still go for a specific exception being thrown in this use case.

Indeed, checking that no developer makes this coding error is tricky (we're thinking of some maven plugin), and having a dedicated exception could still be used later as a "safety net" to detect it (to skip the error page and send a warning mail to the maintenance team).

Would you agree ?



> 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.


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

Posted by "Joseph Pachod (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joseph Pachod closed WICKET-2819.
---------------------------------

    Resolution: Fixed

> 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.


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

Posted by "Joseph Pachod (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joseph Pachod closed WICKET-2819.
---------------------------------

    Resolution: Won't Fix

> 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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2819.
-----------------------------------

    Resolution: Won't Fix
      Assignee: Igor Vaynberg

please reopen when you have more information and if this request still makes sense to you.

> 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.


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

Posted by "Joseph Pachod (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joseph Pachod reopened WICKET-2819:
-----------------------------------


see previous comment

> 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.


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

Posted by "Joseph Pachod (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12853116#action_12853116 ] 

Joseph Pachod commented on WICKET-2819:
---------------------------------------

Hum, ok.. I'll look deeper then (most probably on Tuesday).

thanks again

> 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
>            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.


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

Posted by "Joseph Pachod (JIRA)" <ji...@apache.org>.
    [ 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.


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

Posted by "Joseph Pachod (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12855166#action_12855166 ] 

Joseph Pachod commented on WICKET-2819:
---------------------------------------

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.


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

Posted by "Joseph Pachod (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joseph Pachod reopened WICKET-2819:
-----------------------------------


switching "Resolution:  	 Fixed  " to "won't fix"

> 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.