Skip to content

Commit 4e99e54

Browse files
author
Stephen Colebourne
committed
Add finalize method
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/io/trunk@383220 13f79535-47bb-0310-9956-ffa450edef68
1 parent 69faa8f commit 4e99e54

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/java/org/apache/commons/io/LineIterator.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ public void remove() {
150150
throw new UnsupportedOperationException("Remove unsupported on LineIterator");
151151
}
152152

153+
/**
154+
* Finalize which closes the underlying reader.
155+
* Do not rely on this method to handle cleanup - call closeQuietly yourself.
156+
*/
157+
protected void finalize() throws Throwable {
158+
close();
159+
}
160+
153161
//-----------------------------------------------------------------------
154162
/**
155163
* Closes the iterator, handling null and ignoring exceptions.

0 commit comments

Comments
 (0)