You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Pawel Kozlowski (JIRA)" <ji...@apache.org> on 2010/02/11 15:22:28 UTC
[jira] Commented: (BEANUTILS-106) Problem with
BeanUtils.setProperty when the name of property of Bean have on second
caracter a uppercase
[ https://issues.apache.org/jira/browse/BEANUTILS-106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12832495#action_12832495 ]
Pawel Kozlowski commented on BEANUTILS-106:
-------------------------------------------
I believe that this issue could (and should) be fixed. The standard JDK provides methods for dealing with property names as described in this issue. Please have a look at: http://java.sun.com/j2se/1.4.2/docs/api/java/beans/Introspector.html#decapitalize%28java.lang.String%29
I believe that the problem is in the and more specifically in this part of the code:
PropertyDescriptor[] descriptors = getPropertyDescriptors(bean);
if (descriptors != null) {
for (int i = 0; i < descriptors.length; i++) {
if (name.equals(descriptors[i].getName())) {
return (descriptors[i]);
}
}
}
That should be changed to use decapitalize method, so:
name.equals(Introspector.html#decapitalize(descriptors[i].getName()))
Could you please re-consider opening / fixing this issue?
> Problem with BeanUtils.setProperty when the name of property of Bean have on second caracter a uppercase
> --------------------------------------------------------------------------------------------------------
>
> Key: BEANUTILS-106
> URL: https://issues.apache.org/jira/browse/BEANUTILS-106
> Project: Commons BeanUtils
> Issue Type: Bug
> Affects Versions: Nightly Builds
> Environment: Operating System: Windows XP
> Platform: PC
> Reporter: Dutrieux Olivier
> Priority: Blocker
>
> I have a bean with one property hEmail. I fact the Bean have these methods
> setHEmail(String hEmail) and getHEmail().
> There is a problem with these instruction :
> BeanUtils.setProperty(bean, "hEmail", new String("dupond"));
> or
> BeanUtils.copyProperty(bean, "hEmail", new String("dupond"));
> The property hEmail does not contain "dupond" after this instruction.
> If I check my property name with the command :
> String name = new
> PropertyUtilsBean().getPropertyDescriptors(mainBean)[0].getName();
> The result of name is HEmail (not hEmail)
> Info : if I change the property of bean hEmail by hemail there is also no problem.
> I fact I think there is a problem with the command
> PropertyUtilsBean().getPropertyDescriptors(mainBean), that don't return
> correctly the property of the bean when the name of property have on second
> character a uppercase.
> Version JVM : 1.4.2-b18 or 1.4.1_02-b06
> Version BeanUtils (Nightly Builds) v1.6.1 2003-10-01
> Best regards
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.