https://issues.apache.org/bugzilla/show_bug.cgi?id=55792

--- Comment #1 from Nick Williams <nicho...@nicholaswilliams.net> ---
Please note the following revision to this bug:

It's only the map-literal that isn't working. The list-literal is working fine.
When I used the list-literal originally, I mapped before sorting, like so:

    ${users.stream()
        .filter(u -> fn:contains(u.username, '1'))
        .map(u -> [u.username, u.firstName, u.lastName])
        .sorted((u1, u2) -> (x = u1.lastName.compareTo(u2.lastName);
            x == 0 ? u1.firstName.compareTo(u2.firstName) : x))
        .toList()}

This caused the NumberFormatException, which makes sense. When mapping happens
after sorting:

    ${users.stream()
        .filter(u -> fn:contains(u.username, '1'))
        .sorted((u1, u2) -> (x = u1.lastName.compareTo(u2.lastName);
            x == 0 ? u1.firstName.compareTo(u2.firstName) : x))
        .map(u -> [u.username, u.firstName, u.lastName])
        .toList()}

The expression works correctly. So the ONLY expression that isn't working uses
the map-literal for the mapping:

    ${users.stream()
        .filter(u -> fn:contains(u.username, '1'))
        .sorted((u1, u2) -> (x = u1.lastName.compareTo(u2.lastName);
            x == 0 ? u1.firstName.compareTo(u2.firstName) : x))
        .map(u -> {'username':u.username, 'first':u.firstName,
            'last':u.lastName})
        .toList()}

This is definitely broken, as the } ending the map-literal makes the EL engine
think the expression has ended prematurely.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to