doubleValue() may be inaccurate for Long
----------------------------------------

                 Key: TUSCANY-836
                 URL: http://issues.apache.org/jira/browse/TUSCANY-836
             Project: Tuscany
          Issue Type: Bug
          Components: Java SDO Implementation
    Affects Versions: Java-Mx
         Environment: Sun JRE 1.5.0_07-b03
            Reporter: Yang ZHONG


    assertSame(DataObjectUtil.getBigDecimal(new 
Long(Long.MAX_VALUE)).longValue(), Long.MAX_VALUE);
complains
    junit.framework.AssertionFailedError: expected same:<-9223372036854775808> 
was not:<9223372036854775807>

Potential fix:
    if (value instanceof Long)
    {
      return new BigDecimal(((Long)value).longValue());
    }
before
    if (value instanceof Number)
    {
      return new BigDecimal(((Number)value).doubleValue());
    }

Thanks to Marcelo Palladino.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to