harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-1884) [classlib][beans] RI inconsistency in EventHandler
Date Mon, 16 Oct 2006 17:09:46 GMT
[classlib][beans] RI inconsistency in EventHandler  
----------------------------------------------------

                 Key: HARMONY-1884
                 URL: http://issues.apache.org/jira/browse/HARMONY-1884
             Project: Harmony
          Issue Type: Bug
          Components: Non-bug differences from RI
         Environment: winXP
            Reporter: Alexei Zakharov


It seems to be a bug in RI.  In java.beans.EventHandler. I think RI incorrectly determines
properties here. According to spec, common sense and even the RI's implementation of java.beans.Introspector
the following bean should not contain any properties:

public static class MyBean {
    public void setProp1() {}
}

because "setProp1()" is not a valid setter method - it does not contain a new value to set.
However, the following test fails on RI:

<---
import java.beans.*;

public class TestBeanInfo1 {
   public static class MyBean {
       public void setProp1() {}
   }

   public static void main(String argv[]) throws Exception {
       MyBean bean = new MyBean();
       // "prop1" is neither the name of writeable property nor the
name of any public method
       Object proxy = EventHandler.create(
               PropertyChangeListener.class, bean, "prop1");

       // just to show that Introspector doesn't see the property
with name "prop1"
       PropertyDescriptor[] pds = Introspector.getBeanInfo(MyBean.class,
               Introspector.USE_ALL_BEANINFO).getPropertyDescriptors();
       for (int i = 0; i < pds.length; i++) {
           System.out.println("Property found: " + pds[i].getName());
       }

       // should throw exception
       try {
           ((PropertyChangeListener) proxy).propertyChange(
                   new PropertyChangeEvent(bean, "prop1", "1", "2"));
           System.out.println("FAIL");
       } catch (Throwable t) {
           System.out.println("PASS");
       }
   }
}
<---

So it determines "prop1" as a valid property. IMHO this behavior is inconsistent and we should
not follow RI. It was decided in the list [1] that we should file "Non-bug differences from
RI" JIRA here.

[1] http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200610.mbox/%3c2c9597b90610160811h3ce01126i2359285429ac4e52@mail.gmail.com%3e


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message