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 10753] New: - BeanUtils.populate() does bad conversion on DynaBean
Date Fri, 12 Jul 2002 18:13:24 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=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:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message