diff --git a/src/test/java/org/apache/commons/compress/harmony/pack200/tests/ArchiveTest.java b/src/test/java/org/apache/commons/compress/harmony/pack200/tests/ArchiveTest.java index b48d3285778..4e112c3f3ae 100755 --- a/src/test/java/org/apache/commons/compress/harmony/pack200/tests/ArchiveTest.java +++ b/src/test/java/org/apache/commons/compress/harmony/pack200/tests/ArchiveTest.java @@ -118,14 +118,12 @@ private void compareJarEntries(final JarFile jarFile, final JarFile jarFile2) { @Test public void testAlternativeConstructor() throws IOException, URISyntaxException, Pack200Exception { - final JarInputStream inStream = new JarInputStream(new FileInputStream( - new File(Archive.class.getResource( - "/pack200/sqlUnpacked.jar").toURI()))); - file = File.createTempFile("sql", ".pack.gz"); - file.deleteOnExit(); - out = new FileOutputStream(file); - new Archive(inStream, out, null).pack(); - inStream.close(); + try (JarInputStream inStream = new JarInputStream(new FileInputStream(new File(Archive.class.getResource("/pack200/sqlUnpacked.jar").toURI())))) { + file = File.createTempFile("sql", ".pack.gz"); + file.deleteOnExit(); + out = new FileOutputStream(file); + new Archive(inStream, out, null).pack(); + } out.close(); }