You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Howard, Dan" <Da...@Eclipsys.com> on 2009/04/09 00:24:29 UTC

ClassCastException with BeanComparator

Hello all, 

 

I'm getting an exception in code 

 

java.lang.ClassCastException: java.lang.ClassCastException:
java.lang.String cannot be cast to java.math.BigDecimal

        at
org.apache.commons.beanutils.BeanComparator.compare(BeanComparator.java:
155)

 

I'm using BeanUtils 1.7.0 but when I download the source I see that this
class is not there anymore.  I can't see the source to see what's the
real issue.

 

What I have is a bean where some properties are Objects because I
determine the type dynamically (for custom fields). I read them from the
DB so in this case it's a Numeric field which comes back as BigDecimal.
The field is displayed on a web page to the user and they edit and
submit. At this point the bean property will be a String since It's
passed up through struts (Struts 1.2.9).

 

Any ideas how to solve?

 

Thanks!