Malcolm Edgar wrote:
> Interesting, I haven't seen this bug in any of the stateful pages we
> are using prior to 1.5M2
If you refreshed a stateful page really really fast so that some
requests were busy creating (or retrieving) the Page and other
requests were inside the sync block, the NPE can occur. :)
What happened was that request1 nullified the PageImports inside the
sync block, while request2 was waiting for the lock to be released.
Before request1 leaves the sync block it sets the PageImports to null.
Next request2 grabs the lock, but the PageImports is set to null and
NPE ensues.
>
>> To be on the safe side I've changed the setPageImports to package
>> private and getPageImports is now final.
>
> On the Page class however, getPageImports() should not be final so
> that pages can override this method, which is called just prior to
> rendering, to modify the PageImports. For example in the HomePage
> scenario where the page uses a condensed CSS style sheet, and or JS
> imports.
Not sure I follow. getPageImports is called before the resources are
added by the Page and Controls. So overriding it won't enable one to
change the imports as the PageImports is still empty at this stage.
I was thinking of adding a method Page#skipControlImports(boolean),
which when true, will only import from the Page, not Controls. That
way the Page can provide an optimized CSS+JS for the HomePage.
> Also on the setPageImports, I think this method should be public. I
> dont see any benefit to making it package private.
If it is public it means the user can set the PageImports. I am a
little unsure what the use case for that would be. As PageImports is
quite involved, I doubt folk will set PageImports very often if ever.
But its easy to change either way :)
kind regards
bob
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
Click-development mailing list
Click-development@...
https://lists.sourceforge.net/lists/listinfo/click-development