[
https://issues.apache.org/jira/browse/WICKET-2764?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Christian Oldiges updated WICKET-2764:
--------------------------------------
Attachment: wicket2764.tgz
Here is a quickstart to reproduce the problem.
There are 2 HomePage classes, one showing "HomePage", the other one showing
"HomePage2".
If you start the server and access the URL:
http://localhost:8080/wicket2764/p1.html it will show you "HomePage"
Now access the 2. page:
http://localhost:8080/wicket2764/p2.html it will still show you "HomePage"
Now restart the server and access p2 first -> it will show you "HomePage2"
Then access "p1.html" -> it will show you "HomePage2" again.
The MergedMarkup instance get mixed up in the cache because for both
combinations (BasePage,HomePage) and (BasePage,HomePage2).
"null:null" will be used as the locationAsString.
A quick fix would be include a NULL check in MergedMarkup#locationsAsString and
return NULL in case both
source values are NULL, but I am not sure about the implications of such a fix.
> MarkupCache messed up when using MergedMarkup (e.g. for Page markup
> inheritance) together with IResourceStreams that do NOT also implement
> IFixedLocationResourceStream
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: WICKET-2764
> URL: https://issues.apache.org/jira/browse/WICKET-2764
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.6
> Reporter: Christian Oldiges
> Priority: Minor
> Attachments: wicket2764.tgz
>
>
> For a project that requires markup reloading and a custom markup directory
> structure we have implemented a custom IResourceStreamLocator.
> This implementation creates instance of its own IResourceStream
> implementation which does NOT at the same time implement
> IFixedLocationResourceStream.
> This means there is no "locationAsString()" method implemented on the
> resource stream instances.
> Now the MarkupCache comes into the picture. It is using a cacheKey and the
> locationAsString as cache keys using a 2 step mechanism.
> cacheKey -> locationAsString
> locationAsString -> Markup
> Additionally MergedMarkup comes into play. MergedMarkup is a markup instance
> that merges a base markup with another markup.
> This is typically used for markup inheritance.
> BasePage.html implemented by BasePage
> PageA.html extends BasePage
> PageB.html extends BasePage
> MergedMarkup#locationAsString() concatenates the locationAsString values of
> its source markup/resource objects putting a ":" inbetween.
> This means it will NEVER be NULL, even if both source objects return NULL as
> their locationAsString values.
> Now, in case the original resource streams do not implement
> IFixedLocationResourceStream, this result in a locationAsString of
> "null:null".
> Unfortunately this is the case for ALL possible combinations of the source
> objects of MergedMarkup
> So the locationAsString is "null:null" for (BasePage,PageA) and also for
> (BasePage,PageB)
> Back to the MarkupCache#loadMarkup method.
> There is a check to use the cacheKey as a replacement for locationAsString in
> case its NULL.
> Now, if the Markup loaded is a MergedMarkup instance, it doesnt return NULL,
> but "null:null".
> So, putIntoCache() gets called with "null:null" as the key for ALL possible
> combinations resulting in a huge chaos of templates being merged together,
> when those cache entries are used later on.
> A workaround is to implement IFixedLocationResourceStream on our custom
> IResourceStream implementation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.