https://bz.apache.org/bugzilla/show_bug.cgi?id=69563
Bug ID: 69563 Summary: Creating a large Excel file leads to: ArithmeticException: integer overflow Product: POI Version: 5.3.0-FINAL Hardware: PC Status: NEW Severity: major Priority: P2 Component: XSSF Assignee: dev@poi.apache.org Reporter: b.schm...@atamya.com Target Milestone: --- Created attachment 39988 --> https://bz.apache.org/bugzilla/attachment.cgi?id=39988&action=edit Maven Java project to reproduce the issue Hi all, I ran into an issue when saving a generated workbook, where the size of the Excel document increases the range of an Integer value. OS: Microsoft Windows 11 Pro 10.0.261000 Build 26100 Java: OpenJDK 64-Bit Server VM Corretto-21.0.5.11.1 (build 21.0.5+11-LTS, mixed mode, sharing) poi: Version 5.4.0 Find attached small maven project to reproduce the issue. The sample creates an Excel workbook, with one sheet containing 10.000 columns, 30.000 rows with 1000 characters in each cell. The result output will be: Creating sheet started! 81699ms - # of rows created: 1000 175205ms - # of rows created: 2000 260553ms - # of rows created: 3000 369851ms - # of rows created: 4000 471370ms - # of rows created: 5000 790017ms - # of rows created: 6000 1070938ms - # of rows created: 7000 1268658ms - # of rows created: 8000 1466263ms - # of rows created: 9000 1669292ms - # of rows created: 10000 1853144ms - # of rows created: 11000 2067372ms - # of rows created: 12000 2299564ms - # of rows created: 13000 2726305ms - # of rows created: 14000 3157645ms - # of rows created: 15000 3620784ms - # of rows created: 16000 4071813ms - # of rows created: 17000 4497430ms - # of rows created: 18000 4902578ms - # of rows created: 19000 5115690ms - # of rows created: 20000 5529019ms - # of rows created: 21000 6092334ms - # of rows created: 22000 6689742ms - # of rows created: 23000 7114781ms - # of rows created: 24000 7336126ms - # of rows created: 25000 7531975ms - # of rows created: 26000 7743192ms - # of rows created: 27000 7941344ms - # of rows created: 28000 8182156ms - # of rows created: 29000 8382096ms - # of rows created: 30000 8382097ms - Start writing Excel file Exception in thread "main" java.lang.ArithmeticException: integer overflow at java.base/java.lang.Math.toIntExact(Math.java:1135) at org.apache.poi.xssf.streaming.OpcOutputStream.closeEntry(OpcOutputStream.java:87) at org.apache.poi.xssf.streaming.OpcOutputStream.finish(OpcOutputStream.java:107) at org.apache.poi.xssf.streaming.OpcZipArchiveOutputStream.finish(OpcZipArchiveOutputStream.java:52) at org.apache.poi.xssf.streaming.SXSSFWorkbook.injectData(SXSSFWorkbook.java:454) at org.apache.poi.xssf.streaming.SXSSFWorkbook.write(SXSSFWorkbook.java:964) at com.example.App.main(App.java:47) Process finished with exit code 1 The issue is, that in org.apache.poi.xssf.streaming.Zip64Impl.Entry the type of compressed size is an int, but should be of type long. This leads to the failure. So please fix this issue or suggest a workaround, as it is not possible to write large Excel sheets that are compliant to the Excel specification. Best regards, Bernd -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org