commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 7929] New: - PropertyUtils.gerProperty fails on a class named Component
Date Wed, 10 Apr 2002 18:26:43 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7929>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7929

PropertyUtils.gerProperty fails on a class named Component

           Summary: PropertyUtils.gerProperty fails on a class named
                    Component
           Product: Commons
           Version: Nightly Builds
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: jaynes@umich.edu
                CC: jaynes@umich.edu


I have a test case that fails when I think it should pass.
Let's say, for testing purposes, I have a little bean class called
org.apache.commons.beanutils.Component, which has one read only 
property: myName. getMyName() simply returns "NAME".
The following test case fails:

public void testGetMyName() throws Exception
{
    org.apache.commons.beanutils.Component comp =
        new org.apache.commons.beanutils.Component();
    try
    {
        PropertyUtils.getProperty(comp, "myName");
    } catch (Exception e)
    {
        fail("Fail on getProperty for comp: " + e);
    }
}
It fails with a:
java.lang.NoSuchMethodException: Unknown property 'myName'
If I change the name of Component to Component_2, the test passes.
Changing the name to Color, it fails.
Changing the name to Color_2, it passes.

Is PropertyUtils confusing the org.apache.commons.beanutils.Component 
class with java.awt.Component?

Will Jaynes


My Component class:

package org.apache.commons.beanutils;
public class Component implements java.io.Serializable
{
    public Component() {}
    
    public String getMyName()
    {
        return "NAME";
    }
}

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message