Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 64772 invoked from network); 24 Aug 2009 17:12:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Aug 2009 17:12:37 -0000 Received: (qmail 62579 invoked by uid 500); 24 Aug 2009 14:26:21 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 62486 invoked by uid 500); 24 Aug 2009 14:26:21 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 62476 invoked by uid 99); 24 Aug 2009 14:26:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2009 14:26:21 +0000 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, 24 Aug 2009 14:26:19 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 56B86234C1E6 for ; Mon, 24 Aug 2009 07:25:59 -0700 (PDT) Message-ID: <848596434.1251123959350.JavaMail.jira@brutus> Date: Mon, 24 Aug 2009 07:25:59 -0700 (PDT) From: "Richard O'Sullivan (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (BEANUTILS-357) PropertyUtilsTestCase.testGetReadMethod* fail for abstract properties. In-Reply-To: <1397428843.1250871614830.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/BEANUTILS-357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12746891#action_12746891 ] Richard O'Sullivan commented on BEANUTILS-357: ---------------------------------------------- Niall, I found the issue while using BeanUtils 1.8.0 but ran the unit tests using truck (1.9-SNAPSHOT). Since my initial posting, I narrowed the issue down to the following test case. The test below fails due to 'expected: but was:'. My expectation is that the PropertyDescriptor for the "innerClassProperty" should be the subclass's type instead of the super's type; but, the test indicates the opposite is occurring. Background: I encountered this issue while using Wicket Web Beans (WWB) to auto-generate forms. WWB calls PropertyUtils.getPropertyDescriptors() on a bean to reflectively generate a web form. In my case, the resulting form did not include my equivalent of 'TestBean.InnerClass' because, I believe, PropertyUtils returned AbstractTestBean$InnerClass instead of TestBean$InnerClass. 1) Add this to AbstractTestBean: public abstract static class InnerClass { // Subclass implements properties here. private String firstName; public String getInnerName() { return firstName; } public void setInnerName(String firstName) { this.firstName = firstName; }; } public abstract AbstractTestBean.InnerClass getInnerClassProperty(); 2) Add implementation to TestBean: public static class InnerClass extends AbstractTestBean.InnerClass { private String lastName; public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } } private TestBean.InnerClass innerClassProperty; public TestBean.InnerClass getInnerClassProperty() { return innerClassProperty; } public void setInnerClassProperty(TestBean.InnerClass innerClassProperty) { this.innerClassProperty = innerClassProperty; } 3) Add test case to PropertyUtilsTestCase: /** * Positive getPropertyDescriptor on property innerClassProperty. */ public void testGetDescriptorInnerClass() { String propName = "innerClassProperty"; try { PropertyDescriptor pd = PropertyUtils.getPropertyDescriptor(bean, propName); assertEquals(TestBean.InnerClass.class, pd.getPropertyType()); } catch (IllegalAccessException e) { fail("IllegalAccessException"); } catch (InvocationTargetException e) { fail("InvocationTargetException"); } catch (NoSuchMethodException e) { fail("NoSuchMethodException"); } testGetDescriptorBase(propName, "getInnerClassProperty", "setInnerClassProperty"); } > PropertyUtilsTestCase.testGetReadMethod* fail for abstract properties. > ---------------------------------------------------------------------- > > Key: BEANUTILS-357 > URL: https://issues.apache.org/jira/browse/BEANUTILS-357 > Project: Commons BeanUtils > Issue Type: Bug > Components: Bean / Property Utils > Environment: Java(TM) SE Runtime Environment (build 1.6.0_14-b08) > Linux 2.6.24-22-generic #1 SMP Mon Nov 24 18:32:42 UTC 2008 i686 GNU/Linux > Reporter: Richard O'Sullivan > Attachments: AbstractTestBean.java, BEANUTILS-357-AbstractTestBean.patch > > > Create org.apache.commons.beanutils.AbstractTestBean with abstract methods for properties in TestBean and change TestBean to extend AbstractTestBean. Run PropertyUtilsTestCase, the testGetReadMethod* methods fail because "Correct declaring class for X expected:<...Abstract...> but was:<......>". -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.