Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0, 1.1-beta-1
-
None
Description
iterator() methods for File, Reader, InputStream, and DataInputStream return iterators that do not close their underlying streams. They should do this, to be consistent with iterative closure methods like eachLine() etc. A solution must take in account that a loop can be broken by an exception inside the loop, that is not caused by a resource read operation. Also in this case the resource must be closed.
See discussion at http://www.nabble.com/File-Iterator-leaves-Reader-open-tf3782079.html.
To clarify problem a JUnit test case will is attached.