You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/05/24 21:41:27 UTC

DO NOT REPLY [Bug 35047] New: - BeanUtils failed to copy properties from DynaBean to JavaBean

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35047>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35047

           Summary: BeanUtils failed to copy properties from DynaBean to
                    JavaBean
           Product: Commons
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: myr0ch@gmail.com
                CC: myr0ch@gmail.com


If i copy DynaBean to JavaBean and i have property with few small letters,
everything works. But if i copy property with uppercase second letter (for ex.
sProperty), it isn't working.

JUnit test follows:

public class CopyDynaBeanPropertiesToBeanTest extends TestCase
{

  public static void main(String[] args)
  {
    junit.swingui.TestRunner.run(CopyDynaBeanPropertiesToBeanTest.class);
  }

  public void testCopyProperties() throws IllegalAccessException,
InvocationTargetException
  {
    DynaBean         myBean = new LazyDynaBean();
    DTO              dto    = new DTO();
    //first property
    myBean.set("myProperty", "myValue");
    BeanUtils.copyProperties(dto, myBean);
    //first works
    assertTrue(dto.getMyProperty().equals("myValue"));
  }
  
  public void testAnotherCopyProperties() throws IllegalAccessException,
InvocationTargetException
  {
    DynaBean         myBean = new LazyDynaBean();
    DTO              dto    = new DTO();
    //second property
    myBean.set("sProperty",  "myValue");
    BeanUtils.copyProperties(dto, myBean);
    //property is null
    assertTrue(dto.getSProperty().equals("myValue"));
  }
  
}

and JavaBean:

public class DTO
{
  private String myProperty = null;
  private String  sProperty = null;
  
  //-----------------------------------------------------------------------------
  public String getMyProperty()
  {
    return myProperty;
  }
  //-----------------------------------------------------------------------------
  public void setMyProperty(String myProperty)
  {
    this.myProperty = myProperty;
  }
  //-----------------------------------------------------------------------------
  public String getSProperty()
  {
    return sProperty;
  }
  //-----------------------------------------------------------------------------
  public void setSProperty(String property)
  {
    sProperty = property;
  }
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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