You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Scott Gray (JIRA)" <ji...@apache.org> on 2014/12/23 12:11:13 UTC

[jira] [Commented] (OFBIZ-5927) 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?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14256860#comment-14256860 ] 

Scott Gray commented on OFBIZ-5927:
-----------------------------------

Reposting my comments here so that it's easier to follow:
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 Jacques 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.

> Issue reported while performing Refund & Void (java.lang.ClassCastException: java.lang.String cannot be cast to java.math.BigDecimal)
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-5927
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5927
>             Project: OFBiz
>          Issue Type: Bug
>            Reporter: Prateek Ashtikar
>             Fix For: Upcoming Branch, 12.04.06, 13.07.02
>
>
> Issue reported while performing Refund & Void (java.lang.ClassCastException: java.lang.String cannot be cast to java.math.BigDecimal)
> Change needs to be done in AIMPaymentServices.java. Please look at the following small patch:-
>  
> //BigDecimal amount = (BigDecimal) request.get("x_Amount");
> String newAmt = request.get("x_Amount").toString();
> BigDecimal amount = new BigDecimal(newAmt);



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)