Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 32660 invoked from network); 13 Nov 2006 18:39:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Nov 2006 18:39:00 -0000 Received: (qmail 12991 invoked by uid 500); 13 Nov 2006 18:39:10 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 12973 invoked by uid 500); 13 Nov 2006 18:39:09 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 12962 invoked by uid 99); 13 Nov 2006 18:39:09 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Nov 2006 10:39:09 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Nov 2006 10:38:58 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6C1A27142D7 for ; Mon, 13 Nov 2006 10:38:38 -0800 (PST) Message-ID: <15505898.1163443118440.JavaMail.jira@brutus> Date: Mon, 13 Nov 2006 10:38:38 -0800 (PST) From: "Alexei Zakharov (JIRA)" To: harmony-commits@incubator.apache.org Subject: [jira] Commented: (HARMONY-1884) [classlib][beans] RI inconsistency in EventHandler In-Reply-To: <26512241.1161018586435.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/HARMONY-1884?page=comments#action_12449439 ] Alexei Zakharov commented on HARMONY-1884: ------------------------------------------ The test case to illustrate another aspect of above problem. I'm going to add the corresponding regression test to EventHanlderTest. public void testInvalidProperties_HY1884() { BeanWithInvalidProps bean = new BeanWithInvalidProps(); Object proxy; // "prop2" is neither the name of valid property nor the // name of any public method // "is" prefix for big Boolean proxy = EventHandler.create( PropertyChangeListener.class, bean, "goodProp3", "source.prop2"); try { ((PropertyChangeListener) proxy).propertyChange( new PropertyChangeEvent(bean, "goodProp3", true, false)); fail(); } catch (Exception e) { // expected } } public static class BeanWithInvalidProps { // Introspector doesn't support "is" prefix for big Boolean public Boolean isProp2() { return new Boolean(true); } // needed to test prop2 public void setGoodProp3(boolean value) {} } > [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