diff --git a/enterprise-update/src/test/java/org/alfresco/update/pkg/test/TgzFormatIntegrationTest.java b/enterprise-update/src/test/java/org/alfresco/update/pkg/test/TgzFormatIntegrationTest.java index 82c0bda663..6b55c550fb 100644 --- a/enterprise-update/src/test/java/org/alfresco/update/pkg/test/TgzFormatIntegrationTest.java +++ b/enterprise-update/src/test/java/org/alfresco/update/pkg/test/TgzFormatIntegrationTest.java @@ -96,17 +96,14 @@ public class TgzFormatIntegrationTest extends AbstractIntegrationTest private void handleArchiveEntries(InputStream raw, ArchiveEntryHandler handler) throws ArchiveException, IOException, CompressorException { - CompressorInputStream gzIs = null; - BufferedInputStream bis = null; - TarArchiveInputStream aris = null; - BufferedInputStream bgzIs = null; try + ( + BufferedInputStream bis = new BufferedInputStream(raw); + CompressorInputStream gzIs = new CompressorStreamFactory().createCompressorInputStream(bis); + BufferedInputStream bgzIs = new BufferedInputStream(gzIs); + TarArchiveInputStream aris = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream(bgzIs); + ) { - bis = new BufferedInputStream(raw); - gzIs = new CompressorStreamFactory().createCompressorInputStream(bis); - bgzIs = new BufferedInputStream(gzIs); - aris = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream(bgzIs); - TarArchiveEntry entry = null; boolean carryOn = true; while (carryOn && (entry = aris.getNextTarEntry()) != null) @@ -114,24 +111,5 @@ public class TgzFormatIntegrationTest extends AbstractIntegrationTest carryOn = handler.handle(entry); } } - finally - { - if (aris != null) - { - aris.close(); - } - if (bgzIs != null) - { - bgzIs.close(); - } - if (gzIs != null) - { - gzIs.close(); - } - if (bis != null) - { - bis.close(); - } - } } }