ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doo...@apache.org
Subject svn commit: r917364 - in /ofbiz/trunk/framework/base/src/org/ofbiz/base: conversion/NumberConverters.java util/test/ObjectTypeTests.java
Date Mon, 01 Mar 2010 03:12:53 GMT
Author: doogie
Date: Mon Mar  1 03:12:53 2010
New Revision: 917364

URL: http://svn.apache.org/viewvc?rev=917364&view=rev
Log:
BUG FIX: In integer/long to BigDecimal, don't convert the number to a
double first.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/NumberConverters.java
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/ObjectTypeTests.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/NumberConverters.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/NumberConverters.java?rev=917364&r1=917363&r2=917364&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/NumberConverters.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/NumberConverters.java Mon Mar
 1 03:12:53 2010
@@ -473,7 +473,7 @@
         }
 
         public BigDecimal convert(Integer obj) throws ConversionException {
-            return BigDecimal.valueOf(obj.doubleValue());
+            return BigDecimal.valueOf(obj.intValue());
         }
     }
 
@@ -572,7 +572,7 @@
         }
 
         public BigDecimal convert(Long obj) throws ConversionException {
-            return BigDecimal.valueOf(obj.doubleValue());
+            return BigDecimal.valueOf(obj.longValue());
         }
     }
 

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/ObjectTypeTests.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/ObjectTypeTests.java?rev=917364&r1=917363&r2=917364&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/ObjectTypeTests.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/ObjectTypeTests.java Mon Mar 
1 03:12:53 2010
@@ -274,7 +274,7 @@
 
     public void testLong() throws GeneralException {
         simpleTypeConvertTestSingleMulti("Long->String", Long.valueOf("1234567"), new
String[] {"String", "java.lang.String"}, null, localeData, "1,234,567");
-        //BUG simpleTypeConvertTestSingleMulti("Long->BigDecimal", lng, new String[] {"BigDecimal",
"java.math.BigDecimal"}, new BigDecimal("781"));
+        simpleTypeConvertTestSingleMulti("Long->BigDecimal", lng, new String[] {"BigDecimal",
"java.math.BigDecimal"}, new BigDecimal("781"));
         simpleTypeConvertTestSingleMulti("Long->Double", lng, new String[] {"Double",
"java.lang.Double"}, new Double("781"));
         simpleTypeConvertTestSingleMulti("Long->Float", lng, new String[] {"Float", "java.lang.Float"},
new Float("781"));
         simpleTypeConvertTestSingleMulti("Long->Long", lng, new String[] {"Long", "java.lang.Long"},
new Long("781"));
@@ -289,7 +289,7 @@
 
     public void testInteger() throws GeneralException {
         simpleTypeConvertTestSingleMulti("Integer->String", Integer.valueOf("1234567"),
new String[] {"String", "java.lang.String"}, null, localeData, "1,234,567");
-        //BUG simpleTypeConvertTestSingleMulti("Integer->BigDecimal", intg, new String[]
{"BigDecimal", "java.math.BigDecimal"}, new BigDecimal("781"));
+        simpleTypeConvertTestSingleMulti("Integer->BigDecimal", intg, new String[] {"BigDecimal",
"java.math.BigDecimal"}, new BigDecimal("781"));
         simpleTypeConvertTestSingleMulti("Integer->Double", intg, new String[] {"Double",
"java.lang.Double"}, new Double("781"));
         simpleTypeConvertTestSingleMulti("Integer->Float", intg, new String[] {"Float",
"java.lang.Float"}, new Float("781"));
         simpleTypeConvertTestSingleMulti("Integer->Long", intg, new String[] {"Long",
"java.lang.Long"}, lng);



Mime
View raw message