commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton (JIRA)" <>
Subject [jira] Commented: (BEANUTILS-339) BeanUtilsBean.setProperty throws IllegalArgumentException if value is null
Date Fri, 20 Feb 2009 22:25:02 GMT


Niall Pemberton commented on BEANUTILS-339:

Seems to me like its doing exactly what the API says -looking at the source for BeanUtils

            if ((value instanceof String) || (value == null)) {
                 newValue = getConvertUtils().convert((String) value, type);

Seems to me the problem is probably that you don't have a converter registered for java.util.Comparator
or that you should configure the String converter to return null

> BeanUtilsBean.setProperty throws IllegalArgumentException if value is null
> --------------------------------------------------------------------------
>                 Key: BEANUTILS-339
>                 URL:
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.8.0-BETA
>            Reporter: Alan Escreet
>            Priority: Blocker
>             Fix For: 1.8.0-BETA
> Line 1003-1004 conflicts with API doc: "If null is passed into a property expecting a
primitive value, then this will be converted as if it were a null string."
> Line 1003 only tests if the value is null and 1004 explicitly casts to a String. If a
bean has a field of any other type, i.e. java.util.Comparator, then this fails with:
> {{java.lang.IllegalArgumentException: Cannot invoke <myBean>.setComparator on bean
class 'class <myBean>' - argument type mismatch - had objects of type "java.lang.String"
but expected signature "java.util.Comparator"}}

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message