Introspector (bug)?
Hi
I notice a behavior in the Introspector.getPropertyDescriptors() that i qualify has a bug.
The problem occurs when i create a bean that as a property with a letter in lowercase followed by one in uppercase and what ever you want next. Something like xBlalala.
When using the Introspector to get the properties from the bean, it will return a property name of XBlalala for that property, and not the correct name.
I've set up an example.
My bean:
publicclass SampleBean{
private String xBigError;
private String ok;
public SampleBean(){
}
public String getXBigError(){
return xBigError;
}
publicvoid setXBigError(String bigError){
xBigError = bigError;
}
public String getOk(){
return ok;
}
publicvoid setOk(String ok){
this.ok = ok;
}
}
My Test Class:
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
publicclass Main{
publicstaticvoid main(String[] args){
SampleBean bean =new SampleBean();
try{
BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass());
PropertyDescriptor descriptors[] = beanInfo.getPropertyDescriptors();
int i=0;
PropertyDescriptor descriptor =null;
while(i<descriptors.length){
descriptor = descriptors[i++];
System.out.println("Name = "+descriptor.getName());
}
}catch (IntrospectionException e){
e.printStackTrace();
}
}
}
This will produce the following output:
Name = XBigError
Name =class
Name = ok
As you can see, property xBigError is being printed with thex in uppercase, witch is not the case in the bean property.
So, what is the problem here? Is this a bug?
Note:
I'm using JVM 1.5.0">

