groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7961) ObjectRange iterator returns null instead of NoSuchElementException
Date Thu, 06 Oct 2016 23:57:20 GMT

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

ASF GitHub Bot commented on GROOVY-7961:
----------------------------------------

GitHub user jt1796 opened a pull request:

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

    Groovy-7961 : NoSuchElementException

    https://issues.apache.org/jira/browse/GROOVY-7961
    
    This is a similar PR to 
    https://github.com/apache/groovy/pull/412

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

    $ git pull https://github.com/jt1796/groovy object-range-exception

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

    https://github.com/apache/groovy/pull/440.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 #440
    
----
commit 6e771ebe9ff24e73ba85f8c83ff3ef1f9081f716
Author: John Tompkins <tompkins.jt@gmail.com>
Date:   2016-10-06T03:25:24Z

    Merge pull request #1 from apache/master
    
    update

commit 317c625463169e36f9f1100b1becbd46806eaaee
Author: John Tompkins <tompkins.jt@gmail.com>
Date:   2016-10-06T23:54:58Z

    do not return null when exhausted

----


> ObjectRange iterator returns null instead of NoSuchElementException
> -------------------------------------------------------------------
>
>                 Key: GROOVY-7961
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7961
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.7
>            Reporter: John Wagenleitner
>            Assignee: John Wagenleitner
>            Priority: Minor
>
> Calling {{next()}} on an {{ObjectRange}} iterator returns {{null}} when {{hasNext{}}}
returns false.  It should throw {{NoSuchElementException}} to adhere to the Iterator contract.
> {code}
> class ObjectRangeItrTest extends GroovyTestCase {
>     void testItr() {
>         def itr = ('a'..'b').iterator()        
>         assert itr.next() == 'a'
>         assert itr.next() == 'b'
>         assert !itr.hasNext() 
>         shouldFail(NoSuchElementException) {
>             println itr.next()
>         }
>     }
> }
> {code}



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

Mime
View raw message