[
https://issues.apache.org/jira/browse/GROOVY-7619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14948088#comment-14948088
]
Mark Visontai commented on GROOVY-7619:
---------------------------------------
I submitted the issue to the grails bug tracker first but they suggested that
is a groovy issue so do it here. Could you please try it with 2.3.7? I am
really curious what is going on. I am using GGTS (Version: 3.6.4.RELEASE Build
Id: 201503100339) on two machines and the same issue everywhere. Shall I send
the generated class file?
> each() method does not iterate properly
> ---------------------------------------
>
> Key: GROOVY-7619
> URL: https://issues.apache.org/jira/browse/GROOVY-7619
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.3.7
> Environment: OS: Windows 7
> Grails: 2.4.4
> JDK: 1.8.0_31
> Reporter: Mark Visontai
> Priority: Critical
>
> it seems the each method is erroneous. For the code:
> {code}
> def xml = new XmlSlurper().parseText('''
> <list>
> <item a="1">a</item>
> <item a="2">b</item>
> <item a="1">c</item>
> </list>
> ''')
> xml.'**'.findAll { it.@a=='1' }.each {
> println "hi"
> }
> {code}
> |{code: title=Expected output:}
> hi
> hi
> {code}|{code: title=Actual output:|bgColor=#fcc}hi{code}|
> Two result items are only provided if I also print something that is changing
> between the iterations, eg. a variable with increasing value, like
> {code}
> def i=0
> xml.'**'.findAll { it.@a=='1' }.each {
> println "hi" + i++
> }
> {code}
> what can be the reason?
> Thanks,
> Mark
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)