commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@btopenworld.com>
Subject [io] LineIterator finalize
Date Sun, 05 Mar 2006 19:05:52 GMT
Sandy McArthur wrote:
> I don't think LineIterator should have a finalizer method and I
> believe the JavaDocs in that class about resource leaks are wrong and
> unnecessarily alarming.

Here is the problem as I see it.

Create a LineIterator.
Start using it.
An exception is thrown.
The LineIterator is not closed.

(assumes the user doesn't write the finally clause as the javadoc tells 
them to)

This would appear to be a resource leak situation, as the underlying 
reader, which the iterator wraps, is still open.

If you have a better solution, I'd love to hear it, as I don't like the 
finalize method especially. (Feel free to commit to [io])

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message