bernard created WICKET-5069:
-------------------------------

             Summary: Validation and Code Quality Issues with "Default 
Constructor" on Re-creation after Page Expiry
                 Key: WICKET-5069
                 URL: https://issues.apache.org/jira/browse/WICKET-5069
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 6.4.0
         Environment: All
            Reporter: bernard


The name "Default Constructor" in Java is reserved for the no-argument 
constructor.

However Wicket has a different idea of what a default constructor is.

Let us consider the folowing case:

No PageParameters exist for a page. Let this page have two constructors, one 
default constructor and one constructor with a PageParameters parameter.

The page is bookmarkable and mounted.

Let this page be re-created after session expiry so that no stored version of 
the page exists.

The expected result is that the page is created with its default constructor 
because no PageParameters exist.

The actual result is that PageProvider#resolvePageInstance() creates bogus 
PageParameters for the page and calls the constructor with PageParameters 
parameters.

The impact of this is as follows:

1) Validation issue. A page parameters validating page must assume that if 
PageParameters exist that these have to be validated. If any parameters that 
are required for the page to live are missing then the application has to 
assume that the URL is invalid e.g. tampered with.
2) DRY code quality issue. If Wicket has already established that no 
PageParameters exist then the application again needs to check for bogus 
parameters which it would not have to do in the default constructor.


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

Reply via email to