This is an automated email from the ASF dual-hosted git repository. centic pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/poi.git
commit 42193c57e41ef2b83a896a54274df7cf4e9331d6 Author: Dominik Stadler <[email protected]> AuthorDate: Sat Aug 2 13:39:33 2025 +0200 Try to verify handling of deeply nested xlsx --- .../org/apache/poi/integration/TestXLSX2CSV.java | 21 +++++++++++++++++++++ test-data/spreadsheet/deep-data.xlsx | Bin 0 -> 964835 bytes test-data/spreadsheet/stress.xls | Bin 73216 -> 73216 bytes 3 files changed, 21 insertions(+) diff --git a/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java b/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java index 912890d458..91a64f4601 100644 --- a/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java +++ b/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java @@ -18,9 +18,11 @@ package org.apache.poi.integration; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import java.io.IOException; import java.io.PrintStream; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; @@ -197,4 +199,23 @@ public class TestXLSX2CSV { return result.toString(); } } + + @Test + public void testDeepFile() throws Exception { + // returns with some System.err + try { + assertThrows(IOException.class, + () -> XLSX2CSV.main(new String[] { XSSFTestDataSamples.getSampleFile("deep-data.xlsx").getAbsolutePath() })); + } catch (Throwable e) { + // restore output-streams again to get proper error output + System.setErr(err); + + throw e; + } + + String output = errorBytes.toString(StandardCharsets.UTF_8); + assertFalse(output.contains("Not found"), "Had: " + output); + + System.out.println(output); + } } diff --git a/test-data/spreadsheet/deep-data.xlsx b/test-data/spreadsheet/deep-data.xlsx new file mode 100644 index 0000000000..cb2a9c84f2 Binary files /dev/null and b/test-data/spreadsheet/deep-data.xlsx differ diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls index f000204abf..ba71dc4ebe 100644 Binary files a/test-data/spreadsheet/stress.xls and b/test-data/spreadsheet/stress.xls differ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
