On 3/5/06, Stephen Colebourne <[EMAIL PROTECTED]> wrote:
> 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.

Okay, but once the LineIterator instance is no longer strongly
reachable it will be garbage collected. This will then make the Reader
instance no longer strongly reachable and it will be garbage
collected. When the Reader instance is collected then there are no
leaked resources.

--
Sandy McArthur

"He who dares not offend cannot be honest."
- Thomas Paine

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to