Hannes H. created IO-441:
----------------------------

             Summary: LineIterator should call close on itself when hasNext() 
returns false. (was IO-123)
                 Key: IO-441
                 URL: https://issues.apache.org/jira/browse/IO-441
             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)

Reply via email to