Author: fanningpj
Date: Wed Jun  5 18:51:17 2024
New Revision: 1918179

URL: http://svn.apache.org/viewvc?rev=1918179&view=rev
Log:
ZipFile deprecation warnings

Modified:
    
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/temp/AesZipFileZipEntrySource.java
    
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/openxml4j/util/TestZipSecureFile.java
    
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

Modified: 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/temp/AesZipFileZipEntrySource.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/temp/AesZipFileZipEntrySource.java?rev=1918179&r1=1918178&r2=1918179&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/temp/AesZipFileZipEntrySource.java
 (original)
+++ 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/temp/AesZipFileZipEntrySource.java
 Wed Jun  5 18:51:17 2024
@@ -64,7 +64,7 @@ public final class AesZipFileZipEntrySou
 
     private AesZipFileZipEntrySource(File tmpFile, Cipher ci) throws 
IOException {
         this.tmpFile = tmpFile;
-        this.zipFile = new ZipFile(tmpFile);
+        this.zipFile = ZipFile.builder().setFile(tmpFile).get();
         this.ci = ci;
         this.closed = false;
     }

Modified: 
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/openxml4j/util/TestZipSecureFile.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/test/java/org/apache/poi/openxml4j/util/TestZipSecureFile.java?rev=1918179&r1=1918178&r2=1918179&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/openxml4j/util/TestZipSecureFile.java
 (original)
+++ 
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/openxml4j/util/TestZipSecureFile.java
 Wed Jun  5 18:51:17 2024
@@ -34,7 +34,8 @@ class TestZipSecureFile {
         // ClassCastException in ZipFile now
         // The relevant change in the JDK is 
http://hg.openjdk.java.net/jdk/jdk10/rev/85ea7e83af30#l5.66
 
-        try (ZipFile thresholdInputStream = new 
ZipFile(XSSFTestDataSamples.getSampleFile("template.xlsx"))) {
+        try (ZipFile thresholdInputStream =
+                 
ZipFile.builder().setFile(XSSFTestDataSamples.getSampleFile("template.xlsx")).get())
 {
             try (ZipSecureFile secureFile = new 
ZipSecureFile(XSSFTestDataSamples.getSampleFile("template.xlsx"))) {
                 Enumeration<? extends ZipArchiveEntry> entries = 
thresholdInputStream.getEntries();
                 while (entries.hasMoreElements()) {

Modified: 
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1918179&r1=1918178&r2=1918179&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
 (original)
+++ 
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
 Wed Jun  5 18:51:17 2024
@@ -1887,7 +1887,7 @@ public final class TestXSSFBugs extends
     @Test
     void test54764WithSAXHelper() throws Exception {
         File testFile = XSSFTestDataSamples.getSampleFile("54764.xlsx");
-        try (ZipFile zip = new ZipFile(testFile)) {
+        try (ZipFile zip = ZipFile.builder().setFile(testFile).get()) {
             ZipArchiveEntry ze = zip.getEntry("xl/sharedStrings.xml");
             XMLReader reader = XMLHelper.newXMLReader();
             SAXParseException e = assertThrows(SAXParseException.class,
@@ -1900,7 +1900,7 @@ public final class TestXSSFBugs extends
     @Test
     void test54764WithDocumentHelper() throws Exception {
         File testFile = XSSFTestDataSamples.getSampleFile("54764.xlsx");
-        try (ZipFile zip = new ZipFile(testFile)) {
+        try (ZipFile zip = ZipFile.builder().setFile(testFile).get()) {
             ZipArchiveEntry ze = zip.getEntry("xl/sharedStrings.xml");
             SAXParseException e = assertThrows(SAXParseException.class,
                 () -> DocumentHelper.readDocument(zip.getInputStream(ze)));
@@ -3908,7 +3908,7 @@ public final class TestXSSFBugs extends
 
     private static void readByCommonsCompress(File temp_excel_poi) throws 
IOException {
         /* read by commons-compress*/
-        try (ZipFile zipFile = new ZipFile(temp_excel_poi)) {
+        try (ZipFile zipFile = 
ZipFile.builder().setFile(temp_excel_poi).get()) {
             ZipArchiveEntry entry = zipFile.getEntry("xl/workbook.xml");
             InputStream inputStream = zipFile.getInputStream(entry);
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org
For additional commands, e-mail: commits-h...@poi.apache.org

Reply via email to