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/10/23 20:11:06 UTC

DO NOT REPLY [Bug 13896] New: - populate fails with mapped properties

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

populate fails with mapped properties

           Summary: populate fails with mapped properties
           Product: Commons
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: emillan22@hotmail.com


I've been trying the 'populate' method from BeanUtils 1.4.1. I notice that when
you use mapped properties and want to hold Objects of any kind different of
'String' into that Map you get an error because all bean properties requested
are processed in an unspecified order.

For example:

I've got a Bean like this:

Bean Test.
 Property name (String)
 Property items (java.util.Map)
 
Into the 'items' property i want to hold 'Article' objects:

Bean Article.
 Property id (String)
 Property name (String)

There may be one or most 'articles' into Test 'items' property.

(The next may be is not important. Begin...).
To populate Test bean,before i create a converter and register it.
TestConverter (converts Map properties and fills in a new Article object instance).
Registered with ConvertUtils.register(new TestConverter(), Map.class)
(end of not important stuff.)

Ok, so when i populate a Test bean with 3 or more Article beans into it, i get
random errors cause (in my opinion) the 'BeanUtils.populate' method processes
the properties in a not specified order. The method tries to populate
"items(one).id" before "items(one)" (the one that fills the map with a new
instance).

Why not to process simple properties first, and then indexed/mapped properties,
and then nested properties?

Thanks.

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