commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 27633] New: - java.lang.IllegalArgumentException in BeanUtils.copyProperties when property types don't match
Date Fri, 12 Mar 2004 17:40:36 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27633>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27633

java.lang.IllegalArgumentException in BeanUtils.copyProperties when property types don't match

           Summary: java.lang.IllegalArgumentException in
                    BeanUtils.copyProperties when property types don't match
           Product: Commons
           Version: 1.6 Final
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: matthew.sgarlata@verizon.net


(this report applies to BeanUtils 1.6.1)

When using BeanUtils.copyProperties, if the source and destination beans have 
properties of the same name but with different types, the system throws a 
java.lang.IllegalArgumentException.  This is NOT recorded as a thrown exception 
in the BeanUtils.copyProperties API.  I think that this only happens if a 
Converter is not registered for the object.

I personally think throwing an exception is a bug and that copyProperties 
should just fail silently (i.e. - don't populate that property of the 
destination bean).  However, if an exception is deemed most appropriate by the 
committers, I think it should be added to the contract of the method.  If a 
committer could weigh-in on this issue and decide which behavior is most 
appropriate, I can submit the needed patch.

Here is the stack trace I got:

java.lang.IllegalArgumentException: argument type mismatch
        at java.lang.reflect.Method.invoke(Native Method)
        at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty
(PropertyUtils.java:1789)
        at org.apache.commons.beanutils.BeanUtils.copyProperty
(BeanUtils.java:450)
        at org.apache.commons.beanutils.BeanUtils.copyProperties
(BeanUtils.java:264)
        at com.bah.jroc.ws.CapabilityServiceSoapBindingImpl.getCapability
(CapabilityServiceSoapBindingImpl.java:58)
        at com.bah.jroc.ws.CapabilityServiceSoapBindingSkeleton.getCapability
(CapabilityServiceSoapBindingSkeleton.java:55)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.apache.axis.providers.java.RPCProvider.invokeMethod
(RPCProvider.java:397)
        at org.apache.axis.providers.java.RPCProvider.processMessage
(RPCProvider.java:304)
        at org.apache.axis.providers.java.JavaProvider.invoke
(JavaProvider.java:329)
        at org.apache.axis.strategies.InvocationStrategy.visit
(InvocationStrategy.java:71)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:157)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:122)
        at org.apache.axis.handlers.soap.SOAPService.invoke
(SOAPService.java:517)
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:324)

... etc.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message