[
https://issues.apache.org/jira/browse/SLING-7380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16326215#comment-16326215
]
ASF GitHub Bot commented on SLING-7380:
---------------------------------------
raducotescu opened a new pull request #1: SLING-7380 - Querying maps with
Integer keys returns null
URL:
https://github.com/apache/sling-org-apache-sling-scripting-sightly-compiler/pull/1
* allow maps with any type of key to be queried directly
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> 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
> Priority: Major
> 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)