From 41ccb6fe3009f12c28fe51bcb4b4269687d50ee8 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Wed, 5 Jun 2024 16:45:46 +0000 Subject: [PATCH] getNextZipEntry deprecation warnings git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918177 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/poifs/crypt/temp/AesZipFileZipEntrySource.java | 2 +- .../org/apache/poi/poifs/crypt/tests/TestDecryptor.java | 6 +++--- .../org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java | 2 +- .../apache/poi/poifs/crypt/standard/StandardDecryptor.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/temp/AesZipFileZipEntrySource.java b/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/temp/AesZipFileZipEntrySource.java index b8e3bcba9d..4384f0f6dc 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/temp/AesZipFileZipEntrySource.java +++ b/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/temp/AesZipFileZipEntrySource.java @@ -135,7 +135,7 @@ public final class AesZipFileZipEntrySource implements ZipEntrySource { ZipArchiveOutputStream zos = new ZipArchiveOutputStream(fos)) { ZipArchiveEntry ze; - while ((ze = zis.getNextZipEntry()) != null) { + while ((ze = zis.getNextEntry()) != null) { // the cipher output stream pads the data, therefore we can't reuse the ZipEntry with set sizes // as those will be validated upon close() ZipArchiveEntry zeNew = new ZipArchiveEntry(ze.getName()); diff --git a/poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/tests/TestDecryptor.java b/poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/tests/TestDecryptor.java index c6d10af2b7..2a48f12a17 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/tests/TestDecryptor.java +++ b/poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/tests/TestDecryptor.java @@ -84,7 +84,7 @@ class TestDecryptor { try (ZipArchiveInputStream zin = new ZipArchiveInputStream(d.getDataStream(root))) { while (true) { - ZipArchiveEntry entry = zin.getNextZipEntry(); + ZipArchiveEntry entry = zin.getNextEntry(); if (entry == null) { break; } @@ -120,7 +120,7 @@ class TestDecryptor { ZipArchiveInputStream zin = new ZipArchiveInputStream(new ByteArrayInputStream(buf)); while (true) { - ZipArchiveEntry entry = zin.getNextZipEntry(); + ZipArchiveEntry entry = zin.getNextEntry(); if (entry==null) { break; } @@ -146,7 +146,7 @@ class TestDecryptor { try (final ZipArchiveInputStream zis = new ZipArchiveInputStream(d.getDataStream(fs))) { int[] sizes = { 3711, 1155, 445, 9376, 450, 588, 1337, 2593, 304, 7910 }; for (int size : sizes) { - final ZipArchiveEntry ze = zis.getNextZipEntry(); + final ZipArchiveEntry ze = zis.getNextEntry(); assertNotNull(ze); IOUtils.copy(zis, bos); assertEquals(size, bos.size()); 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 35460bf6de..744887ff40 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 @@ -1496,7 +1496,7 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook { int count = 0; try (ZipArchiveInputStream zis = new ZipArchiveInputStream(Files.newInputStream(tempFile.toPath()))) { ZipArchiveEntry entry; - while ((entry = zis.getNextZipEntry()) != null) { + while ((entry = zis.getNextEntry()) != null) { // Since POI 5.2.5, you can stop XSSFWorkbook closing the InputStream by using this new constructor XSSFWorkbook wb = new XSSFWorkbook(zis, false); assertNotNull(wb); diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java b/poi/src/main/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java index eb82aedaee..5ffe29d2bc 100644 --- a/poi/src/main/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java +++ b/poi/src/main/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java @@ -29,6 +29,7 @@ import javax.crypto.CipherInputStream; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; +import org.apache.commons.io.input.BoundedInputStream; import org.apache.poi.EncryptedDocumentException; import org.apache.poi.poifs.crypt.ChainingMode; import org.apache.poi.poifs.crypt.CryptoFunctions; @@ -38,7 +39,6 @@ import org.apache.poi.poifs.crypt.EncryptionVerifier; import org.apache.poi.poifs.crypt.HashAlgorithm; import org.apache.poi.poifs.filesystem.DirectoryNode; import org.apache.poi.poifs.filesystem.DocumentInputStream; -import org.apache.commons.io.input.BoundedInputStream; import org.apache.poi.util.LittleEndian; /** -- 2.39.5