Hi Nel,
I fixed today a bug on complex properties (related to phantom flag):
http://jira.nuxeo.org/browse/NXP-2548
I am not sure if this is the same bug as you reported.
You can find an unit test that sets a complex property that contains
another complex property - and the test is working fine (after my fix):
/nuxeo-core-jcr-connector-test/src/test/java/org/nuxeo/ecm/core/repository/jcr/model/TestPropertyModel.java
The test method is: testComplexPropertyChain()
This test is using the XSD at:
/nuxeo-core-jcr-connector-test/src/test/resources/schema/test-properties.xsd
This tests exists only in nuxeo-core#1.5 branch. Can you confirm the
test is covering your case? If not please send me a unit test (you can
modify the existing one) to be able to reproduce your error.
Bogdan
Nel Taurisson wrote:
> 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
>
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm