You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2014/08/29 18:26:36 UTC

[Bug 56899] New: DataFormatter.formatRawCellContents throws IllegalArgumentException when certain parameter is passed in.

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: dev@poi.apache.org
          Reporter: patrickyccheng@gmail.com

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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org