[ https://issues.apache.org/jira/browse/GROOVY-7902?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-7902. ----------------------------- > collate() infinite loop with zeroed step > ---------------------------------------- > > Key: GROOVY-7902 > URL: https://issues.apache.org/jira/browse/GROOVY-7902 > Project: Groovy > Issue Type: Bug > Components: groovy-jdk, groovy-runtime > Affects Versions: 2.4.7 > Environment: Groovy Version: 2.4.7 JVM: 1.8.0_92 Vendor: Oracle > Corporation OS: Mac OS X > Reporter: Felipe Mamud > Assignee: Paul King > Priority: Minor > Fix For: 2.5.0-alpha-1 > > > Fixing infinite loop in Iterable.collate method when step parameter is equals > to zero. > Example: > {code:java} > [ 1, 2, 3 ].collate( 2, 0 ) > {code} > The result is a infinite loop because the step parameter is used directly in > the for increment: pos += step > In the fixing I assumed that the step parameter should be equals to size > parameter, looks like in the collate(self, size, size, keepRemainder) > overloaded method, with absence of step and I considered backward > compatibility with negative steps. > PR opened in Github: https://github.com/apache/groovy/pull/378 > Thks. > Felipe Mamud -- This message was sent by Atlassian JIRA (v6.3.15#6346)