Can't access map values when get(Object key) is overriden
---------------------------------------------------------
Key: VELOCITY-806
URL: https://issues.apache.org/jira/browse/VELOCITY-806
Project: Velocity
Issue Type: Bug
Components: Engine
Affects Versions: 1.7
Reporter: Mateusz Matela
I try to add a java.util.Map instance to Velocity context and access its values
from a template, for example: ${map.get("someKey")}
It doesn't work if use my own implementation of Map.get(Object key). It doesn't
matter whether I implement Map from scratch, or subclass HashMap and override
the get(Object key) metho. The get method is never called and the engine output
is: ${map.get("someKey")}.
It does work if I use my own subclass of HashMap without overriding the
get(Object key) method.
It does work if I use my own implementation of Map with the get(String key)
method added: the get(String key) is called instead of get(Object key).
It does work if I use my class that doesn't implement Map, but has a get(Object
key) method.
More discussion of this on Velocity-User mailing list:
http://old.nabble.com/Can%27t-acces-map-values-when-get%28%29-is-overriden-td31955214.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]