Radu Cotescu created SLING-7380:
-----------------------------------
Summary: Querying maps with Integer keys returns null
Key: SLING-7380
URL: https://issues.apache.org/jira/browse/SLING-7380
Project: Sling
Issue Type: Bug
Components: Scripting
Affects Versions: Scripting HTL Compiler 1.0.12
Reporter: Radu Cotescu
Assignee: Radu Cotescu
Fix For: Scripting HTL Compiler 1.0.18
Querying maps with {{Integer}} keys returns {{null}} in HTL. The following code
can be used to reproduce the problem:
{code:html}
<pre data-sly-use.m="MapsPojo">
Integer Map: \${m.INTEGER_MAP["one"]}: ${m.INTEGER_MAP["one"]}
Strings Map: \${m.STRINGS_MAP[1]}: ${m.STRINGS_MAP[1]}
</pre>{code}
{code:java}
public class MapsPojo {
public static final Map<String, Integer> INTEGER_MAP = new HashMap<String,
Integer>() {{
put("one", 1);
}};
public static final Map<Integer, String> STRINGS_MAP = new HashMap<Integer,
String>() {{
put(1, "one");
}};
}
{code}
The expected output is:
{code:html}
Integer Map: ${m.INTEGER_MAP["one"]}: 1
Strings Map: ${m.STRINGS_MAP[1]}: one
{code}
However, the current output is:
{code:html}
Integer Map: ${m.INTEGER_MAP["one"]}: 1
Strings Map: ${m.STRINGS_MAP[1]}:
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)