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 2002/07/12 20:13:24 UTC

DO NOT REPLY [Bug 10753] New: - BeanUtils.populate() does bad conversion on DynaBean

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=10753>.
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=10753

BeanUtils.populate() does bad conversion on DynaBean

           Summary: BeanUtils.populate() does bad conversion on DynaBean
           Product: Commons
           Version: Nightly Builds
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: lalyos@yahoo.com


If you have a dynaBean with a mapped property, and you try to populate a 
String into this property, the BeanUtils tries to convert the String into Map. 

Consider the following code:
--------------------------------------------
import org.apache.commons.beanutils.*;
import java.util.*;

public class BeanUtilTester {

    public static void main(String[] args) throws Exception {
        DynaProperty[] props = {new DynaProperty("customer", HashMap.class)};
        BasicDynaClass dClass = new BasicDynaClass("myClass",
BasicDynaBean.class ,props);
        
        DynaBean bean = dClass.newInstance();
        bean.set("customer", new HashMap());

        Map values = new HashMap();
        values.put("customer(name)", "joe");
        BeanUtils.populate(bean, values);

        System.out.println("bean : " + bean);    
    }
}
--------------------------------------------

With debug

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>