I know it looks like this makes sense at first glance but sometimes it's
useful to look at the history of changes.  It should be clear that
something is amiss because of the useless try/catch block directly below
your change.  It points out that perhaps this code previously did something
similar to what you're trying to do here.

So I have a look and we find this commit:
http://svn.apache.org/viewvc?view=revision&revision=1303329

Maybe these changes warrant further investigation instead of committers
switching it back and forth every few years.

Because neither you nor Hans have bothered to fully review the issue,
you've both missed that the problem is that ccRelease(...) is passing a
BigDecimal into the x_Amount map value while every other method is putting
a String on that value.  The getXAmount method need to be restored properly
back to what it was before Hans' commit (i.e. actually use the try/catch
block when creating the BigDecimal) and ccRelease(...) needs to convert the
BigDecimal to a String before putting it in the map.

Regards
Scott

On Tue, Dec 23, 2014 at 10:51 PM, <jler...@apache.org> wrote:

> Author: jleroux
> Date: Tue Dec 23 09:51:56 2014
> New Revision: 1647522
>
> URL: http://svn.apache.org/r1647522
> Log:
> A patch from Prateek Ashtikar for "Issue reported while performing Refund
> & Void (java.lang.ClassCastException: java.lang.String cannot be cast to
> java.math.BigDecimal)" https://issues.apache.org/jira/browse/OFBIZ-5927
>
> Change committed in AIMPaymentServices.java.
>
> Modified:
>
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
>
> Modified:
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java?rev=1647522&r1=1647521&r2=1647522&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
> (original)
> +++
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
> Tue Dec 23 09:51:56 2014
> @@ -824,7 +824,8 @@ public class AIMPaymentServices {
>      private static BigDecimal getXAmount(Map<String, Object> request) {
>          BigDecimal amt = BigDecimal.ZERO;
>          if (request.get("x_Amount") != null) {
> -            BigDecimal amount = (BigDecimal) request.get("x_Amount");
> +            String newAmt = request.get("x_Amount").toString();
> +            BigDecimal amount = new BigDecimal(newAmt);
>              try {
>                  amt = amount;
>              } catch (NumberFormatException e) {
>
>
>

Reply via email to