You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2009/02/20 23:25:02 UTC
[jira] Commented: (BEANUTILS-339) BeanUtilsBean.setProperty throws
IllegalArgumentException if value is null
[ https://issues.apache.org/jira/browse/BEANUTILS-339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675491#action_12675491 ]
Niall Pemberton commented on BEANUTILS-339:
-------------------------------------------
Seems to me like its doing exactly what the API says -looking at the source for BeanUtils 1.8.0
{code}
if ((value instanceof String) || (value == null)) {
newValue = getConvertUtils().convert((String) value, type);
{code}
http://commons.apache.org/beanutils/xref/org/apache/commons/beanutils/BeanUtilsBean.html#1002
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
http://commons.apache.org/beanutils/xref/org/apache/commons/beanutils/ConvertUtilsBean.html#446
> BeanUtilsBean.setProperty throws IllegalArgumentException if value is null
> --------------------------------------------------------------------------
>
> Key: BEANUTILS-339
> URL: https://issues.apache.org/jira/browse/BEANUTILS-339
> 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.