GitHub user fmamud opened a pull request:

    https://github.com/apache/groovy/pull/378

    fixing collate() infinite loop when step equals to zero

    Fixing infinite loop in `Iterable.collate` method when `step` parameter is 
equals to zero.
    
    Example:
    ```groovy
    [ 1, 2, 3 ].collate( 2, 0 )
    ```
    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.
    
    Thks.
    Felipe Mamud

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/fmamud/groovy fix-step-infiniteloop

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/378.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #378
    
----
commit c497a45768447036ee826406b7318785cf24d257
Author: fmamud <trova...@gmail.com>
Date:   2016-08-05T03:29:28Z

    fixing collate() infinite loop when step equals to zero

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to