hash codes should not be treated as unique
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
play framework |
New
|
Undecided
|
Unassigned |
Bug Description
In TemplateLoader the hash code of a VirutalFile's relative path is
used as the key of the "templates" hash map.
Hash codes should newer be considered unique and this cache is
therefore subject to key collisions.
The effect of a collision will be that the wrong template is returned
by the cache.
Consider the following files which will will have the same hash code:
VirtualFile f = VirtualFile.
VirtualFile f2 = VirtualFile.
System.
"M"));
System.
"M")); //produces the same output as the row above!
My suggestion is simply to drop the "hashCode(
part and use the relative path as key for the "templates" cache.
I don´t say that this is a huge problem, but hey, will this be hard to
track down if it occurs...