Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 33237 invoked from network); 8 Sep 2008 09:13:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Sep 2008 09:13:37 -0000 Received: (qmail 66534 invoked by uid 500); 8 Sep 2008 09:13:34 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 66516 invoked by uid 500); 8 Sep 2008 09:13:34 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 66507 invoked by uid 99); 8 Sep 2008 09:13:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Sep 2008 02:13:34 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Sep 2008 09:12:44 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 2CBAE234C1C5 for ; Mon, 8 Sep 2008 02:12:46 -0700 (PDT) Message-ID: <973107599.1220865166182.JavaMail.jira@brutus> Date: Mon, 8 Sep 2008 02:12:46 -0700 (PDT) From: "Kevin Zhou (JIRA)" To: commits@harmony.apache.org Subject: [jira] Created: (HARMONY-5973) [classlib] [beans] StandardBeanInfo fails to gain correct indexed read and write methods of a indexed property MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [classlib] [beans] StandardBeanInfo fails to gain correct indexed read and write methods of a indexed property -------------------------------------------------------------------------------------------------------------- Key: HARMONY-5973 URL: https://issues.apache.org/jira/browse/HARMONY-5973 Project: Harmony Issue Type: Bug Components: Classlib Affects Versions: 5.0M7, 5.0M6 Reporter: Kevin Zhou Fix For: 5.0M8 Consider test case [1] and bean class [2], currect Harmony's beans actually use Introspector.getBeanInfo method to introspect the IndexedPropertyDescriptor -- "data". The return type of normal getter method is incompatible with the type of indexed getter method, which results in the failure of introspection of this property. In addition, Consider test case [3] and bean class [4], RI's beans will introspect the "data" as a normal property while Harmony's beans will incorrectly regard it as an indexed property. [1] public void testMockIncompatibleGetterAndIndexedGetterBean() throws Exception { Class beanClass = MockIncompatibleGetterAndIndexedGetterBean.class; BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); PropertyDescriptor pd = null; PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors(); for (int i = 0; i < pds.length; i++) { pd = pds[i]; if (pd.getName().equals("data")) { break; } } assertNotNull(pd); assertTrue(pd instanceof IndexedPropertyDescriptor); IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd; assertNull(ipd.getReadMethod()); assertNull(ipd.getWriteMethod()); Method indexedReadMethod = beanClass.getMethod("getData", new Class[] { int.class }); Method indexedWriteMethod = beanClass.getMethod("setData", new Class[] { int.class, int.class }); assertEquals(indexedReadMethod, ipd.getIndexedReadMethod()); assertEquals(indexedWriteMethod, ipd.getIndexedWriteMethod()); } [2] public class MockIncompatibleGetterAndIndexedGetterBean { private int[] datas; public int getData() { return datas[0]; } public int getData(int index) { return datas[index]; } public void setData(int index, int data) { this.datas[index] = data; } } [3] public void testMockIncompatibleGetterAndIndexedGetterBean() throws Exception { Class beanClass = MockIncompatiblePartBean.class; BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); PropertyDescriptor pd = null; PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors(); for (int i = 0; i < pds.length; i++) { pd = pds[i]; if (pd.getName().equals("data")) { break; } } assertNotNull(pd); assertFalse(pd instanceof IndexedPropertyDescriptor); [4] public class MockIncompatiblePartBean{ private int[] datas; public int getData(){ return datas[0]; } public void setData(int index, int data) { this.datas[index] = data; } public void setData(int data){ this.datas[0] = data; } public void setData(){ this.datas[0] = 0; } } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.