bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22907] Bean Introspector should check the bean class of a


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22907] Bean Introspector should check the bean class of an explicit BeanInfo
Date: 16 Oct 2005 01:27:38 -0000

In classpath's implementation of the java.beans.Introspector class,
getBeanInfo() attempts to locate explicit BeanInfo classes based on the
introspected class's classloader, then by truncating off the class's package
and looking in the Introspector's beanInfoSearchPath.  Any BeanInfos found by
the second method are immediately returned, which can be dangerous.  Any
located BeanInfos found by truncating the package name should be checked via
the BeanInfo.getBeanDescriptor().getBeanClass() method to make sure the classes
match up.

Here's the situation I'm running into. I'm trying to get the Eclipse Visual
Editor (http://www.eclipse.org/vep/) up and running for SWT development using
GCJ as the target VM.  VE supports development of both AWT/Swing and SWT, and
provides BeanInfo for most of the classes in both widget sets.  The BeanInfos
are defined in separate packages, and included in the Introspector's
beanInfoSearchPath.  A class called Canvas is defined in both AWT and SWT
(java.awt.Canvas and org.eclipse.swt.widgets.Canvas).  When Introspecting on
the org.eclipse.swt.widgets.Canvas class, the BeanInfo for AWT is being
returned, as the AWT/Swing BeanInfos are first on the beanInfoSearchPath.  This
problem could be avoided by calling the found CanvasBeanInfo's descriptor's
getBeanClass() method against org.eclipse.swt.widgets.Canvas.class, which would
fail on the AWT BeanInfo and pass on the SWT version.

To be specific, the check against getBeanClass() should be added to
java.beans.Introspector.reallyFindExplicitBeanInfo() line 542.  This would
probably be sufficient:
if (beaninfo != null && beaninfo.getBeanDescriptor() != null &&
beanClass.equals(beaninfo.getBeanDescriptor().getBeanClass()))


------- Comment #1 from from-classpath at savannah dot gnu dot org  2005-04-10 
01:33 -------
I take this one. Thanks for the exhaustive info.


------- Comment #2 from from-classpath at savannah dot gnu dot org  2005-04-28 
19:09 -------
Ok. This problem will be fixed in 0.15

However I found some more problem while fixing this bug. Test case for mauve
will be added soon.


------- Comment #3 from from-classpath at savannah dot gnu dot org  2005-06-17 
02:38 -------
Bah die. :)

Mauve test provided finally.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22907





reply via email to

[Prev in Thread] Current Thread [Next in Thread]