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

Reply via email to