You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Radu Cotescu (JIRA)" <ji...@apache.org> on 2018/01/16 09:05:00 UTC

[jira] [Updated] (SLING-7380) Querying maps with Integer keys returns null

     [ https://issues.apache.org/jira/browse/SLING-7380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Radu Cotescu updated SLING-7380:
--------------------------------
    Affects Version/s: Scripting HTL Java Compiler 1.0.12

> 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, Scripting HTL Java Compiler 1.0.12
>            Reporter: Radu Cotescu
>            Assignee: Radu Cotescu
>            Priority: Major
>             Fix For: Scripting HTL Java Compiler 1.0.20, 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)