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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to