From 2495825c74788b0a81ce2859823a83768134978f Mon Sep 17 00:00:00 2001 From: Looly Date: Tue, 18 Jul 2023 00:02:30 +0800 Subject: [PATCH] fix code --- .../extra/compress/archiver/StreamArchiver.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hutool-extra/src/main/java/org/dromara/hutool/extra/compress/archiver/StreamArchiver.java b/hutool-extra/src/main/java/org/dromara/hutool/extra/compress/archiver/StreamArchiver.java index ad4b76ed9..6c1ca4bc3 100644 --- a/hutool-extra/src/main/java/org/dromara/hutool/extra/compress/archiver/StreamArchiver.java +++ b/hutool-extra/src/main/java/org/dromara/hutool/extra/compress/archiver/StreamArchiver.java @@ -91,22 +91,22 @@ public class StreamArchiver implements Archiver { * @param targetStream 归档输出的流 */ public StreamArchiver(final Charset charset, final String archiverName, final OutputStream targetStream) { - if("tgz".equalsIgnoreCase(archiverName) || "tar.gz".equalsIgnoreCase(archiverName)){ + if ("tgz".equalsIgnoreCase(archiverName) || "tar.gz".equalsIgnoreCase(archiverName)) { //issue#I5J33E,支持tgz格式解压 try { this.out = new TarArchiveOutputStream(new GzipCompressorOutputStream(targetStream)); } catch (final IOException e) { throw new IORuntimeException(e); } - return; + } else { + final ArchiveStreamFactory factory = new ArchiveStreamFactory(charset.name()); + try { + this.out = factory.createArchiveOutputStream(archiverName, targetStream); + } catch (final ArchiveException e) { + throw new CompressException(e); + } } - final ArchiveStreamFactory factory = new ArchiveStreamFactory(charset.name()); - try { - this.out = factory.createArchiveOutputStream(archiverName, targetStream); - } catch (final ArchiveException e) { - throw new CompressException(e); - } //特殊设置 if (this.out instanceof TarArchiveOutputStream) {