You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Hannes H. (JIRA)" <ji...@apache.org> on 2014/04/29 09:15:16 UTC

[jira] [Created] (IO-440) LineIterator should call close on itself when hasNext() returns false. (re-open IO-123)

Hannes H. created IO-440:
----------------------------

             Summary: LineIterator should call close on itself when hasNext() returns false. (re-open IO-123)
                 Key: IO-440
                 URL: https://issues.apache.org/jira/browse/IO-440
             Project: Commons IO
          Issue Type: Improvement
          Components: Utilities
            Reporter: Hannes H.
            Priority: Minor


As in IO-123 described the LineIterator should call close when hasNext() returns false.

One mentioned reason against this behavior was the fact, that in case of a thrown Exception in the code block under the Iterator will never be closed.

In my opinion this argumentation is not valid, because in the current implementation the developer as well needs to take care to close the iterator in case of an Exception, so the responsibility does not change.

To not brake existing implementations I suggest to overload the methods with an additional boolean argument which enables an auto-close.

I know, one should read the documentation before using a library, but in my opinion the current behavior - not closing when hasNext() returns false - is not expected at all, at least for me. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)