You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Babak Vahdat (JIRA)" <ji...@apache.org> on 2013/12/26 16:09:50 UTC

[jira] [Resolved] (CAMEL-7096) The ObjectHelper#createIterator utility should properly adhere the java.util.Iterator contract

     [ https://issues.apache.org/jira/browse/CAMEL-7096?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Babak Vahdat resolved CAMEL-7096.
---------------------------------

    Resolution: Fixed

> The ObjectHelper#createIterator utility should properly adhere the java.util.Iterator contract
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-7096
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7096
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.12.2
>            Reporter: Babak Vahdat
>            Assignee: Babak Vahdat
>            Priority: Minor
>             Fix For: 2.11.3, 2.12.3, 2.13.0
>
>
> According to the {{java.util.Iterator#next()}} contract the implementation should throw {{NoSuchElementException}} if the iteration has no more elements. However this is currently not the case by the different anonymous class implemetations of this interface through {{ObjectHelper#createIterator()}}.
> The side effect of this is that currently this could end up with {{IndexOutOfBoundsException}} and what not if one would iterate over the {{Node}}(s) of a DOM {{NodeList}}. Another example is that calling {{next()}} on the {{Iterator}} returned for an empty String *repeatedly* doesn't throw  any {{NoSuchElementException}} *although* it's {{hasNext()}} method returns false!
> We should better provide guards for the condition when there's no more elements available in which case a {{NoSuchElementException}} should be thrown.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)