Bug 64508 - java.lang.NumberFormatException: For input string: ""
Summary: java.lang.NumberFormatException: For input string: ""
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 4.1.2-FINAL
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2020-06-09 16:04 UTC by Kovi
Modified: 2020-06-09 16:06 UTC (History)
0 users

Test project (5.66 KB, application/x-7z-compressed)
2020-06-09 16:06 UTC, Kovi

Note You need to log in before you can comment on or make changes to this bug.
Description Kovi 2020-06-09 16:04:51 UTC
I'm using POI 4.1.2 on Ubuntu 20.04. The same problem occurs on POI 3.10.1, 3.17. These are the three version I tried.
When I try to run the attached program I get:
java.lang.NumberFormatException: For input string: ""
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Integer.parseInt(Integer.java:592)
        at java.lang.Integer.parseInt(Integer.java:615)
        at org.apache.poi.xssf.usermodel.XSSFCell.getRichStringCellValue(XSSFCell.java:377)
        at org.apache.poi.xssf.usermodel.XSSFCell.getStringCellValue(XSSFCell.java:342)
        at com.kovi.poitest.Test.main(Test.java:26)

What I could see is that the problem occurs in org.apache.poi.xssf.usermodel.getRichStringCellValue() where _cell.isSetV() returns true, but in fact should be false. I think this is wrong because isSetV() only checks if the element v is present. In example Excel file E2 is:
<c r="E2" s="4" t="s"><v/>
so there is a v element, but it is empty.
Test project is Maven based and you can run it from build folder: java -cp "poitest-1.0.0.jar:lib/*" com.kovi.poitest.Test TEST.xlsx
Comment 1 Kovi 2020-06-09 16:06:22 UTC
Created attachment 37298 [details]
Test project