[
https://issues.apache.org/jira/browse/GROOVY-7619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14950432#comment-14950432
]
Mark Visontai commented on GROOVY-7619:
---------------------------------------
Yes, if I run it as a Groovy script in GGTS it produces also the correct
result. So we can close the issue here. (As I see it takes some time until I
set up grails 3 in GGTS, so far it supports only 2.x... but thanks, going back
to the Grails bug tracker then :)
> 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
>
> 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)