
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
tests performed with version 1.0.2 and cvs-head
(ie revision 1.47 of BeanWrapperImpl.java in place)
tests performed with version 1.0.2 and cvs-head
(ie revision 1.47 of BeanWrapperImpl.java in place)
|
|
|
I've just made a simple bean with
setStringArray(String[] arr);
setProperties(Properties props);
in combination with
<bean...>
<property name="stringArray">
<value>one,two,three,four</value>
</property>
<property name="properties">
<value>
# inline properties file:
test.one = yes
test.two = no
</value>
</property>
</bean>
then I wrapped the configured bean in a BeanWrapperImpl and found the
following to be counter-intuitive:
1/
wrapper.getPropertyValue("stringArray[2]") returns "three" (no surprise)
BUT: wrapper.isReadable("stringArrray[2]") returns false?
2/
wrapper.getPropertyValue("properties[test.two]") returns "no" (no surprise)
BUT: wrapper.isReadable("properties[test.two]") returns false?
briefly browsing the cvs the reason for the mismatch between the two methods seems to come from how they lookup their propertyDescriptor.
line 993:
PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName);
versus lines 531-538:
public Object getPropertyValue(String propertyName) throws ...{
BeanWrapperImpl nestedBw = ...
String[] tokens = getPropertyNameTokens(getFinalPath(nestedBw, propertyName));
return nestedBw.getPropertyValue(tokens[0], tokens[1], tokens[2]);
}
protected Object getPropertyValue(String propertyName, String actualName, String key) throws BeansException {
PropertyDescriptor pd = getPropertyDescriptorInternal(actualName);
...
notice how actualName is used here and not propertyName!
it's probably fair to suspect an equal mismatch between isWritableProperty(...) and setPropertyValue(...)?
|
|
Description
|
I've just made a simple bean with
setStringArray(String[] arr);
setProperties(Properties props);
in combination with
<bean...>
<property name="stringArray">
<value>one,two,three,four</value>
</property>
<property name="properties">
<value>
# inline properties file:
test.one = yes
test.two = no
</value>
</property>
</bean>
then I wrapped the configured bean in a BeanWrapperImpl and found the
following to be counter-intuitive:
1/
wrapper.getPropertyValue("stringArray[2]") returns "three" (no surprise)
BUT: wrapper.isReadable("stringArrray[2]") returns false?
2/
wrapper.getPropertyValue("properties[test.two]") returns "no" (no surprise)
BUT: wrapper.isReadable("properties[test.two]") returns false?
briefly browsing the cvs the reason for the mismatch between the two methods seems to come from how they lookup their propertyDescriptor.
line 993:
PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName);
versus lines 531-538:
public Object getPropertyValue(String propertyName) throws ...{
BeanWrapperImpl nestedBw = ...
String[] tokens = getPropertyNameTokens(getFinalPath(nestedBw, propertyName));
return nestedBw.getPropertyValue(tokens[0], tokens[1], tokens[2]);
}
protected Object getPropertyValue(String propertyName, String actualName, String key) throws BeansException {
PropertyDescriptor pd = getPropertyDescriptorInternal(actualName);
...
notice how actualName is used here and not propertyName!
it's probably fair to suspect an equal mismatch between isWritableProperty(...) and setPropertyValue(...)?
|
Show » |
|