Saturday, June 7, 2003 01:25 AM
Well, first of all, String is not a primitive type, but is an Object.
Plus, copyProperties() does not work with primitives. It only works with Objects.
The org.apache.commons.beanutils.BeanUtils.copyProperties javadoc states:
[...] Copy property values from the origin bean to the destination bean for all cases where the property names are the same. For each property, a conversion is attempted as necessary. [...]
You are saying that you're getting an exception. Which one?
The method, as explained in the javadoc, does throw 4 different exception depending on the type of error. This helps the developer to solve the problem.
You have an exception if the caller does not have access to the property accessor method, two if the destination or origin argument is null, one if the property accessor method throws an exception (and in that case the exception does contain a method to get the target exception).
Once the problem is discovered, then it is possible to find a possible solution.