Bug 63842 - FractionFormat casts whole part of the value into 'int'
Summary: FractionFormat casts whole part of the value into 'int'
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 4.1.0-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2019-10-14 08:03 UTC by maksut
Modified: 2019-10-14 12:32 UTC (History)
0 users

A possible quick fix for the issue (5.56 KB, patch)
2019-10-14 08:03 UTC, maksut
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description maksut 2019-10-14 08:03:41 UTC
Created attachment 36825 [details]
A possible quick fix for the issue

If the whole part of the value is too big or too small to fit in an 'int' then FractionFormat loses data because of 'int' casting.

To reproduce;
- Set a cell value to a big number like '10100136259702'. And use a fraction format for the cell.
- Format the cell value with DataFormatter (which uses FractionFormat).

Expected: value as it's displayed in excel.
Actual: '2147483647' (INT_MAX).
Comment 1 PJ Fanning 2019-10-14 08:23:26 UTC
patch applied with r1868425 - may need to revisit after the upcoming v4.1.1 release
Comment 2 PJ Fanning 2019-10-14 12:32:27 UTC
At this stage, it looks like 4.1.1 will be released without this fix. It should appear in 4.1.2.