From 386b2fcc7898533ef047d9b52e86d370d2cc9ee2 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 16 Nov 2023 22:15:24 +0000 Subject: [PATCH] try to fix compile issues due to commons-compress upgrade git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913865 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/xssf/streaming/OpcZipArchiveOutputStream.java | 5 ++--- .../marshallers/TestZipPackagePropertiesMarshaller.java | 4 ++-- .../java/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/OpcZipArchiveOutputStream.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/OpcZipArchiveOutputStream.java index 573d580e37..463fb8ec55 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/OpcZipArchiveOutputStream.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/OpcZipArchiveOutputStream.java @@ -17,7 +17,7 @@ package org.apache.poi.xssf.streaming; -import org.apache.commons.compress.archivers.ArchiveEntry; +import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; import java.io.IOException; @@ -36,9 +36,8 @@ class OpcZipArchiveOutputStream extends ZipArchiveOutputStream { out.setLevel(level); } - @Override - public void putArchiveEntry(ArchiveEntry archiveEntry) throws IOException { + public void putArchiveEntry(ZipArchiveEntry archiveEntry) throws IOException { out.putNextEntry(archiveEntry.getName()); } diff --git a/poi-ooxml/src/test/java/org/apache/poi/openxml4j/opc/internal/marshallers/TestZipPackagePropertiesMarshaller.java b/poi-ooxml/src/test/java/org/apache/poi/openxml4j/opc/internal/marshallers/TestZipPackagePropertiesMarshaller.java index 09ebcb20c2..df1bb8bde1 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/openxml4j/opc/internal/marshallers/TestZipPackagePropertiesMarshaller.java +++ b/poi-ooxml/src/test/java/org/apache/poi/openxml4j/opc/internal/marshallers/TestZipPackagePropertiesMarshaller.java @@ -24,7 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.io.OutputStream; -import org.apache.commons.compress.archivers.ArchiveEntry; +import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; import org.apache.commons.io.output.NullOutputStream; import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream; @@ -63,7 +63,7 @@ class TestZipPackagePropertiesMarshaller { void ioException() { ZipArchiveOutputStream zos = new ZipArchiveOutputStream(UnsynchronizedByteArrayOutputStream.builder().get()) { @Override - public void putArchiveEntry(final ArchiveEntry archiveEntry) throws IOException { + public void putArchiveEntry(final ZipArchiveEntry archiveEntry) throws IOException { throw new IOException("TestException"); } }; diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java index 475cc73c95..35460bf6de 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java @@ -17,7 +17,6 @@ package org.apache.poi.xssf.usermodel; -import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; @@ -1480,13 +1479,13 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook { try (ZipArchiveOutputStream zos = new ZipArchiveOutputStream(tempFile)) { File f1 = getSampleFile("github-321.xlsx"); File f2 = getSampleFile("48495.xlsx"); - ArchiveEntry e1 = zos.createArchiveEntry(f1, "github-321.xlsx"); + ZipArchiveEntry e1 = zos.createArchiveEntry(f1, "github-321.xlsx"); zos.putArchiveEntry(e1); try (InputStream s = Files.newInputStream(f1.toPath())) { IOUtils.copy(s, zos); } zos.closeArchiveEntry(); - ArchiveEntry e2 = zos.createArchiveEntry(f2, "48495.xlsx"); + ZipArchiveEntry e2 = zos.createArchiveEntry(f2, "48495.xlsx"); zos.putArchiveEntry(e2); try (InputStream s = Files.newInputStream(f2.toPath())) { IOUtils.copy(s, zos); -- 2.39.5