svn commit: r813232 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r813232 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java

lektran
Author: lektran
Date: Thu Sep 10 05:17:14 2009
New Revision: 813232

URL: http://svn.apache.org/viewvc?rev=813232&view=rev
Log:
Fix rounding issue caused by using an intermediate double while parsing a localized String into a BigDecimal - OFBIZ-2833 reported by Miles Huang

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java?rev=813232&r1=813231&r2=813232&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java Thu Sep 10 05:17:14 2009
@@ -31,6 +31,8 @@
 import javax.servlet.http.HttpSession;
 
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.ObjectType;
 import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilMisc;
@@ -186,8 +188,8 @@
             if (!UtilValidate.isEmpty(amountStr)) {
                 BigDecimal paymentTypeAmount = BigDecimal.ZERO;
                 try {
-                    paymentTypeAmount = new BigDecimal(NumberFormat.getNumberInstance(locale).parse(amountStr).doubleValue());
-                } catch (java.text.ParseException pe) {
+                    paymentTypeAmount = (BigDecimal) ObjectType.simpleTypeConvert(amountStr, "BigDecimal", null, locale);
+                } catch (GeneralException e) {
                     request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderProblemsPaymentParsingAmount", locale));
                     return "error";
                 }