This is an automated email from the ASF dual-hosted git repository.

fanningpj pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 07fa0b88e0 Update SavePasswordProtectedXlsx.java
07fa0b88e0 is described below

commit 07fa0b88e06a3598589719b777b8d96aa6080836
Author: PJ Fanning <pjfann...@users.noreply.github.com>
AuthorDate: Tue Jul 8 22:42:37 2025 +0100

    Update SavePasswordProtectedXlsx.java
---
 .../poi/examples/xssf/streaming/SavePasswordProtectedXlsx.java     | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git 
a/poi-examples/src/main/java/org/apache/poi/examples/xssf/streaming/SavePasswordProtectedXlsx.java
 
b/poi-examples/src/main/java/org/apache/poi/examples/xssf/streaming/SavePasswordProtectedXlsx.java
index aabfd5955c..769764aab1 100644
--- 
a/poi-examples/src/main/java/org/apache/poi/examples/xssf/streaming/SavePasswordProtectedXlsx.java
+++ 
b/poi-examples/src/main/java/org/apache/poi/examples/xssf/streaming/SavePasswordProtectedXlsx.java
@@ -58,8 +58,7 @@ public final class SavePasswordProtectedXlsx {
         TempFileUtils.checkTempFiles();
         String filename = args[0];
         String password = args[1];
-        SXSSFWorkbookWithCustomZipEntrySource wb = new 
SXSSFWorkbookWithCustomZipEntrySource();
-        try {
+        try (SXSSFWorkbookWithCustomZipEntrySource wb = new 
SXSSFWorkbookWithCustomZipEntrySource()) {
             for(int i = 0; i < 10; i++) {
                 SXSSFSheet sheet = wb.createSheet("Sheet" + i);
                 for(int r = 0; r < 1000; r++) {
@@ -78,10 +77,6 @@ public final class SavePasswordProtectedXlsx {
             } finally {
                 tempData.dispose();
             }
-        } finally {
-            wb.close();
-            //the dispose call is necessary to ensure temp files are removed
-            wb.dispose();
         }
         TempFileUtils.checkTempFiles();
     }


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

Reply via email to