freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Greene (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FREEMARKER-42) ?first sequence operator does not work for SortedSets
Date Fri, 02 Dec 2016 23:30:58 GMT

    [ https://issues.apache.org/jira/browse/FREEMARKER-42?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15716854#comment-15716854
] 

David Greene commented on FREEMARKER-42:
----------------------------------------

That makes sense.  I figured it was something along those lines and the fix might be something
like sequence.iterator().next() regardless of underlying type.  I would suspect that it would
be just fine (and expected) that a HashSet would have an unpredictable order instead of throwing
an exception.

> ?first sequence operator does not work for SortedSets
> -----------------------------------------------------
>
>                 Key: FREEMARKER-42
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-42
>             Project: Apache Freemarker
>          Issue Type: Bug
>    Affects Versions: 2.3.23
>         Environment: JBoss, Linux, JDK8
>            Reporter: David Greene
>            Priority: Minor
>
> ?first should work for SortedSets given that there's an actual .first() method on the
object.
> Offending line of code:
> {code}
> <a href="<@s.url action="index" report=(reportsMenu[key]?first).name />"><@s.text
name=key /></a>
> {code}
> Working alternative:
> {code}
> <a href="<@s.url action="index" report=(reportsMenu[key].first()).name />"><@s.text
name=key /></a>
> {code}
> Stacktrace:
> {code}
> 10:45:00,549 ERROR [freemarker.runtime] (http-0.0.0.0:8443-1) Error executing FreeMarker
template: freemarker.template.TemplateModelException: Underlying collection is not a list,
it's java.util.TreeSet
> ----
> FTL stack trace ("~" means nesting-related):
>        	- Failed at: @s.url action="index" report=(reports...  [in template "mx/widgets/modules/reports/menu/headeradminnavmenu.ftl"
at line 12, column 18]
>        	- Reached through: @mx inc="menu/headeradminnavmenu"  [in template "mx/macros/widgets.ftl"
in macro "moduleHeaderWide" at line 667, column 13]
>        	- Reached through: @_widgets.moduleHeaderWide module="re...  [in template "mx/widgets/modules/reports/header.ftl"
at line 1, column 1]
>        	- Reached through: @mx inc="header"  [in template "mx/decorators/default.ftl"
at line 14, column 9]
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message