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

[beanutils] provide better error message for "argument type mismatch"

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.8.0
    • Bean / Property Utils
    • None
    • Operating System: All
      Platform: Other

    • 38165

    Description

      In <<Object org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(Method
      method, Object bean, Object[] values) throws IllegalAccessException,
      InvocationTargetException>>
      the throw block should rather be:

      throw new IllegalArgumentException(
      "Cannot invoke " + method.getDeclaringClass().getName() + "."
      + method.getName() + " - " + e.getMessage() + " - found " +
      bean.getClass().getName()+ " but expected "
      + (values[0]).getClass().getName());

      see also In <<Object org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(Method
      method, Object bean, Object[] values) throws IllegalAccessException,
      InvocationTargetException>>
      the throw block should rather be:

      throw new IllegalArgumentException(
      "Cannot invoke " + method.getDeclaringClass().getName() + "."
      + method.getName() + " - " + e.getMessage() + " - found " +
      bean.getClass().getName()+ " but expected "
      + (values[0]).getClass().getName());

      see also Bug 38163 for the context where this would have helped a lot. for the context where this would have helped a lot.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ralfhauser Ralf Hauser
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: