Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)

111926 adavis: Merged 5.0.N (5.0.3) to WOLF-6 (WOLF.0.0)
      111638: UTF-242: refactored archive unpacking code to use try-with-resources for brevity.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/services/full-installer/branches/5.1.1@123920 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2016-03-15 10:55:54 +00:00
parent 6f9893799c
commit ff40bce891

View File

@@ -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();
}
}
}
}