https://issues.apache.org/bugzilla/show_bug.cgi?id=55419

            Bug ID: 55419
           Summary: New fraction formatting throws SimpleFractionException
                    due to incorrect MAX_VALUE in overflow
           Product: POI
           Version: 3.10-dev
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
          Assignee: [email protected]
          Reporter: [email protected]

A SimpleFractionException is being thrown on what should be a very easy case to
format: 
Format 123456.6 as a fraction with single digit numerator and denominator.
It is expected to format as 123456 3/5

Instead, I get:

org.apache.poi.ss.usermodel.FractionFormat$SimpleFractionException: Greater
than overflow in loop 0.600000, 20615843021, 34359738368
    at
org.apache.poi.ss.usermodel.FractionFormat.calcFractionMaxDenom(FractionFormat.java:217)
    at
org.apache.poi.ss.usermodel.FractionFormat.format(FractionFormat.java:133)
    at
org.apache.poi.ss.usermodel.FractionFormat.format(FractionFormat.java:172)


When looking at the code in FractionFormat, method calcFractionMaxDenom, I see
that it is setting an overflow variable, of type long, to Integer.MAX_VALUE.

In my test area, when I set the value to Long.MAX_VALUE, the function correctly
returns the data I expect.

-- 
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]

Reply via email to