This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-collections.git
The following commit(s) were added to refs/heads/master by this push: new 057ab56 Use try-with-resource. 057ab56 is described below commit 057ab56f3e3b9bf999104f29e9b1534a611298cc Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Nov 21 10:12:08 2020 -0500 Use try-with-resource. --- .../org/apache/commons/collections4/AbstractObjectTest.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/apache/commons/collections4/AbstractObjectTest.java b/src/test/java/org/apache/commons/collections4/AbstractObjectTest.java index 9939b1d..3ece9fe 100644 --- a/src/test/java/org/apache/commons/collections4/AbstractObjectTest.java +++ b/src/test/java/org/apache/commons/collections4/AbstractObjectTest.java @@ -261,11 +261,8 @@ public abstract class AbstractObjectTest extends BulkTest { * @throws IOException */ protected void writeExternalFormToDisk(final Serializable o, final String path) throws IOException { - final FileOutputStream fileStream = new FileOutputStream(path); - try { + try (FileOutputStream fileStream = new FileOutputStream(path)) { writeExternalFormToStream(o, fileStream); - } finally { - fileStream.close(); } } @@ -294,11 +291,8 @@ public abstract class AbstractObjectTest extends BulkTest { * @throws ClassNotFoundException */ protected Object readExternalFormFromDisk(final String path) throws IOException, ClassNotFoundException { - final FileInputStream stream = new FileInputStream(path); - try { + try (FileInputStream stream = new FileInputStream(path)) { return readExternalFormFromStream(stream); - } finally { - stream.close(); } }