Hi,

I've found a bug in the complex property implementation
(org.nuxeo.ecm.core.api.model.impl.ComplexProperty).

It occures for nested complex type (that is a complex type which holds a
field that is a complex type). When the nested complex field id is
initialised as empty then queried again, its value is a string (it seems to
be a unique identifier string) and a class cast exception is throwned as the
complex property expects a map.

I've managed to work around the bug, but its an ugly way of managing it I've
modified the ComplexProperty init method code to check for the type and by
pass a none map value. Here's the modified code :

    @Override
    @SuppressWarnings("unchecked")
    public void init(Serializable value) throws PropertyException {
        if (value == null) { // IGNORE null values - properties will be
considered PHANTOMS
            return;
        }
        if( value instanceof Map ) {
            Map<String, Serializable> map = (Map<String,
Serializable>)value;
            for (Map.Entry<String, Serializable> entry : map.entrySet()) {
                Property property = get(entry.getKey());
                property.init(entry.getValue());
            }
        }
        clearFlags(IS_PHANTOM);
    }


Maybe this will be corrected with the next property implementation...

I'm working on the 5.1.6 branch.

Thanks.

Nel
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

Reply via email to