commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hannes H. (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IO-440) LineIterator should call close on itself when hasNext() returns false. (re-open IO-123)
Date Thu, 01 May 2014 21:42:15 GMT

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

Hannes H. commented on IO-440:
------------------------------

It is not about the documentation but even as an experienced Java developer I expected the
iterator to close the handles after reaching the end of a file,

> 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)

Mime
View raw message