commit-classpath
[Top][All Lists]
Advanced

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

[commit-cp] [bug #12624] Bean Introspector should check the bean class o


From: Jeff Myers
Subject: [commit-cp] [bug #12624] Bean Introspector should check the bean class of an explicit BeanInfo
Date: Sun, 10 Apr 2005 00:36:01 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050323 Firefox/1.0.2 Fedora/1.0.2-1.3.1

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=12624>

                 Summary: Bean Introspector should check the bean class of an
explicit BeanInfo
                 Project: classpath
            Submitted by: myersj
            Submitted on: Sun 04/10/2005 at 00:36
                Category: classpath
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
        Platform Version: None

    _______________________________________________________

Details:

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()))






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=12624>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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