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
This commit is contained in:
PJ Fanning 2023-11-16 22:15:24 +00:00
parent e9710ead93
commit 386b2fcc78
3 changed files with 6 additions and 8 deletions

View File

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

View File

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

View File

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