https://issues.apache.org/bugzilla/show_bug.cgi?id=56899
Bug ID: 56899
Summary: DataFormatter.formatRawCellContents throws
IllegalArgumentException when certain parameter is
passed in.
Product: POI
Version: 3.10-FINAL
Hardware: PC
OS: Mac OS X 10.4
Status: NEW
Severity: minor
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Apologies for not having the actual XLSX file, so the parameter values are made
up to reproduce the issue, and might not reflect reality.
DataFormatter formatter = new DataFormatter();
// the following will throw IllegalArgumentException
formatter.formatRawCellContents(formatter, "42", 0xe, "hello", false);
Here is what I found:
The index is one of the internal date format, DateUtil.isInternalDateFormat()
returns true. Because if that, the formatString is not validate until it is
passed to the constructor of ExcelStyleDateFormatter.
Because the formatString is invalid, when constructing ExcelStyleDateFormatter,
the SimpleDateFormat's constructor will throw run time exception, and inside
DateFormatter.createDateFormat() returns getDefaultFormat() which is a
DecimalFormat.
Because we are trying to format a Date object using a DecimalFormat, an
IllegalArgumentException is throw.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]