| Author |
java.lang.ClassCastException: java.lang.String cannot be cast to java.math.BigDecimal
|
Kanwardeep Singh
Greenhorn
Joined: Dec 06, 2012
Posts: 10
|
|
I am getting a BigDecimal Through a getter method and putting that into a Map<String,Object[]>
that bigdecimal is part of the Object[] Array.
but i am getting this ClassCastException.
While fetching that array value and setting into Object[]
Map<String,Object[]> map=HashMap<String,Object[]>();
map.put("1",new Object[] { l_obj.getValueOfBigDecimal()})
I am getting this Execption.
Can anyBody help?
|
 |
James Boswell
Ranch Hand
Joined: Nov 09, 2011
Posts: 657
|
|
|
Can you show the full stacktrace please? That will give us a better idea as to where the problem is occurring. I suspect there is an issue with your get method.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
|
Are you putting the BigDecimal object into the Object[] or into the Map?
|
 |
Kanwardeep Singh
Greenhorn
Joined: Dec 06, 2012
Posts: 10
|
|
|
yes..i am putting BigDecimal into Object[] ar. and Object[] ar i am putting into Map.
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
|
But the exception would be thrown when you are getting the data out of the map, so why aren't we seeing that code? James Boswell asked you to post it quite a long time ago.
|
 |
 |
|
|
subject: java.lang.ClassCastException: java.lang.String cannot be cast to java.math.BigDecimal
|
|
|