Bug 57915 - Dec2Hex returns wrong value when the cell contains long values
Summary: Dec2Hex returns wrong value when the cell contains long values
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 3.11-FINAL
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-11 11:42 UTC by artiomsevciuc
Modified: 2015-09-17 19:24 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description artiomsevciuc 2015-05-11 11:42:23 UTC
I have a column which contains a formula:
="341575"&"3004"&RIGHT(0&"1",2)
The result of the formula is : "341575300401". 
After that the result is used by the dec2hex and the result for that formula should be "4F87797531". But it is not working as needed and the result value is "7FFFFFFF".
After some investigation I found that in the line 115 from Dec2Hex class we have following call:
hex = Integer.toHexString(number1.intValue());
That is wrong, I guess that it is needed to use:
Integer.toHexString(number1.longValue());
In this case it will cover integer and long numbers.
Comment 1 Dominik Stadler 2015-09-17 19:24:03 UTC
Fixed via r1703672, thanks for the hint of how it can be fixed, this is now verified via some more unit-tests.