Uploaded image for project: 'Commons BeanUtils'
  1. Commons BeanUtils
  2. BEANUTILS-17

[beanutils] IllegalArgumentException in BeanUtils.copyProperties when property types don't match

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6
    • 1.8.0
    • None
    • None
    • Operating System: other
      Platform: All

    • 27633

    Description

      (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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            matthew.sgarlata@verizon.net Matthew Sgarlata
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: