hey guys, while helping pepone pepone on the user list ive come across a bug. most of the time when we instantiate a page we do it using a wrong call to the pagefactory. most of the time we use newPage(class, PageParams) even though page params are empty and so the newPage(Class) should be used instead which invokes the default constructor.

i went through all the places i could find and basically did this
if (pageparams.size()==0) { page=newPage(class); } else { page=newPage(class, pageparams); }

and then a lot of tests broke because they depend on wicket calling the wrong constructor! so i had to go and fix all those. i would say 90% of all test pages were expecting to be instantiated with the wrong constructor, probably because they were copied and pasted most of the time.

while doing all this and discussing it with eelco we agreed that it might be better to change ipagefactory to only have one constructor: (class, pageparams) and allow pagaparams to be null. the rule would be simple: if page params==null||pageparams.size()==0 use the default constructor, otherwise use the pageparams one.


what do you think?

-Igor


Reply via email to